using gcc; namespace langhook { function expand_stmt(stmts) { expand_expr_stmt( stmts.value ); } }; var gi = get_identifier; var global_id = gi("global"); var global_decl = build_decl( VAR_DECL, global_id, types.int ); with (global_decl) { initial = 4; used = true; static = true; public = true; external = false; } expand_decl( global_decl ); expand_decl_init( global_decl ); rest_of_decl_compilation( global_decl, null, true, false ); function gen_body() { var rhs = build( PLUS_EXPR, types.int, 1, 2 ); var lhs = global_decl; return [ build( MODIFY_EXPR, types.int, lhs, rhs ) ]; } var x = gi("hoge"); var decl = build_decl( FUNCTION_DECL, x, types.int ); with (decl) { result = build_decl( RESULT_DECL, gi("ret1"), types.int ); type = build_function_type( types.int, [types.int,types.void] ); arguments = build_decl(PARM_DECL,gi("arg1"),types.int); arguments.chain = null; saved_tree = gen_body(); used = true; static = true; public = true; external = false; initial = make_node( BLOCK ); } expand_decl( decl ); expand_decl_init( decl ); tree_rest_of_compilation( decl, false );
これが、
.file "test.ilog" .globl global .data .align 4 .type global, @object .size global, 4 global: .long 4 .text .globl hoge .type hoge, @function hoge: pushl %ebp movl %esp, %ebp movl $3, global leave ret .size hoge, .-hoge .section .note.GNU-stack,"",@progbits .ident "GCC: (GNU) 3.4.1"
こうなる。(長いよ)
http://morihyphen.hp.infoseek.co.jp/files/ilog-20040928.tar.gz
お、
/bin/tar: 空の書庫作成はご容赦願います もっと詳しい情報は `/bin/tar --help' と入力すれば得られます.
tarのエラーメッセージってこんなのがあるのか。ご容赦されます。