org.jikesrvm.compilers.opt.ssa
Class SSA

java.lang.Object
  extended by org.jikesrvm.compilers.opt.ssa.SSA

 class SSA
extends Object

This module holds utility functions for SSA form.

Our SSA form is Heap Array SSA Form , an extension of SSA that allows analysis of scalars, arrays, and object fields in a unified framework. See our SAS 2000 paper Unified Analysis of Arrays and Object References in Strongly Typed Languages

Details about our current implementation include:

See Also:
EnterSSA, LeaveSSA, SSADictionary, HIRInfo

Constructor Summary
SSA()
           
 
Method Summary
(package private) static void addAtEnd(IR ir, BasicBlock bb, Instruction c, boolean exp)
          Add a move instruction at the end of a basic block, renaming with a temporary register if needed to protect conditional branches at the end of the block.
(package private) static Instruction makeMoveInstruction(IR ir, Register r1, ConstantOperand c)
          Create a move instruction r1 := c.
(package private) static Instruction makeMoveInstruction(IR ir, Register r1, Register r2, TypeReference t)
          Create a move instruction r1 := r2.
static void printInstructions(IR ir)
          Print the instructions in SSA form.
(package private) static void purgeBlockFromPHIs(BasicBlock source, BasicBlock target)
          Fix up any PHI instructions in the given target block to reflect that the given source block is no longer a predecessor of target.
(package private) static void replaceBlockInPhis(BasicBlock target, BasicBlock B1, BasicBlock B2)
          Update PHI instructions in the target block so that any PHIs that come from basic block B1, now come from basic block B2.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SSA

SSA()
Method Detail

addAtEnd

static void addAtEnd(IR ir,
                     BasicBlock bb,
                     Instruction c,
                     boolean exp)
Add a move instruction at the end of a basic block, renaming with a temporary register if needed to protect conditional branches at the end of the block.

Parameters:
ir - governing IR
bb - the basic block
c - the move instruction to insert
exp - whether or not to respect exception control flow at the end of the block

printInstructions

public static void printInstructions(IR ir)
Print the instructions in SSA form.

Parameters:
ir - the IR, assumed to be in SSA form

makeMoveInstruction

static Instruction makeMoveInstruction(IR ir,
                                       Register r1,
                                       Register r2,
                                       TypeReference t)
Create a move instruction r1 := r2.

TODO: This utility function should be moved elsewhere.

Parameters:
ir - the governing ir
r1 - the destination
r2 - the source
t - the type of r1 and r2.

makeMoveInstruction

static Instruction makeMoveInstruction(IR ir,
                                       Register r1,
                                       ConstantOperand c)
Create a move instruction r1 := c.

!!TODO: put this functionality elsewhere.

Parameters:
ir - the governing ir
r1 - the destination
c - the source

purgeBlockFromPHIs

static void purgeBlockFromPHIs(BasicBlock source,
                               BasicBlock target)
Fix up any PHI instructions in the given target block to reflect that the given source block is no longer a predecessor of target. The basic algorithm is to erase the PHI operands related to the edge from source to target by sliding the other PHI operands down as required.

Parameters:
source - the source block to remove from PHIs in target
target - the target block that may contain PHIs to update.

replaceBlockInPhis

static void replaceBlockInPhis(BasicBlock target,
                               BasicBlock B1,
                               BasicBlock B2)
Update PHI instructions in the target block so that any PHIs that come from basic block B1, now come from basic block B2.

Parameters:
target - the target block that may contain PHIs to update.
B1 - the block to replace in the phi instructions
B2 - the replacement block for B1