This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
global/static initializer values in final rtl pass dump file
- From: Prathamesh Kulkarni <bilbotheelffriend at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Wed, 25 Sep 2013 19:47:10 +0530
- Subject: global/static initializer values in final rtl pass dump file
- Authentication-results: sourceware.org; auth=none
Hi,
I am very new to gcc. Is there an option to put values of
global/static variables in dump file of final rtl pass
(-fdump-final-insns) ? I am trying to get dump for initializer int a =
5; in the dump of final rtl pass (am I supposed to look for
var_location in dump file ?)
int a = 5;
int main(void)
{
return a;
}
I used the following command to compile the above code (in x.c):
gcc -fvar-tracking -fvar-tracking-assignments -fdump-final-insns=x.rtl x.c
I only get the dump for main function:
;; Function main (main, funcdef_no=0, decl_uid=1357, cgraph_uid=0)
(note# 0 0 NOTE_INSN_DELETED)
(note# 0 0 [bb 2] NOTE_INSN_BASIC_BLOCK)
(insn/f# 0 0 2 (set (mem:SI (pre_dec:SI (reg/f:SI 7 sp)) [ S4 A8])
(reg/f:SI 6 bp)) integer.c:4# {*pushsi2}
(nil))
(insn/f# 0 0 2 (set (reg/f:SI 6 bp)
(reg/f:SI 7 sp)) integer.c:4# {*movsi_internal}
(nil))
(note# 0 0 NOTE_INSN_PROLOGUE_END)
(note# 0 0 NOTE_INSN_FUNCTION_BEG)
(insn# 0 0 2 (set (reg:SI 0 ax [orig:59 D.1360 ] [59])
(mem/c:SI (symbol_ref:SI ("a") [flags 0x2] <var_decl # a>) [
a+0 S4 A32])) integer.c:5# {*movsi_internal}
(nil))
(insn# 0 0 2 (use (reg/i:SI 0 ax)) integer.c:6#
(nil))
(note# 0 0 NOTE_INSN_EPILOGUE_BEG)
(insn/f# 0 0 2 (set (reg/f:SI 6 bp)
(mem:SI (post_inc:SI (reg/f:SI 7 sp)) [ S4 A8])) integer.c:6# {*popsi1}
(expr_list:REG_CFA_DEF_CFA (plus:SI (reg/f:SI 7 sp)
(const_int 4 [0x4]))
(expr_list:REG_CFA_RESTORE (reg/f:SI 6 bp)
(nil))))
(jump_insn# 0 0 2 (simple_return) integer.c:6# {simple_return_internal}
(nil)
-> simple_return)
(barrier 0 0 0)
(note# 0 0 NOTE_INSN_DELETED)
I am using gcc-4.7.2 on ubuntu 13.04
Using built-in specs.
COLLECT_GCC=/home/bilbo/gcc_stuff/gcc-4.7.2/install/bin/gcc
COLLECT_LTO_WRAPPER=/home/bilbo/gcc_stuff/gcc-4.7.2/install/libexec/gcc/i686-pc-linux-gnu/4.7.2/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../src/configure
--prefix=/home/bilbo/gcc_stuff/gcc-4.7.2/install/
--enable-languages=c,c++
Thread model: posix
gcc version 4.7.2 (GCC)
Thanks and Regards,
Prathamesh