Skip to content

Instantly share code, notes, and snippets.

@hktechn0
Last active August 29, 2015 14:23
Show Gist options
  • Save hktechn0/8db2514df00671802b1c to your computer and use it in GitHub Desktop.
Save hktechn0/8db2514df00671802b1c to your computer and use it in GitHub Desktop.
GIMPLE, RTL
function (int * array, int n)
{
long unsigned int D.1839;
long unsigned int D.1840;
int * D.1841;
int D.1842;
int i;
i = 0;
goto <D.1836>;
<D.1835>:
D.1839 = (long unsigned int) i;
D.1840 = D.1839 * 4;
D.1841 = array + D.1840;
D.1842 = i * n;
*D.1841 = D.1842;
i = i + 1;
<D.1836>:
if (i < n) goto <D.1835>; else goto <D.1837>;
<D.1837>:
}
;; Function function (function, funcdef_no=0, decl_uid=1832, cgraph_uid=0, symbol_order=0)
Removing basic block 6
Removing basic block 7
Removing basic block 8
function (int * array, int n)
{
unsigned int ivtmp.5;
unsigned long ivtmp.3;
int i;
int _9;
unsigned int _17;
<bb 2>:
if (n_4(D) > 0)
goto <bb 3>;
else
goto <bb 5>;
<bb 3>:
_17 = (unsigned int) n_4(D);
<bb 4>:
# ivtmp.3_1 = PHI <0(3), ivtmp.3_2(4)>
# ivtmp.5_13 = PHI <0(3), ivtmp.5_12(4)>
_9 = (int) ivtmp.5_13;
MEM[base: array_7(D), index: ivtmp.3_1, step: 4, offset: 0B] = _9;
ivtmp.3_2 = ivtmp.3_1 + 1;
ivtmp.5_12 = ivtmp.5_13 + _17;
i_18 = (int) ivtmp.3_2;
if (n_4(D) > i_18)
goto <bb 4>;
else
goto <bb 5>;
<bb 5>:
return;
}
;; Function function (function, funcdef_no=0, decl_uid=1832, cgraph_uid=0, symbol_order=0)
;; Generating RTL for gimple basic block 2
;; Generating RTL for gimple basic block 3
;; Generating RTL for gimple basic block 4
;; Generating RTL for gimple basic block 5
try_optimize_cfg iteration 1
Merging block 3 into block 2...
Merged blocks 2 and 3.
Merged 2 and 3 without moving.
Edge 2->6 redirected to 7
Forwarding edge 5->6 to 7 failed.
Deleted label in block 6.
try_optimize_cfg iteration 2
Forwarding edge 5->6 to 7 failed.
;;
;; Full RTL generated for this function:
;;
(note 13 0 19 NOTE_INSN_DELETED)
(note 19 13 14 2 [bb 2] NOTE_INSN_BASIC_BLOCK)
(insn 14 19 15 2 (set (reg/v/f:DI 104 [ array ])
(reg:DI 5 di [ array ])) test.c:1 -1
(nil))
(insn 15 14 16 2 (set (reg/v:SI 105 [ n ])
(reg:SI 4 si [ n ])) test.c:1 -1
(nil))
(note 16 15 21 2 NOTE_INSN_FUNCTION_BEG)
(insn 21 16 22 2 (set (reg:CCNO 17 flags)
(compare:CCNO (reg/v:SI 105 [ n ])
(const_int 0 [0]))) test.c:3 -1
(nil))
(jump_insn 22 21 23 2 (set (pc)
(if_then_else (le (reg:CCNO 17 flags)
(const_int 0 [0]))
(label_ref:DI 34)
(pc))) test.c:3 613 {*jcc_1}
(int_list:REG_BR_PROB 900 (nil))
-> 34)
(note 23 22 24 4 [bb 4] NOTE_INSN_BASIC_BLOCK)
(insn 24 23 17 4 (set (reg:SI 102 [ D.1854 ])
(reg/v:SI 105 [ n ])) -1
(nil))
(insn 17 24 18 4 (set (reg:SI 101 [ ivtmp.5 ])
(const_int 0 [0])) test.c:3 -1
(nil))
(insn 18 17 29 4 (set (reg:DI 99 [ ivtmp.3 ])
(const_int 0 [0])) test.c:3 -1
(nil))
(code_label 29 18 25 5 3 "" [1 uses])
(note 25 29 26 5 [bb 5] NOTE_INSN_BASIC_BLOCK)
(insn 26 25 27 5 (set (mem:SI (plus:DI (mult:DI (reg:DI 99 [ ivtmp.3 ])
(const_int 4 [0x4]))
(reg/v/f:DI 104 [ array ])) [0 MEM[base: array_7(D), index: ivtmp.3_1, step: 4, offset: 0B]+0 S4 A32])
(reg:SI 101 [ ivtmp.5 ])) test.c:4 -1
(nil))
(insn 27 26 28 5 (parallel [
(set (reg:DI 99 [ ivtmp.3 ])
(plus:DI (reg:DI 99 [ ivtmp.3 ])
(const_int 1 [0x1])))
(clobber (reg:CC 17 flags))
]) -1
(nil))
(insn 28 27 30 5 (parallel [
(set (reg:SI 101 [ ivtmp.5 ])
(plus:SI (reg:SI 101 [ ivtmp.5 ])
(reg:SI 102 [ D.1854 ])))
(clobber (reg:CC 17 flags))
]) -1
(nil))
(insn 30 28 31 5 (set (reg:CCGC 17 flags)
(compare:CCGC (reg/v:SI 105 [ n ])
(subreg:SI (reg:DI 99 [ ivtmp.3 ]) 0))) test.c:3 -1
(nil))
(jump_insn 31 30 33 5 (set (pc)
(if_then_else (gt (reg:CCGC 17 flags)
(const_int 0 [0]))
(label_ref 29)
(pc))) test.c:3 -1
(int_list:REG_BR_PROB 9100 (nil))
-> 29)
(note 33 31 34 6 [bb 6] NOTE_INSN_BASIC_BLOCK)
(code_label 34 33 35 7 1 "" [1 uses])
(note 35 34 0 7 [bb 7] NOTE_INSN_BASIC_BLOCK)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment