Thursday, 11 October 2007
gcc が tail call optimization をした瞬間
結局、フラグを立てるだけで、jmp命令は、i386.md レベルで変換している。でも、PowerPC の darin.md だと、if 文ではないみたい。いろいろ不思議だ...
(gdb) run -O2 test.c
Starting program: /Users/kono/src/gcc/mygcc2/gcc/cc1 -O2 test.c
Reading symbols for shared libraries ........+ done
test01 test02 test03 main
Analyzing compilation unit
Performing interprocedural optimizations
Assembling functions:
test03 test02
Breakpoint 1, output_552 (operands=0x40841720, insn=0x41f9bd50) at insn-output.c:2974
2974 if (SIBLING_CALL_P (insn))
(gdb) where
#0 output_552 (operands=0x40841720, insn=0x41f9bd50) at insn-output.c:2974
#1 0x0027d1c2 in final_scan_insn (insn=0x41f9bd50, file=0xa000bda0, optimize=2, nopeepholes=0, seen=0xbffff04c) at ../../gcc/gcc/final.c:2412
#2 0x0027d668 in final (first=0x41f97d80, file=0xa000bda0, optimize=2) at ../../gcc/gcc/final.c:1611
#3 0x0027d761 in rest_of_handle_final () at ../../gcc/gcc/final.c:3914
#4 0x0050abb0 in execute_one_pass (pass=0x790d00) at ../../gcc/gcc/passes.c:858
#5 0x0050ad47 in execute_pass_list (pass=0x793020) at ../../gcc/gcc/passes.c:903
#6 0x0050ad5a in execute_pass_list (pass=0x790ee0) at ../../gcc/gcc/passes.c:904
#7 0x0050ad5a in execute_pass_list (pass=0x78f440) at ../../gcc/gcc/passes.c:904
#8 0x000bd8d8 in tree_rest_of_compilation (fndecl=0x41f8ee80) at ../../gcc/gcc/tree-optimize.c:463
#9 0x0001aabe in c_expand_body (fndecl=0x41f8ee80) at ../../gcc/gcc/c-decl.c:6855
#10 0x005837d6 in cgraph_expand_function (node=0x41eec900) at ../../gcc/gcc/cgraphunit.c:1096
#11 0x005850da in cgraph_optimize () at ../../gcc/gcc/cgraphunit.c:1161
#12 0x0001d857 in c_write_global_declarations () at ../../gcc/gcc/c-decl.c:7968
#13 0x004c8cf4 in toplev_main (argc=3, argv=0xbffff3f8) at ../../gcc/gcc/toplev.c:1040
#14 0x00001a02 in _start ()
#15 0x00001929 in start ()
(gdb) s
2979 }
(gdb) s
final_scan_insn (insn=0x41f9bd50, file=0xa000bda0, optimize=2, nopeepholes=0, seen=0xbffff04c) at ../../gcc/gcc/final.c:2417
2417 if (template == 0)
(gdb) s
2440 if (template[0] == '#' && template[1] == '\0')
(gdb) s
2466 output_asm_insn (template, recog_data.operand);
(gdb) s
output_asm_insn (template=0x733690 "jmp\t%P0", operands=0x40841720) at ../../gcc/gcc/final.c:2938
2938 if (*template == 0)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment