optimierende compiler
play

Optimierende Compiler Aufbau GIMPLE IR Uberblick uber die GNU - PowerPoint PPT Presentation

OC A. Koch Compile-Flu Optimierende Compiler Aufbau GIMPLE IR Uberblick uber die GNU Compiler Collection gcc RTL IR Optimierung Andreas Koch FG Eingebettete Systeme und ihre Anwendungen Informatik, TU Darmstadt


  1. 1 July 2011 Graybox Probing-I: Preliminaries 9/43 Producing the Output of GCC Passes • Use the option -fdump-<ir>-<passname> <ir> could be ◮ tree : Intraprocedural passes on GIMPLE ◮ ipa : Interprocedural passes on GIMPLE ◮ rtl : Intraprocedural passes on RTL • Use all in place of <pass> to see all dumps Example: gcc -fdump-tree-all -fdump-rtl-all test.c • Dumping more details: Suffix raw for tree passes and details or slim for RTL passes Individual passes may have more verbosity options (e.g. -fsched-verbose=5 ) • Use -S to stop the compilation with assembly generation • Use --verbose-asm to see more detailed assembly dump Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  2. 1 July 2011 Graybox Probing-I: Preliminaries 10/43 Total Number of Dumps Optimization Number of Goals Level Dumps Default 47 Fast compilation O1 134 O2 158 O3 168 Os 156 Optimize for space Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  3. 1 July 2011 Graybox Probing-I: Preliminaries 11/43 Selected Dumps for Our Example Program GIMPLE dumps (t) 138t.cplxlower0 163r.reginfo 143t.optimized 183r.outof cfglayout 001t.tu 224t.statistics 184r.split1 003t.original 186r.dfinit 004t.gimple ipa dumps (i) 187r.mode sw 006t.vcg 000i.cgraph 188r.asmcons 009t.omplower 014i.visibility 191r.ira 010t.lower 015i.early local cleanups 194r.split2 012t.eh 044i.whole-program 198r.pro and epilogue 013t.cfg 048i.inline 211r.stack 017t.ssa rtl dumps (r) 212r.alignments 018t.veclower 144r.expand 215r.mach 019t.inline param1 145r.sibling 216r.barriers 020t.einline 147r.initvals 220r.shorten 037t.release ssa 148r.unshare 221r.nothrow 038t.inline param2 149r.vregs 222r.final 044i.whole-program 150r.into cfglayout 223r.dfinish 048i.inline 151r.jump assembly Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  4. 1 July 2011 Graybox Probing-I: Preliminaries 12/43 Passes for First Level Graybox Probing of GCC C Source Code Reg Allocator Parser AST ira Gimplifier pro epilogue generation prologue-epilogue GIMPLE CFG Generator Pattern Matcher CFG ASM Program RTL Generator RTL expand Lowering of abstraction! Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  5. Part 2 Examining GIMPLE Dumps

  6. 1 July 2011 Graybox Probing-I: Examining GIMPLE Dumps 13/43 Gimplifier • About GIMPLE ◮ Three-address representation derived from GENERIC Computation represented as a sequence of basic operations Temporaries introduced to hold intermediate values ◮ Control construct are explicated into conditional jumps • Examining GIMPLE Dumps ◮ Examining translation of data accesses ◮ Examining translation of control flow ◮ Examining translation of function calls Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  7. 1 July 2011 Graybox Probing-I: Examining GIMPLE Dumps 14/43 GIMPLE: Composite Expressions Involving Local and Global Variables test.c test.c.004t.gimple int a; x = 10; int main() y = 5; { D.1954 = x * y; int x = 10; a.0 = a; int y = 5; x = D.1954 + a.0; a.1 = a; x = a + x * y; D.1957 = a.1 * x; y = y - a * x; y = y - D.1957; } Global variables are treated as “memory locations” and local variables are treated as “registers” Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  8. 1 July 2011 Graybox Probing-I: Examining GIMPLE Dumps 14/43 GIMPLE: Composite Expressions Involving Local and Global Variables test.c test.c.004t.gimple int a; x = 10; int main() y = 5; { D.1954 = x * y; int x = 10; a.0 = a; int y = 5; x = D.1954 + a.0; a.1 = a; x = a + x * y; D.1957 = a.1 * x; y = y - a * x; y = y - D.1957; } Global variables are treated as “memory locations” and local variables are treated as “registers” Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  9. 1 July 2011 Graybox Probing-I: Examining GIMPLE Dumps 14/43 GIMPLE: Composite Expressions Involving Local and Global Variables test.c test.c.004t.gimple int a; x = 10; int main() y = 5; { D.1954 = x * y; int x = 10; a.0 = a; int y = 5; x = D.1954 + a.0; a.1 = a; x = a + x * y; D.1957 = a.1 * x; y = y - a * x; y = y - D.1957; } Global variables are treated as “memory locations” and local variables are treated as “registers” Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  10. 1 July 2011 Graybox Probing-I: Examining GIMPLE Dumps 14/43 GIMPLE: Composite Expressions Involving Local and Global Variables test.c test.c.004t.gimple int a; x = 10; int main() y = 5; { D.1954 = x * y; int x = 10; a.0 = a; int y = 5; x = D.1954 + a.0; a.1 = a; x = a + x * y; D.1957 = a.1 * x; y = y - a * x; y = y - D.1957; } Global variables are treated as “memory locations” and local variables are treated as “registers” Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  11. 1 July 2011 Graybox Probing-I: Examining GIMPLE Dumps 15/43 GIMPLE: 1-D Array Accesses test.c test.c.004t.gimple a[2] = 10; D.1952 = a[2]; int main() a[1] = D.1952; { D.1953 = a[1]; int a[3], x; D.1954 = a[2]; a[1] = a[2] = 10; x = D.1953 + D.1954; x = a[1] + a[2]; a[0] = a[1] + a[1]*x; D.1955 = x + 1; D.1956 = a[1]; } D.1957 = D.1955 * D.1956; a[0] = D.1957; Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  12. 1 July 2011 Graybox Probing-I: Examining GIMPLE Dumps 15/43 GIMPLE: 1-D Array Accesses test.c test.c.004t.gimple a[2] = 10; D.1952 = a[2]; int main() a[1] = D.1952; { D.1953 = a[1]; int a[3], x; D.1954 = a[2]; a[1] = a[2] = 10; x = D.1953 + D.1954; x = a[1] + a[2]; a[0] = a[1] + a[1]*x; D.1955 = x + 1; D.1956 = a[1]; } D.1957 = D.1955 * D.1956; a[0] = D.1957; Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  13. 1 July 2011 Graybox Probing-I: Examining GIMPLE Dumps 15/43 GIMPLE: 1-D Array Accesses test.c test.c.004t.gimple a[2] = 10; D.1952 = a[2]; int main() a[1] = D.1952; { D.1953 = a[1]; int a[3], x; D.1954 = a[2]; a[1] = a[2] = 10; x = D.1953 + D.1954; x = a[1] + a[2]; a[0] = a[1] + a[1]*x; D.1955 = x + 1; D.1956 = a[1]; } D.1957 = D.1955 * D.1956; a[0] = D.1957; Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  14. 1 July 2011 Graybox Probing-I: Examining GIMPLE Dumps 15/43 GIMPLE: 1-D Array Accesses test.c test.c.004t.gimple a[2] = 10; D.1952 = a[2]; int main() a[1] = D.1952; { D.1953 = a[1]; int a[3], x; D.1954 = a[2]; a[1] = a[2] = 10; x = D.1953 + D.1954; x = a[1] + a[2]; a[0] = a[1] + a[1]*x; D.1955 = x + 1; D.1956 = a[1]; } D.1957 = D.1955 * D.1956; a[0] = D.1957; Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  15. 1 July 2011 Graybox Probing-I: Examining GIMPLE Dumps 15/43 GIMPLE: 1-D Array Accesses test.c test.c.004t.gimple a[2] = 10; D.1952 = a[2]; int main() a[1] = D.1952; { D.1953 = a[1]; int a[3], x; D.1954 = a[2]; a[1] = a[2] = 10; x = D.1953 + D.1954; x = a[1] + a[2]; a[0] = a[1] + a[1]*x; D.1955 = x + 1; D.1956 = a[1]; } D.1957 = D.1955 * D.1956; a[0] = D.1957; Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  16. 1 July 2011 Graybox Probing-I: Examining GIMPLE Dumps 16/43 GIMPLE: 2-D Array Accesses test.c test.c.004t.gimple int main() a[0][0] = 7; { a[1][1] = 8; int a[3][3], x, y; a[2][2] = 9; a[0][0] = 7; D.1953 = a[0][0]; a[1][1] = 8; D.1954 = a[1][1]; a[2][2] = 9; x = D.1953 / D.1954; x = a[0][0] / a[1][1]; D.1955 = a[1][1]; y = a[1][1] % a[2][2]; D.1956 = a[2][2]; } y = D.1955 % D.1956; Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  17. 1 July 2011 Graybox Probing-I: Examining GIMPLE Dumps 16/43 GIMPLE: 2-D Array Accesses test.c test.c.004t.gimple int main() a[0][0] = 7; { a[1][1] = 8; int a[3][3], x, y; a[2][2] = 9; a[0][0] = 7; D.1953 = a[0][0]; a[1][1] = 8; D.1954 = a[1][1]; a[2][2] = 9; x = D.1953 / D.1954; x = a[0][0] / a[1][1]; D.1955 = a[1][1]; y = a[1][1] % a[2][2]; D.1956 = a[2][2]; } y = D.1955 % D.1956; • No notion of “addressable memory” in GIMPLE. • Array reference is a single operation in GIMPLE and is linearized in RTL during expansion Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  18. 1 July 2011 Graybox Probing-I: Examining GIMPLE Dumps 17/43 GIMPLE: Use of Pointers test.c test.c.004t.gimple main () { int * D.1953; int main() int * * a; { int * b; int **a,*b,c; int c; b = &c; a = &b; b = &c; **a = 10; /* c = 10 */ a = &b; } D.1953 = *a; ~ *D.1953 = 10; } Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  19. 1 July 2011 Graybox Probing-I: Examining GIMPLE Dumps 17/43 GIMPLE: Use of Pointers test.c test.c.004t.gimple main () { int * D.1953; int main() int * * a; { int * b; int **a,*b,c; int c; b = &c; a = &b; b = &c; **a = 10; /* c = 10 */ a = &b; } D.1953 = *a; ~ *D.1953 = 10; } Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  20. 1 July 2011 Graybox Probing-I: Examining GIMPLE Dumps 18/43 GIMPLE: Use of Structures test.c test.c.004t.gimple typedef struct address { char *name; main () } ad; { void * D.1957; typedef struct student struct ad * D.1958; { int roll; struct st * s; ad *ct; extern void * malloc (unsigned int); } st; s = malloc (8); int main() s->roll = 1; { st *s; D.1957 = malloc (4); s = malloc(sizeof(st)); s->ct = D.1957; s->roll = 1; D.1958 = s->ct; s->ct=malloc(sizeof(ad)); D.1958->name = "Mumbai"; s->ct->name = "Mumbai"; } } Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  21. 1 July 2011 Graybox Probing-I: Examining GIMPLE Dumps 18/43 GIMPLE: Use of Structures test.c test.c.004t.gimple typedef struct address { char *name; main () } ad; { void * D.1957; typedef struct student struct ad * D.1958; { int roll; struct st * s; ad *ct; extern void * malloc (unsigned int); } st; s = malloc (8); int main() s->roll = 1; { st *s; D.1957 = malloc (4); s = malloc(sizeof(st)); s->ct = D.1957; s->roll = 1; D.1958 = s->ct; s->ct=malloc(sizeof(ad)); D.1958->name = "Mumbai"; s->ct->name = "Mumbai"; } } Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  22. 1 July 2011 Graybox Probing-I: Examining GIMPLE Dumps 18/43 GIMPLE: Use of Structures test.c test.c.004t.gimple typedef struct address { char *name; main () } ad; { void * D.1957; typedef struct student struct ad * D.1958; { int roll; struct st * s; ad *ct; extern void * malloc (unsigned int); } st; s = malloc (8); int main() s->roll = 1; { st *s; D.1957 = malloc (4); s = malloc(sizeof(st)); s->ct = D.1957; s->roll = 1; D.1958 = s->ct; s->ct=malloc(sizeof(ad)); D.1958->name = "Mumbai"; s->ct->name = "Mumbai"; } } Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  23. 1 July 2011 Graybox Probing-I: Examining GIMPLE Dumps 18/43 GIMPLE: Use of Structures test.c test.c.004t.gimple typedef struct address { char *name; main () } ad; { void * D.1957; typedef struct student struct ad * D.1958; { int roll; struct st * s; ad *ct; extern void * malloc (unsigned int); } st; s = malloc (8); int main() s->roll = 1; { st *s; D.1957 = malloc (4); s = malloc(sizeof(st)); s->ct = D.1957; s->roll = 1; D.1958 = s->ct; s->ct=malloc(sizeof(ad)); D.1958->name = "Mumbai"; s->ct->name = "Mumbai"; } } Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  24. 1 July 2011 Graybox Probing-I: Examining GIMPLE Dumps 19/43 GIMPLE: Pointer to Array test.c test.c.004t.gimple main () { int main() int * D.2048; { int * D.2049; int *p a, a[3]; int * p a; int a[3]; p a = &a[0]; p a = &a[0]; *p a = 10; *p a = 10; *(p a+1) = 20; D.2048 = p a + 4; *(p a+2) = 30; *D.2048 = 20; } D.2049 = p a + 8; *D.2049 = 30; } Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  25. 1 July 2011 Graybox Probing-I: Examining GIMPLE Dumps 19/43 GIMPLE: Pointer to Array test.c test.c.004t.gimple main () { int main() int * D.2048; { int * D.2049; int *p a, a[3]; int * p a; int a[3]; p a = &a[0]; p a = &a[0]; *p a = 10; *p a = 10; *(p a+1) = 20; D.2048 = p a + 4; *(p a+2) = 30; *D.2048 = 20; } D.2049 = p a + 8; *D.2049 = 30; } Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  26. 1 July 2011 Graybox Probing-I: Examining GIMPLE Dumps 19/43 GIMPLE: Pointer to Array test.c test.c.004t.gimple main () { int main() int * D.2048; { int * D.2049; int *p a, a[3]; int * p a; int a[3]; p a = &a[0]; p a = &a[0]; *p a = 10; *p a = 10; *(p a+1) = 20; D.2048 = p a + 4; *(p a+2) = 30; *D.2048 = 20; } D.2049 = p a + 8; *D.2049 = 30; } Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  27. 1 July 2011 Graybox Probing-I: Examining GIMPLE Dumps 19/43 GIMPLE: Pointer to Array test.c test.c.004t.gimple main () { int main() int * D.2048; { int * D.2049; int *p a, a[3]; int * p a; int a[3]; p a = &a[0]; p a = &a[0]; *p a = 10; *p a = 10; *(p a+1) = 20; D.2048 = p a + 4; *(p a+2) = 30; *D.2048 = 20; } D.2049 = p a + 8; *D.2049 = 30; } Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  28. 1 July 2011 Graybox Probing-I: Examining GIMPLE Dumps 20/43 GIMPLE: Translation of Conditional Statements test.c test.c.004t.gimple int main() { int a=2, b=3, c=4; if (a <= 12) goto <D.1200>; while (a<=7) else goto <D.1201>; { <D.1200>: a = a+1; D.1199 = a + b; } a = D.1199 + c; if (a<=12) <D.1201>: a = a+b+c; } Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  29. 1 July 2011 Graybox Probing-I: Examining GIMPLE Dumps 20/43 GIMPLE: Translation of Conditional Statements test.c test.c.004t.gimple int main() { int a=2, b=3, c=4; if (a <= 12) goto <D.1200>; while (a<=7) else goto <D.1201>; { <D.1200>: a = a+1; D.1199 = a + b; } a = D.1199 + c; if (a<=12) <D.1201>: a = a+b+c; } Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  30. 1 July 2011 Graybox Probing-I: Examining GIMPLE Dumps 20/43 GIMPLE: Translation of Conditional Statements test.c test.c.004t.gimple int main() { int a=2, b=3, c=4; if (a <= 12) goto <D.1200>; while (a<=7) else goto <D.1201>; { <D.1200>: a = a+1; D.1199 = a + b; } a = D.1199 + c; if (a<=12) <D.1201>: a = a+b+c; } Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  31. 1 July 2011 Graybox Probing-I: Examining GIMPLE Dumps 21/43 GIMPLE: Translation of Loops test.c test.c.004t.gimple int main() { int a=2, b=3, c=4; goto <D.1197>; <D.1196>: while (a<=7) a = a + 1; { <D.1197>: a = a+1; if (a <= 7) goto <D.1196>; } else goto <D.1198>; if (a<=12) <D.1198>: a = a+b+c; } Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  32. 1 July 2011 Graybox Probing-I: Examining GIMPLE Dumps 21/43 GIMPLE: Translation of Loops test.c test.c.004t.gimple int main() { int a=2, b=3, c=4; goto <D.1197>; <D.1196>: while (a<=7) a = a + 1; { <D.1197>: a = a+1; if (a <= 7) goto <D.1196>; } else goto <D.1198>; if (a<=12) <D.1198>: a = a+b+c; } Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  33. 1 July 2011 Graybox Probing-I: Examining GIMPLE Dumps 21/43 GIMPLE: Translation of Loops test.c test.c.004t.gimple int main() { int a=2, b=3, c=4; goto <D.1197>; <D.1196>: while (a<=7) a = a + 1; { <D.1197>: a = a+1; if (a <= 7) goto <D.1196>; } else goto <D.1198>; if (a<=12) <D.1198>: a = a+b+c; } Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  34. 1 July 2011 Graybox Probing-I: Examining GIMPLE Dumps 21/43 GIMPLE: Translation of Loops test.c test.c.004t.gimple int main() { int a=2, b=3, c=4; goto <D.1197>; <D.1196>: while (a<=7) a = a + 1; { <D.1197>: a = a+1; if (a <= 7) goto <D.1196>; } else goto <D.1198>; if (a<=12) <D.1198>: a = a+b+c; } Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  35. 1 July 2011 Graybox Probing-I: Examining GIMPLE Dumps 22/43 Control Flow Graph: Textual View test.c.004t.gimple test.c.013t.cfg <bb 5>: if (a <= 12) goto <bb 6>; if (a <= 12) goto <D.1200>; else else goto <D.1201>; goto <bb 7>; <D.1200>: <bb 6>: D.1199 = a + b; D.1199 = a + b; a = D.1199 + c; a = D.1199 + c; <D.1201>: <bb 7>: return; Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  36. 1 July 2011 Graybox Probing-I: Examining GIMPLE Dumps 22/43 Control Flow Graph: Textual View test.c.004t.gimple test.c.013t.cfg <bb 5>: if (a <= 12) goto <bb 6>; if (a <= 12) goto <D.1200>; else else goto <D.1201>; goto <bb 7>; <D.1200>: <bb 6>: D.1199 = a + b; D.1199 = a + b; a = D.1199 + c; a = D.1199 + c; <D.1201>: <bb 7>: return; Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  37. 1 July 2011 Graybox Probing-I: Examining GIMPLE Dumps 22/43 Control Flow Graph: Textual View test.c.004t.gimple test.c.013t.cfg <bb 5>: if (a <= 12) goto <bb 6>; if (a <= 12) goto <D.1200>; else else goto <D.1201>; goto <bb 7>; <D.1200>: <bb 6>: D.1199 = a + b; D.1199 = a + b; a = D.1199 + c; a = D.1199 + c; <D.1201>: <bb 7>: return; Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  38. 1 July 2011 Graybox Probing-I: Examining GIMPLE Dumps 22/43 Control Flow Graph: Textual View test.c.004t.gimple test.c.013t.cfg <bb 5>: if (a <= 12) goto <bb 6>; if (a <= 12) goto <D.1200>; else else goto <D.1201>; goto <bb 7>; <D.1200>: <bb 6>: D.1199 = a + b; D.1199 = a + b; a = D.1199 + c; a = D.1199 + c; <D.1201>: <bb 7>: return; Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  39. 1 July 2011 Graybox Probing-I: Examining GIMPLE Dumps 22/43 Control Flow Graph: Textual View test.c.004t.gimple test.c.013t.cfg <bb 5>: if (a <= 12) goto <bb 6>; if (a <= 12) goto <D.1200>; else else goto <D.1201>; goto <bb 7>; <D.1200>: <bb 6>: D.1199 = a + b; D.1199 = a + b; a = D.1199 + c; a = D.1199 + c; <D.1201>: <bb 7>: return; Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  40. OC A. Koch Compile-Fluß Aufbau GIMPLE IR Zwischendarstellung RTL RTL IR Optimierung 6 / 7

  41. Part 3 Examining RTL Dumps

  42. 1 July 2011 Graybox Probing-I: Examining RTL Dumps 29/43 RTL for i386: Arithmetic Operations (1) Translation of a = a + 1 Dump file: test.c.144r.expand (insn 12 11 13 4 (parallel [ ( set (mem/c/i:SI (plus:SI (reg/f:SI 54 virtual-stack-vars) (const_int -4 [0xfffffffc])) [0 a+0 S4 A32]) (plus:SI (mem/c/i:SI (plus:SI (reg/f:SI 54 virtual-stack-vars) (const_int -4 [0xfffffffc])) [0 a+0 S4 A32]) (const_int 1 [0x1]))) (clobber (reg:CC 17 flags)) ]) t.c:24 -1 (nil)) Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  43. 1 July 2011 Graybox Probing-I: Examining RTL Dumps 29/43 RTL for i386: Arithmetic Operations (1) Translation of a = a + 1 Dump file: test.c.144r.expand (insn 12 11 13 4 (parallel [ set ( set (mem/c/i:SI (plus:SI (reg/f:SI 54 virtual-stack-vars) mem plus (const_int -4 [0xfffffffc])) [0 a+0 S4 A32]) (plus:SI plus mem 1 (mem/c/i:SI (plus:SI reg 54 plus -4 (reg/f:SI 54 virtual-stack-vars) (const_int -4 [0xfffffffc])) [0 a+0 S4 A32]) (const_int 1 [0x1]))) reg 54 -4 (clobber (reg:CC 17 flags)) ]) t.c:24 -1 (nil)) Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  44. 1 July 2011 Graybox Probing-I: Examining RTL Dumps 29/43 RTL for i386: Arithmetic Operations (1) Translation of a = a + 1 Dump file: test.c.144r.expand (insn 12 11 13 4 (parallel [ set ( set (mem/c/i:SI (plus:SI (reg/f:SI 54 virtual-stack-vars) mem plus (const_int -4 [0xfffffffc])) [0 a+0 S4 A32]) (plus:SI plus mem 1 (mem/c/i:SI (plus:SI reg 54 plus -4 (reg/f:SI 54 virtual-stack-vars) (const_int -4 [0xfffffffc])) [0 a+0 S4 A32]) (const_int 1 [0x1]))) reg 54 -4 (clobber (reg:CC 17 flags)) ]) t.c:24 -1 (nil)) Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  45. 1 July 2011 Graybox Probing-I: Examining RTL Dumps 29/43 RTL for i386: Arithmetic Operations (1) Translation of a = a + 1 a is a local variable Dump file: test.c.144r.expand allocated on stack (insn 12 11 13 4 (parallel [ set ( set (mem/c/i:SI (plus:SI (reg/f:SI 54 virtual-stack-vars) mem plus (const_int -4 [0xfffffffc])) [0 a+0 S4 A32]) (plus:SI plus mem 1 (mem/c/i:SI (plus:SI reg 54 plus -4 (reg/f:SI 54 virtual-stack-vars) (const_int -4 [0xfffffffc])) [0 a+0 S4 A32]) (const_int 1 [0x1]))) reg 54 -4 (clobber (reg:CC 17 flags)) ]) t.c:24 -1 (nil)) Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  46. 1 July 2011 Graybox Probing-I: Examining RTL Dumps 29/43 RTL for i386: Arithmetic Operations (1) Translation of a = a + 1 a is a local variable Dump file: test.c.144r.expand allocated on stack (insn 12 11 13 4 (parallel [ set ( set (mem/c/i:SI (plus:SI (reg/f:SI 54 virtual-stack-vars) mem plus (const_int -4 [0xfffffffc])) [0 a+0 S4 A32]) (plus:SI plus mem 1 (mem/c/i:SI (plus:SI reg 54 plus -4 (reg/f:SI 54 virtual-stack-vars) (const_int -4 [0xfffffffc])) [0 a+0 S4 A32]) (const_int 1 [0x1]))) reg 54 -4 (clobber (reg:CC 17 flags)) ]) t.c:24 -1 (nil)) Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  47. 1 July 2011 Graybox Probing-I: Examining RTL Dumps 29/43 RTL for i386: Arithmetic Operations (1) Translation of a = a + 1 side-effect of plus may Dump file: test.c.144r.expand modify condition code register non-deterministically (insn 12 11 13 4 (parallel [ parallel ( set (mem/c/i:SI (plus:SI (reg/f:SI 54 virtual-stack-vars) set clobber (const_int -4 [0xfffffffc])) [0 a+0 S4 A32]) (plus:SI . . . . . . (mem/c/i:SI reg:CC (plus:SI (reg/f:SI 54 virtual-stack-vars) (const_int -4 [0xfffffffc])) [0 a+0 S4 A32]) (const_int 1 [0x1]))) (clobber (reg:CC 17 flags)) ]) t.c:24 -1 (nil)) Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  48. 1 July 2011 Graybox Probing-I: Examining RTL Dumps 29/43 RTL for i386: Arithmetic Operations (1) Translation of a = a + 1 Dump file: test.c.144r.expand Output with slim suffix {[r54:SI-0x4]=[r54:SI-0x4]+0x1; (insn 12 11 13 4 (parallel [ clobber flags:CC; ( set (mem/c/i:SI } (plus:SI (reg/f:SI 54 virtual-stack-vars) (const_int -4 [0xfffffffc])) [0 a+0 S4 A32]) (plus:SI (mem/c/i:SI (plus:SI (reg/f:SI 54 virtual-stack-vars) (const_int -4 [0xfffffffc])) [0 a+0 S4 A32]) (const_int 1 [0x1]))) (clobber (reg:CC 17 flags)) ]) t.c:24 -1 (nil)) Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  49. 1 July 2011 Graybox Probing-I: Examining RTL Dumps 30/43 Additional Information in RTL (insn 12 11 13 4 (parallel [ (set (mem/c/i:SI (plus:SI (reg/f:SI 54 virtual-stack-vars) (const_int -4 [0xfffffffc])) [0 a+0 S4 A32]) (plus:SI (mem/c/i:SI (plus:SI (reg/f:SI 54 virtual-stack-vars) (const_int -4 [0xfffffffc])) [0 a+0 S4 A32]) (const_int 1 [0x1]))) (clobber (reg:CC 17 flags)) ]) t.c:24 -1 (nil)) Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  50. 1 July 2011 Graybox Probing-I: Examining RTL Dumps 30/43 Additional Information in RTL (insn 12 11 13 4 (parallel [ (set (mem/c/i:SI (plus:SI (reg/f:SI 54 virtual-stack-vars) (const_int -4 [0xfffffffc])) [0 a+0 S4 A32]) (plus:SI Current Instruction (mem/c/i:SI (plus:SI (reg/f:SI 54 virtual-stack-vars) (const_int -4 [0xfffffffc])) [0 a+0 S4 A32]) (const_int 1 [0x1]))) (clobber (reg:CC 17 flags)) ]) t.c:24 -1 (nil)) Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  51. 1 July 2011 Graybox Probing-I: Examining RTL Dumps 30/43 Additional Information in RTL (insn 12 11 13 4 (parallel [ (set (mem/c/i:SI (plus:SI (reg/f:SI 54 virtual-stack-vars) (const_int -4 [0xfffffffc])) [0 a+0 S4 A32]) (plus:SI Previous Instruction (mem/c/i:SI (plus:SI (reg/f:SI 54 virtual-stack-vars) (const_int -4 [0xfffffffc])) [0 a+0 S4 A32]) (const_int 1 [0x1]))) (clobber (reg:CC 17 flags)) ]) t.c:24 -1 (nil)) Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  52. 1 July 2011 Graybox Probing-I: Examining RTL Dumps 30/43 Additional Information in RTL (insn 12 11 13 4 (parallel [ (set (mem/c/i:SI (plus:SI (reg/f:SI 54 virtual-stack-vars) (const_int -4 [0xfffffffc])) [0 a+0 S4 A32]) (plus:SI Next Instruction (mem/c/i:SI (plus:SI (reg/f:SI 54 virtual-stack-vars) (const_int -4 [0xfffffffc])) [0 a+0 S4 A32]) (const_int 1 [0x1]))) (clobber (reg:CC 17 flags)) ]) t.c:24 -1 (nil)) Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  53. 1 July 2011 Graybox Probing-I: Examining RTL Dumps 30/43 Additional Information in RTL (insn 12 11 13 4 (parallel [ (set (mem/c/i:SI (plus:SI (reg/f:SI 54 virtual-stack-vars) (const_int -4 [0xfffffffc])) [0 a+0 S4 A32]) (plus:SI Basic Block (mem/c/i:SI (plus:SI (reg/f:SI 54 virtual-stack-vars) (const_int -4 [0xfffffffc])) [0 a+0 S4 A32]) (const_int 1 [0x1]))) (clobber (reg:CC 17 flags)) ]) t.c:24 -1 (nil)) Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  54. 1 July 2011 Graybox Probing-I: Examining RTL Dumps 30/43 Additional Information in RTL (insn 12 11 13 4 (parallel [ (set (mem/c/i:SI (plus:SI (reg/f:SI 54 virtual-stack-vars) (const_int -4 [0xfffffffc])) [0 a+0 S4 A32]) (plus:SI File name: Line number (mem/c/i:SI (plus:SI (reg/f:SI 54 virtual-stack-vars) (const_int -4 [0xfffffffc])) [0 a+0 S4 A32]) (const_int 1 [0x1]))) (clobber (reg:CC 17 flags)) ]) t.c:24 -1 (nil)) Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  55. 1 July 2011 Graybox Probing-I: Examining RTL Dumps 30/43 Additional Information in RTL (insn 12 11 13 4 (parallel [ (set (mem/c/i:SI (plus:SI (reg/f:SI 54 virtual-stack-vars) (const_int -4 [0xfffffffc])) [0 a+0 S4 A32]) (plus:SI memory reference (mem/c/i:SI that does not trap (plus:SI (reg/f:SI 54 virtual-stack-vars) (const_int -4 [0xfffffffc])) [0 a+0 S4 A32]) (const_int 1 [0x1]))) (clobber (reg:CC 17 flags)) ]) t.c:24 -1 (nil)) Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  56. 1 July 2011 Graybox Probing-I: Examining RTL Dumps 30/43 Additional Information in RTL (insn 12 11 13 4 (parallel [ (set (mem/c/i:SI (plus:SI (reg/f:SI 54 virtual-stack-vars) (const_int -4 [0xfffffffc])) [0 a+0 S4 A32]) (plus:SI scalar that is not a (mem/c/i:SI part of an aggregate (plus:SI (reg/f:SI 54 virtual-stack-vars) (const_int -4 [0xfffffffc])) [0 a+0 S4 A32]) (const_int 1 [0x1]))) (clobber (reg:CC 17 flags)) ]) t.c:24 -1 (nil)) Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  57. 1 July 2011 Graybox Probing-I: Examining RTL Dumps 30/43 Additional Information in RTL (insn 12 11 13 4 (parallel [ (set (mem/c/i:SI (plus:SI (reg/f:SI 54 virtual-stack-vars) (const_int -4 [0xfffffffc])) [0 a+0 S4 A32]) (plus:SI register that (mem/c/i:SI holds a pointer (plus:SI (reg/f:SI 54 virtual-stack-vars) (const_int -4 [0xfffffffc])) [0 a+0 S4 A32]) (const_int 1 [0x1]))) (clobber (reg:CC 17 flags)) ]) t.c:24 -1 (nil)) Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  58. 1 July 2011 Graybox Probing-I: Examining RTL Dumps 30/43 Additional Information in RTL (insn 12 11 13 4 (parallel [ (set (mem/c/i:SI (plus:SI (reg/f:SI 54 virtual-stack-vars) (const_int -4 [0xfffffffc])) [0 a+0 S4 A32]) (plus:SI single integer (mem/c/i:SI (plus:SI (reg/f:SI 54 virtual-stack-vars) (const_int -4 [0xfffffffc])) [0 a+0 S4 A32]) (const_int 1 [0x1]))) (clobber (reg:CC 17 flags)) ]) t.c:24 -1 (nil)) Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  59. 1 July 2011 Graybox Probing-I: Examining RTL Dumps 31/43 RTL for i386: Arithmetic Operations (2) Translation of a = a + 1 when a is a global variable Dump file: test.c.144r.expand (insn 11 10 12 4 (set (reg:SI 64 [ a.0 ]) (mem/c/i:SI (symbol_ref:SI ("a") <var_decl 0xb7d8d000 a>) [0 a+0 S4 A32])) t.c:26 -1 (nil)) (insn 12 11 13 4 (parallel [ (set (reg:SI 63 [ a.1 ]) (plus:SI (reg:SI 64 [ a.0 ]) (const_int 1 [0x1]))) (clobber (reg:CC 17 flags)) ]) t.c:26 -1 (nil)) (insn 13 12 14 4 (set (mem/c/i:SI (symbol_ref:SI ("a") <var_decl 0xb7d8d000 a>) [0 a+0 S4 A32]) (reg:SI 63 [ a.1 ])) t.c:26 -1 (nil)) Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  60. 1 July 2011 Graybox Probing-I: Examining RTL Dumps 31/43 RTL for i386: Arithmetic Operations (2) Translation of a = a + 1 when a is a global variable Dump file: test.c.144r.expand (insn 11 10 12 4 (set (reg:SI 64 [ a.0 ]) Load a into reg64 (mem/c/i:SI (symbol_ref:SI ("a") <var_decl 0xb7d8d000 a>) [0 a+0 S4 A32])) t.c:26 -1 (nil)) (insn 12 11 13 4 (parallel [ (set (reg:SI 63 [ a.1 ]) (plus:SI (reg:SI 64 [ a.0 ]) (const_int 1 [0x1]))) (clobber (reg:CC 17 flags)) ]) t.c:26 -1 (nil)) (insn 13 12 14 4 (set (mem/c/i:SI (symbol_ref:SI ("a") <var_decl 0xb7d8d000 a>) [0 a+0 S4 A32]) (reg:SI 63 [ a.1 ])) t.c:26 -1 (nil)) Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  61. 1 July 2011 Graybox Probing-I: Examining RTL Dumps 31/43 RTL for i386: Arithmetic Operations (2) Translation of a = a + 1 when a is a global variable Dump file: test.c.144r.expand (insn 11 10 12 4 (set (reg:SI 64 [ a.0 ]) Load a into reg64 (mem/c/i:SI (symbol_ref:SI ("a") reg63 = reg64 + 1 <var_decl 0xb7d8d000 a>) [0 a+0 S4 A32])) t.c:26 -1 (nil)) (insn 12 11 13 4 (parallel [ (set (reg:SI 63 [ a.1 ]) (plus:SI (reg:SI 64 [ a.0 ]) (const_int 1 [0x1]))) (clobber (reg:CC 17 flags)) ]) t.c:26 -1 (nil)) (insn 13 12 14 4 (set (mem/c/i:SI (symbol_ref:SI ("a") <var_decl 0xb7d8d000 a>) [0 a+0 S4 A32]) (reg:SI 63 [ a.1 ])) t.c:26 -1 (nil)) Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  62. 1 July 2011 Graybox Probing-I: Examining RTL Dumps 31/43 RTL for i386: Arithmetic Operations (2) Translation of a = a + 1 when a is a global variable Dump file: test.c.144r.expand (insn 11 10 12 4 (set (reg:SI 64 [ a.0 ]) Load a into reg64 (mem/c/i:SI (symbol_ref:SI ("a") reg63 = reg64 + 1 <var_decl 0xb7d8d000 a>) [0 a+0 S4 A32])) t.c:26 -1 (nil)) store reg63 into a (insn 12 11 13 4 (parallel [ (set (reg:SI 63 [ a.1 ]) (plus:SI (reg:SI 64 [ a.0 ]) (const_int 1 [0x1]))) (clobber (reg:CC 17 flags)) ]) t.c:26 -1 (nil)) (insn 13 12 14 4 (set (mem/c/i:SI (symbol_ref:SI ("a") <var_decl 0xb7d8d000 a>) [0 a+0 S4 A32]) (reg:SI 63 [ a.1 ])) t.c:26 -1 (nil)) Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  63. 1 July 2011 Graybox Probing-I: Examining RTL Dumps 31/43 RTL for i386: Arithmetic Operations (2) Translation of a = a + 1 when a is a global variable Dump file: test.c.144r.expand (insn 11 10 12 4 (set (reg:SI 64 [ a.0 ]) Load a into reg64 (mem/c/i:SI (symbol_ref:SI ("a") reg63 = reg64 + 1 <var_decl 0xb7d8d000 a>) [0 a+0 S4 A32])) t.c:26 -1 (nil)) store reg63 into a (insn 12 11 13 4 (parallel [ Output with slim suffix (set (reg:SI 63 [ a.1 ]) (plus:SI (reg:SI 64 [ a.0 ]) r64:SI=[‘a’] (const_int 1 [0x1]))) {r63:SI=r64:SI+0x1; (clobber (reg:CC 17 flags)) clobber flags:CC; ]) t.c:26 -1 (nil)) } [‘a’]=r63:SI (insn 13 12 14 4 (set (mem/c/i:SI (symbol_ref:SI ("a") <var_decl 0xb7d8d000 a>) [0 a+0 S4 A32]) (reg:SI 63 [ a.1 ])) t.c:26 -1 (nil)) Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  64. 1 July 2011 Graybox Probing-I: Examining RTL Dumps 32/43 RTL for i386: Arithmetic Operations (3) Translation of a = a + 1 when a is a formal parameter Dump file: test.c.144r.expand (insn 10 9 11 4 (parallel [ (set (mem/c/i:SI (reg/f:SI 53 virtual-incoming-args) [0 a+0 S4 A32]) (plus:SI (mem/c/i:SI (reg/f:SI 53 virtual-incoming-args) [0 a+0 S4 A32]) (const_int 1 [0x1]))) (clobber (reg:CC 17 flags)) ]) t1.c:25 -1 (nil)) Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  65. 1 July 2011 Graybox Probing-I: Examining RTL Dumps 32/43 RTL for i386: Arithmetic Operations (3) Translation of a = a + 1 when a is a formal parameter Dump file: test.c.144r.expand Access through argument pointer register instead of (insn 10 9 11 4 (parallel [ frame pointer register (set (mem/c/i:SI (reg/f:SI 53 virtual-incoming-args) [0 a+0 S4 A32]) (plus:SI (mem/c/i:SI (reg/f:SI 53 virtual-incoming-args) [0 a+0 S4 A32]) (const_int 1 [0x1]))) (clobber (reg:CC 17 flags)) ]) t1.c:25 -1 (nil)) Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  66. 1 July 2011 Graybox Probing-I: Examining RTL Dumps 32/43 RTL for i386: Arithmetic Operations (3) Translation of a = a + 1 when a is a formal parameter Dump file: test.c.144r.expand Access through argument pointer register instead of (insn 10 9 11 4 (parallel [ frame pointer register (set No offset required? (mem/c/i:SI (reg/f:SI 53 virtual-incoming-args) [0 a+0 S4 A32]) (plus:SI (mem/c/i:SI (reg/f:SI 53 virtual-incoming-args) [0 a+0 S4 A32]) (const_int 1 [0x1]))) (clobber (reg:CC 17 flags)) ]) t1.c:25 -1 (nil)) Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  67. 1 July 2011 Graybox Probing-I: Examining RTL Dumps 32/43 RTL for i386: Arithmetic Operations (3) Translation of a = a + 1 when a is a formal parameter Dump file: test.c.144r.expand Access through argument pointer register instead of (insn 10 9 11 4 (parallel [ frame pointer register (set No offset required? (mem/c/i:SI (reg/f:SI 53 virtual-incoming-args) [0 a+0 S4 A32]) Output with slim suffix (plus:SI (mem/c/i:SI {[r53:SI]=[r53:SI]+0x1; (reg/f:SI 53 virtual-incoming-args) [0 a+0 S4 A32]) clobber flags:CC; (const_int 1 [0x1]))) } (clobber (reg:CC 17 flags)) ]) t1.c:25 -1 (nil)) Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  68. 1 July 2011 Graybox Probing-I: Examining RTL Dumps 33/43 RTL for i386: Arithmetic Operation (4) Translation of a = a + 1 when a is the second formal parameter Dump file: test.c.144r.expand (insn 10 9 11 4 (parallel [ (set (mem/c/i:SI (plus:SI (reg/f:SI 53 virtual-incoming-args) (const_int 4 [0x4])) [0 a+0 S4 A32]) (plus:SI (mem/c/i:SI (plus:SI (reg/f:SI 53 virtual-incoming-args) (const_int 4 [0x4])) [0 a+0 S4 A32]) (const_int 1 [0x1]))) (clobber (reg:CC 17 flags)) ]) t1.c:25 -1 (nil)) Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  69. 1 July 2011 Graybox Probing-I: Examining RTL Dumps 33/43 RTL for i386: Arithmetic Operation (4) Translation of a = a + 1 when a is the second formal parameter Dump file: test.c.144r.expand (insn 10 9 11 4 (parallel [ (set Offset 4 added to the argument (mem/c/i:SI pointer register (plus:SI (reg/f:SI 53 virtual-incoming-args) (const_int 4 [0x4])) [0 a+0 S4 A32]) (plus:SI (mem/c/i:SI (plus:SI (reg/f:SI 53 virtual-incoming-args) (const_int 4 [0x4])) [0 a+0 S4 A32]) (const_int 1 [0x1]))) (clobber (reg:CC 17 flags)) ]) t1.c:25 -1 (nil)) Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  70. 1 July 2011 Graybox Probing-I: Examining RTL Dumps 33/43 RTL for i386: Arithmetic Operation (4) Translation of a = a + 1 when a is the second formal parameter Dump file: test.c.144r.expand (insn 10 9 11 4 (parallel [ (set Offset 4 added to the argument (mem/c/i:SI pointer register (plus:SI (reg/f:SI 53 virtual-incoming-args) When a is the first parameter, its (const_int 4 [0x4])) [0 a+0 S4 A32]) offset is 0! (plus:SI (mem/c/i:SI (plus:SI (reg/f:SI 53 virtual-incoming-args) (const_int 4 [0x4])) [0 a+0 S4 A32]) (const_int 1 [0x1]))) (clobber (reg:CC 17 flags)) ]) t1.c:25 -1 (nil)) Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  71. 1 July 2011 Graybox Probing-I: Examining RTL Dumps 33/43 RTL for i386: Arithmetic Operation (4) Translation of a = a + 1 when a is the second formal parameter Dump file: test.c.144r.expand (insn 10 9 11 4 (parallel [ (set Offset 4 added to the argument (mem/c/i:SI pointer register (plus:SI (reg/f:SI 53 virtual-incoming-args) When a is the first parameter, its (const_int 4 [0x4])) [0 a+0 S4 A32]) offset is 0! (plus:SI Output with slim suffix (mem/c/i:SI (plus:SI {[r53:SI+0x4]=[r53:SI+0x4]+0x1; (reg/f:SI 53 virtual-incoming-args) clobber flags:CC; (const_int 4 [0x4])) [0 a+0 S4 A32]) } (const_int 1 [0x1]))) (clobber (reg:CC 17 flags)) ]) t1.c:25 -1 (nil)) Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  72. 1 July 2011 Graybox Probing-I: Examining RTL Dumps 34/43 RTL for spim: Arithmetic Operations Translation of a = a + 1 when a is a local variable Dump file: test.c.144r.expand r39=stack($fp - 4) r40=r39+1 stack($fp - 4)=r40 (insn 7 6 8 4 (set (reg:SI 39) (mem/c/i:SI (plus:SI (reg/f:SI 33 virtual-stack-vars) (const_int -4 [...])) [...])) -1 (nil)) (insn 8 7 9 4 test.c:6 (set (reg:SI 40) (plus:SI (reg:SI 39) (const_int 1 [...]))) -1 (nil)) (insn 9 8 10 4 test.c:6 (set (mem/c/i:SI (plus:SI (reg/f:SI 33 virtual-stack-vars) (const_int -4 [...])) [...]) (reg:SI 40)) test.c:6 -1 (nil)) In spim, a variable is loaded into register to perform any instruction, hence three instructions are generated Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  73. 1 July 2011 Graybox Probing-I: Examining RTL Dumps 34/43 RTL for spim: Arithmetic Operations Translation of a = a + 1 when a is a local variable Dump file: test.c.144r.expand r39=stack($fp - 4) r40=r39+1 stack($fp - 4)=r40 (insn 7 6 8 4 (set (reg:SI 39) (mem/c/i:SI (plus:SI (reg/f:SI 33 virtual-stack-vars) (const_int -4 [...])) [...])) -1 (nil)) (insn 8 7 9 4 test.c:6 (set (reg:SI 40) (plus:SI (reg:SI 39) (const_int 1 [...]))) -1 (nil)) (insn 9 8 10 4 test.c:6 (set (mem/c/i:SI (plus:SI (reg/f:SI 33 virtual-stack-vars) (const_int -4 [...])) [...]) (reg:SI 40)) test.c:6 -1 (nil)) In spim, a variable is loaded into register to perform any instruction, hence three instructions are generated Essential Abstractions in GCC GCC Resource Center, IIT Bombay

  74. 1 July 2011 Graybox Probing-I: Examining RTL Dumps 34/43 RTL for spim: Arithmetic Operations Translation of a = a + 1 when a is a local variable Dump file: test.c.144r.expand r39=stack($fp - 4) r40=r39+1 stack($fp - 4)=r40 (insn 7 6 8 4 (set (reg:SI 39) (mem/c/i:SI (plus:SI (reg/f:SI 33 virtual-stack-vars) (const_int -4 [...])) [...])) -1 (nil)) (insn 8 7 9 4 test.c:6 (set (reg:SI 40) (plus:SI (reg:SI 39) (const_int 1 [...]))) -1 (nil)) (insn 9 8 10 4 test.c:6 (set (mem/c/i:SI (plus:SI (reg/f:SI 33 virtual-stack-vars) (const_int -4 [...])) [...]) (reg:SI 40)) test.c:6 -1 (nil)) In spim, a variable is loaded into register to perform any instruction, hence three instructions are generated Essential Abstractions in GCC GCC Resource Center, IIT Bombay

Recommend


More recommend