----------------------
| Dumping IR with cg |
----------------------
% cc -O -Wc,-Qcg-A hello.c
-----------------------------------
BEGIN PRINTING CODE GENERATOR INPUT
-----------------------------------
print_code_generator_input: 9 segments
print_code_generator_input: 3 blocks
print_code_generator_input: 15 leaves
print_code_generator_input: 12 triples
print_code_generator_input: 0 tuples
print_code_generator_input: 0 loops
print_code_generator_input: 0 lists
print_code_generator_input: 148 string_chars
Module hello.c
Routine main
SEGMENTS
.ARG_SEG(ARG_SEG,STG_SEG,BUILTIN_SEG,LCLSTG_SEG)[%fp+0]
.BSS_SMALL(BSS_SEG,STG_SEG,BUILTIN_SEG,LCLSTG_SEG)
.BSS_LARGE(BSS_SEG,STG_SEG,BUILTIN_SEG,LCLSTG_SEG)
.DATA_SEG(DATA_SEG,STG_SEG,BUILTIN_SEG,LCLSTG_SEG)
.AUTO_SEG(AUTO_SEG,STG_SEG,BUILTIN_SEG,LCLSTG_SEG)[%fp+0]
.HEAP_SEG(HEAP_SEG,STG_SEG,BUILTIN_SEG,EXTSTG_SEG) leaves:
L[0] undef VAR .HEAP_SEG var# = 0
.DREG_SEG(DREG_SEG,REG_SEG,BUILTIN_SEG,LCLSTG_SEG)
.FREG_SEG(FREG_SEG,REG_SEG,BUILTIN_SEG,LCLSTG_SEG)
.L79(BSS_SEG,STG_SEG,USER_SEG,LCLSTG_SEG) leaves:
L[6] char VAR .L79 [no_reg]
LEAVES
L[0] undef VAR .HEAP_SEG var# = 0
L[1] "" int CONST (0x0) 77
L[2] "" int CONST (0x0) 78
L[3] "" int CONST (0x0) 0
L[4] "" string size 7 align 1 CONST 'hello.c'
L[5] "" int CONST (0x0) 5
L[6] char VAR .L79 [no_reg]
L[7] PTR char ADDR_CONST .L79 L[6]
L[8] "" PTR FTN int CONST printf
L[9] "" int CONST (0x0) 76
L[10] "" int CONST (0xffffffff) -1
L[11] "" int CONST (0x0) 1
L[12] "" int CONST (0x0) 77000001
L[13] "" int CONST (0x0) 77000003
L[14] "" int CONST (0x0) 77000002
BLOCKS
B[0] main label 77000003 next 1
triples:0 2
pred:
succ:
B[1] label 77000001 next 2
triples:3 4 6 8
pred:
succ:
B[2] label 77000002 next -1
triples:9 11
pred:
succ:
TRIPLES:
T[0] int labeldef L[13]=(0x0) 77000003
T[2] int goto L[12]=(0x0) 77000001
T[3] int labeldef L[12]=(0x0) 77000001
T[4] undef stmt L[4]='hello.c' L[5]=(0x0) 5
T[6] int scall L[8]=printf args :
T[5] PTR char param L[7]=.L79 T[6]
(tail call)
T[8] int goto L[14]=(0x0) 77000002
T[9] int labeldef L[14]=(0x0) 77000002
T[11] int goto L[10]=(0xffffffff) -1
LOOPS
---------------------------------
END PRINTING CODE GENERATOR INPUT
---------------------------------
--------------------------
| Dumping IR with disass |
--------------------------
% cc -O -keeptmp -# hello.c
/set/dist/sparc-S2/bin/../SC3.0.1/bin/acomp -i hello.c -o /tmp/acompAAAa002aS -r /tmp/acompBAAa002aS -Qy -D__SUNPRO_C=0x301 -D__SVR4 -D__unix -D__sun -D__sparc -D__BUILTIN_VA_ARG_INCR -Dunix -Dsun -Dsparc -I/set/dist/sparc-S2/SC3.0.1/include/cc -O2 -g/set/dist/sparc-S2/bin/../SC3.0.1/bin/cc -O -keeptmp -c
/set/dist/sparc-S2/bin/../SC3.0.1/bin/iropt -F -o /tmp/iroptCAAa002aS -O2 /tmp/acompBAAa002aS
/set/dist/sparc-S2/bin/../SC3.0.1/bin/cg -oo hello.o -s -O2 -Qy -cg89 -is /tmp/acompAAAa002aS -ir /tmp/iroptCAAa002aS
### Note: LD_LIBRARY_PATH = /usr/openwin/lib:/home/X11/lib:/usr/ucblib
### Note: LD_RUN_PATH =
/usr/ccs/bin/ld /set/dist/sparc-S2/SC3.0.1/lib/crti.o /set/dist/sparc-S2/SC3.0.1/lib/crt1.o /set/dist/sparc-S2/SC3.0.1/lib/__fstd.o /set/dist/sparc-S2/SC3.0.1/lib/values-xt.o hello.o -Y P,/set/dist/sparc-S2/SC3.0.1/lib:/usr/ccs/lib:/usr/lib -Qy -lc /set/dist/sparc-S2/SC3.0.1/lib/crtn.o
% /set/lang/goli2/grover/ir_tools/disass/code/disass /tmp/acompBAAa002aS
# line 4 "hello.c"
C PROGRAM OPT_LEVEL 2 VERS 4 2 9
GLOBAL PROC main { REGMASK 0X3FFF003C, FREGMASK 0XFFFFFF00, PROCNO 75 }()
GLOBAL { BUILTIN_SEG, SEG_NAME ".BSS_SMALL" };
GLOBAL { BUILTIN_SEG, SEG_NAME ".BSS_LARGE" };
DATA { BUILTIN_SEG, SEG_NAME ".DATA_SEG" };
LOCAL { BUILTIN_SEG, %30+0, SEG_NAME ".AUTO_SEG" };
HEAP { BUILTIN_SEG, EXTSTG_SEG, SEG_NAME ".HEAP_SEG" };
DREG { BUILTIN_SEG, SEG_NAME ".DREG_SEG" };
FREG { BUILTIN_SEG, SEG_NAME ".FREG_SEG" };
GLOBAL L79 : CHAR { SEG_NAME ".L79", PASS1_ID "" };
FUNCTION printf : INT ;
ENTRY "main" { IS_EXT_ENTRY , ENTRY_IS_GLOBAL }
LAB_77:
GOTO LAB_78;
BLOCK
LAB_78:
# line 5 "hello.c"
printf(&L79) {INT };
GOTO LAB_76;
BLOCK
LAB_76:
GOTO EXIT;
EXIT
-------------------------
| Dumping IR from acomp |
-------------------------
Build acomp with :
% make COPTS="-g -DYYDEBUG -DDEBUG" STRIP=echo NODBG=""
This is also a debuggable acomp.
% acomp -1I hello.c
.xstabs ".stab.index","Xt ; V=3.0 ; R=3.0",60,0,0,0
.xstabs ".stab.index","/set/lang/bluedevil/ma/lang/acomp/debug; hello.c -W0,-xp",52,0,0,0
.file "hello.c"
.ident "@(#)stdio.h\t1.30\t94/01/05 SMI"
.ident "@(#)feature_tests.h\t1.5\t93/04/26 SMI"
.xstabs ".stab.index","main",42,0,0,0
.section ".rodata1"
.align 4
.L78:
.ascii "Hello world!\n\0"
SEGMENTS
.ARG_SEG(ARG_SEG,STG_SEG,BUILTIN_SEG,LCLSTG_SEG)[%i6+0]
.BSS_SMALL(BSS_SEG,STG_SEG,BUILTIN_SEG,LCLSTG_SEG)
.BSS_LARGE(BSS_SEG,STG_SEG,BUILTIN_SEG,LCLSTG_SEG)
.DATA_SEG(DATA_SEG,STG_SEG,BUILTIN_SEG,LCLSTG_SEG)
.AUTO_SEG(AUTO_SEG,STG_SEG,BUILTIN_SEG,LCLSTG_SEG)[%i6+0]
.HEAP_SEG(HEAP_SEG,STG_SEG,BUILTIN_SEG,EXTSTG_SEG)
.DREG_SEG(DREG_SEG,REG_SEG,BUILTIN_SEG,LCLSTG_SEG)
.FREG_SEG(FREG_SEG,REG_SEG,BUILTIN_SEG,LCLSTG_SEG)
.L78(BSS_SEG,STG_SEG,USER_SEG,LCLSTG_SEG)
BLOCKS
B[0] main label 77 next 1
triples:0 1 3 5
B[1] label 76 next -1
triples:6 8
LEAVES
L[0] undef VAR .HEAP_SEG+0 var# = 0
L[1] "" int CONST 77
L[2] "" string CONST 'hello.c'
L[3] "" int CONST 5
L[4] char VAR .L78+0
L[5] PTR char ADDR_CONST .L78+0
L[6] "" PTR FTN int CONST printf
L[7] "" int CONST 76
L[8] "" int CONST 0
L[9] "" int CONST -1
TRIPLES
T[0] labeldef L[1]=77
T[1] stmt L[2]='hello.c' L[3]=5
T[3] scall L[6]=printf args :
T[2] param L[5]=.L78+0 T[3]
T[5] goto L[7]=76
T[6] labeldef L[7]=76
T[8] goto L[9]=-1
LOOPINFO
26 Mar 1996.