gcc源代码分析之varasm.c
来源:互联网 发布:上海心动网络怎么样 编辑:程序博客网 时间:2024/05/24 05:40
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))output_constant_def (exp);
/* TREE_CST_RTL probably contains a constant address.
On RISC machines where a constant address isn't valid,
make some insns to get that address into a register. */
if (GET_CODE (TREE_CST_RTL (exp)) == MEM
&& modifier != EXPAND_CONST_ADDRESS
&& !memory_address_p (mode, XEXP (TREE_CST_RTL (exp), 0)))
return change_address (TREE_CST_RTL (exp), VOIDmode,
copy_rtx (XEXP (TREE_CST_RTL (exp), 0)));
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。
- gcc源代码分析之varasm.c
- Gcc源代码分析,rtl.c源代码分析
- gcc源代码分析之gen_call_value()函数
- 关于 bison源代码分析--gcc源代码分析之语法分析部分 的说明
- gcc源代码分析 gen_rtx()函数
- gcc源代码分析emit_call_insn()函数
- GCC源代码分析,recog_memoized()函数
- gcc源代码分析,output_asm_insn()函数
- gcc源代码分析,语法树
- gcc源代码分析,expand_expr_stmt()函数
- qmail源代码分析之qmail-smtpd.c
- qmail源代码分析之qmail-popup.c
- shoelace源代码分析之shoe.c
- gcc源代码分析,rtx_alloc函数分析
- gcc源代码分析,build_string ()函数分析
- gcc源代码分析,build_function_call ()函数分析
- gcc源代码分析,build_pointer_type ()函数分析
- gcc源代码分析,actualparameterlist ()函数分析
- 根据单词中字符的位置,确定单词为句中第几个
- 给非计算机专业大二学生的建议
- JPA初识
- 关于data-ng-model和ng-model
- Palindrome Number
- gcc源代码分析之varasm.c
- mysql having的用法
- 4Sum
- ExtJs xtype一览表
- 文件路径个人理解
- 苹果App Store审核指南中文翻译
- String to Integer (atoi)
- Reverse Integer
- Add Two Numbers