Java Reference
In-Depth Information
13:istore_1
14:goto 255 244
B4
17:iload_1
18:ireturn
This use of tuples is not strictly necessary but it makes the translation to HIR
easier.
2. The message expression
cfg.detectLoops(cfg.basicBlocks.get(0),null);
detects loop headers and loop tails. This information may be used for lifting invariant
code from loops during the optimization phase and for ordering blocks for register
allocation.
3. The message expression
cfg.removeUnreachableBlocks();
removes unreachable blocks, for example, blocks resulting from jumps that come after
a return instruction.
4. The message expression,
cfg.computeDominators(cfg.basicBlocks.get(0),null);
computes an immediate dominator for each basic block, that closest predecessor
through which all paths must pass to reach the target block. It is a useful place
to insert invariant code that is lifted out of a loop in optimization.
5. The message expression
cfg.tuplesToHir();
converts the tuples representation to HIR, stored as a sequence of HIR instructions
in the array list, hir for each block. As the tuples are scanned, their execution is
simulated, using a stack to keep track of newly created values and instruction ids.
The HIR is in SSA form, with (sometimes redundant) Phi function instructions.
6. The message expression
cfg.eliminateRedundantPhiFunctions();
eliminates unnecessary Phi functions and replaces them with their simpler values as
discussed above.
The HIR is now ready for further analysis.
6.3.3 Simple Optimizations on the HIR
That the HIR is in SSA form makes it amenable to several simple optimizations|
improvements to the HIR code; these improvements make for fewer instructions and/or
faster programs.
Local optimizations are improvements made based on analysis of the linear sequence
 
Search WWH ::




Custom Search