Java Reference
In-Depth Information
=
INVISIBLE
+
+
fetch
b
*
4+
1
fetch
i
$fp a
Figure 13.26: Low-Level IR Representation of b[i]=a+1
fetch
fetch
+
reg2 intlit
reg
reg1
reg1
+
reg2 offset
adr
lw $reg,adr
addi $reg1,$reg2,intlit
lw $reg1,offset($reg2)
=
reg1
reg1
void
+
reg1 offset
reg2
*
*
reg2
reg2
intlit
4
sll $reg1,$reg2,2
mul $reg1,$reg2,intlit
sw $reg2,offset($reg1)
Figure 13.27: IR Tree Patterns for Various MIPS Instructions
the AST representation of a program (as discussed in Section 7.4 on page 250)
except that memory tra
c and address computations are explicit:
Leaves corresponding to identifiers are their addresses (if globals) or
o
ff
sets (if locals).
Explicit memory fetches (using the fetch operator) are shown, as is the
multiply by 4 needed to build a valid word address for an element of an
array of integers.
ect of each instruction
of a computer. A tree defines the computation performed by the instruction
as well as the kind of value it produces. This is illustrated in Figure 13.27
in which tree-structured patterns (or productions) are used to define valid IR
trees.
Now instruction selection for a given IR tree becomes a matter of matching
instruction patterns against the generated IR such that the IR tree is covered
A tree-structured IRmay also be used todefine the e
ff
 
Search WWH ::




Custom Search