rtx
expand_expr (exp, target, tmode, modifier)
register tree exp;
rtx target;
enum machine_mode tmode;
enum expand_modifier modifier;
{
.....
case STRING_CST:
if (! TREE_CST_RTL (exp))return TREE_CST_RTL (exp);
/* Return an rtx representing a reference to constant data in memory
for the constant expression EXP.
If assembler code for such a constant has already been output,
return an rtx to refer to it.
Otherwise, output such a constant in memory and generate
an rtx for it. The TREE_CST_RTL of EXP is set up to point to that rtx. */
rtx
output_constant_def (exp)
tree exp;
{
register rtx def;
int temp_p = allocation_temporary_p ();
if (TREE_CODE (exp) == INTEGER_CST)
abort (); /* No TREE_CST_RTL slot in these. */
if (TREE_CST_RTL (exp))
return TREE_CST_RTL (exp);
if (TREE_PERMANENT (exp))
end_temporary_allocation ();
def = gen_rtx (SYMBOL_REF, Pmode, get_or_assign_label (exp));
TREE_CST_RTL (exp)
= gen_rtx (MEM, TYPE_MODE (TREE_TYPE (exp)), def);
RTX_UNCHANGING_P (TREE_CST_RTL (exp)) = 1;
if (temp_p && TREE_PERMANENT (exp))
resume_temporary_allocation ();
return TREE_CST_RTL (exp);
}
expand_expr code = 26
<string_cst 84014
type <array_type 94ef4
type <integer_type 825bc char permanent QI
size <integer_cst 82638 literal permanent 1
align 8 size_unit 8 sep_unit 8 symtab 0
sep <integer_cst 82608 literal permanent -128 precision 8 min <integer_cst 82608 -128>
max <integer_cst 82620 literal permanent 127
pointer_to_this <pointer_type 88a44> chain <integer_type 826a8 long int>
BLK
size <integer_cst 94f40 literal 15
align 8 size_unit 8 sep_unit 8 symtab 0 sep <integer_cst 82638 1>
domain <integer_type 94ea8 SI
size <integer_cst 8254c literal permanent 4
align 32 size_unit 8 sep_unit 32 symtab 0
sep <integer_cst 84048 literal 0 precision 32 min <integer_cst 84048 0>
max <integer_cst 84078 literal 14
pointer_to_this <pointer_type 94f58> chain <pointer_type 94f58>
static literal "Hello, world!
"
(symbol_ref:SI ("*LC0"))
(mem:BLK (symbol_ref:SI ("*LC0")))
上面的代码可以解释上面两个rtx的生成过程。
.file "hello.c"
gcc_compiled.:
.text
LC0:
.ascii "Hello, world!\12\0"
.align 2
.globl _main
_main:
pushl %ebp
movl %esp,%ebp
pushl $LC0
call _printf
xorl %eax,%eax
jmp L1
.align 2
L1:
leave
ret
Hello.world!\12\0 是个字符串常量,编译过程给了一个符号LC0。
原文地址:http://blog.csdn.net/oldlinux/article/details/42417915