Help in GIMPLE to RTL transformation

Amruta G. Gokhale
Sat Mar 18 06:52:00 GMT 2006


I am looking at some part of GCC source code which does the translation 
from GIMPLE to RTL.
I created an example, having two consecutive instructions, one with "div" 
and other with "mod".

int a, b, c, d;
a = b / c;
d = b % c;

The first-cut RTL code corresponding to these two instructions is a 
PARALLEL INSN, with two SET INSNs, one with "div" and other with "mod".
(insn 22 21 23 1 (parallel [
             (set (reg:SI 70)
                 (div:SI (reg:SI 72)
                     (mem/i:SI (plus:SI (reg/f:SI 54 virtual-stack-vars)
                             (const_int -8 [0xfffffff8])) [0 c+0 S4 A32])))
             (set (reg:SI 71)
                 (mod:SI (reg:SI 72)
                     (mem/i:SI (plus:SI (reg/f:SI 54 virtual-stack-vars)
                             (const_int -8 [0xfffffff8])) [0 c+0 S4 A32])))

I am unable to understand how a single INSN gets generated for these two 
instructions. The GIMPLE code has two different tree nodes for the two 
instructions, namely "trunc_div_expr" and "trunc_mod_expr". So there 
should be two different INSNs. My guess is, some pass, like "combine", 
must be combining two INSNs into one.
I looked at functions in file "combine.c", but no function in that file is 

Can anybody suggest something? I am really stuck at this point And can't 
proceed any further.


Amruta Gokhale
Graduate Student
IIT Bombay,

More information about the Gcc-help mailing list