org.jikesrvm.compilers.opt.ssa
Class SSADictionary

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

public final class SSADictionary
extends Object

An SSADictionary structure holds lookaside information regarding Heap Array SSA form for an IR. The general idea is that all Heap Array SSA form information resides in this lookaside structure. Note that this is not the case for scalar SSA information.

See our SAS 2000 paper Unified Analysis of Arrays and Object References in Strongly Typed Languages for an overview of Array SSA form. More implementation details are documented in SSA.java .

See Also:
SSA

Nested Class Summary
(package private) static class SSADictionary.AllInstructionEnumeration
          This class implements an Enumeration over all instructions for a basic block.
private static class SSADictionary.HeapKey<T>
          This class represents the name of a heap variable in the heap array SSA form.
 
Field Summary
private static boolean DEBUG
          Flag to turn on debugging
private  HashMap<HeapVariable<Object>,HeapOperand<Object>> DefChain
          A mapping from HeapVariable to HeapOperand .
private  HashMap<Instruction,HeapOperand<Object>[]> defs
          A mapping from Instruction to the set of heap operands (an HeapOperand[]) that this instruction defines.
private static ArrayList<Instruction> emptyArrayList
          An empty vector, used for utility.
(package private) static String exceptionState
          The object for the heap variable that is used for modelling explicit exception dependencies
private  HashSet<Instruction> exits
          The set of instructions which have been registered to potentially exit the procedure
private  HashMap<BasicBlock,ArrayList<Instruction>> heapPhi
          A mapping from BasicBlock to ArrayList of Instruction .
private  Set<Object> heapTypes
          The set of type to build heap array variables for
private  HashMap<SSADictionary.HeapKey<Object>,HeapVariable<Object>> heapVariables
          A mapping from HeapKey to the set of heap variables introduced for this IR
private  boolean insertPEIDeps
          Should PEIs and stores to the heap be modelled via an explicit exception state heap variable?
private  IR ir
          A pointer to the governing IR
private  HashMap<Object,Integer> nextNumber
          A mapping from heap variable type to Integer This structure holds the next number to assign when creating a new heap variable name for a given type
private  HashMap<Object,HashSet<HeapOperand<Object>>> originalDefs
          A mapping from a heap variable type to a HashSet of Instruction .
private  HashMap<Object,HashSet<HeapOperand<Object>>> originalUses
          A mapping from a heap variable type to a HashSet of Instruction .
private  boolean uphi
          Should the heap array SSA form constructed include uphi functions?
private  HashMap<HeapVariable<Object>,HashSet<HeapOperand<Object>>> UseChain
          A mapping from HeapVariable to HashSet of HeapOperand .
private  HashMap<Instruction,HeapOperand<Object>[]> uses
          A mapping from Instruction to the set of heap operands (an HeapOperand[]) that this instruction uses.
 
Constructor Summary
SSADictionary(Set<Object> heapTypes, boolean uphi, boolean insertPEIDeps, IR ir)
          Initialize a structure to hold Heap Array SSA information.
 
Method Summary
(package private)  void addExceptionStateToDefs(Instruction s, BasicBlock b)
          Register that an instruction defines the exception state.
(package private)  void addExceptionStateToUses(Instruction s)
          Register that an instruction defines the exception state.
(package private)  void addToUseChain(HeapOperand<Object> op)
          Add an HeapOperand to the use chain of its heap variable
private  void aloadHelper(Instruction s, BasicBlock b)
          Record the effects of a aload instruction on the heap array SSA form.
private  void arraylengthHelper(Instruction s, BasicBlock b)
          Record the effects of an arraylength instruction on the heap array SSA form.
private  void astoreHelper(Instruction s, BasicBlock b)
          Record the effects of an astore instruction on the heap array SSA form.
private  void bbendHelper(Instruction s, BasicBlock b)
          Record the effects of a bbend instruction on the heap array SSA form.
(package private)  void createHeapPhiInstruction(BasicBlock bb, HeapVariable<Object> H)
          Create a heap control phi instruction, and store it at the beginning of a basic block.
(package private)  boolean defsHeapVariable(Instruction s)
          Does a particular instruction define any heap variable?
(package private)  void deleteFromUseChain(HeapOperand<Object> op)
          Delete an HeapOperand from the use chain of its heap variable
(package private)  Iterator<HeapVariable<Object>> enumerateExposedHeapVariables()
          Return an enumeration of all heap variables that may be exposed on procedure exit.
private static HeapOperand<Object>[] extendHArray(HeapOperand<Object>[] H)
          Returns a copy of H with an additional free slot at position 0
private  HeapVariable<Object> findOrCreateHeapVariable(Object type)
          Return the heap variable for a given type or field with number 0.
private  HashSet<HeapOperand<Object>> findOrCreateOriginalDefs(Object type)
          Return a set of all the original definitions of a heap variable.
private  HashSet<HeapOperand<Object>> findOrCreateOriginalUses(Object type)
          Return a set of all the original uses of a heap variable.
(package private)  SSADictionary.AllInstructionEnumeration getAllInstructions(BasicBlock bb)
          Return an enumeration of all instructions for a basic block, including the control-PHI functions for heap variables stored implicitly here.
private  void getFieldHelper(Instruction s, BasicBlock b)
          Record the effects of a getfield instruction on the heap array SSA form.
 HeapOperand<Object>[] getHeapDefs(Instruction s)
          Return the heap operands defined by an instruction.
 Iterator<Instruction> getHeapPhiInstructions(BasicBlock bb)
          Return an enumeration of the control-phi functions for Heap variables at the beginning of a basic block.
 HeapOperand<Object>[] getHeapUses(Instruction s)
          Return the heap operands used by an instruction.
(package private)  Iterator<HeapVariable<Object>> getHeapVariables()
          Return an enumeration of the heap variables in this IR.
private  int getNextHeapVariableNumber(Object type)
          Get the next number to be assigned to a new heap variable for a given type or field.
(package private)  int getNumberOfHeapDefs(Instruction s)
          Return the number of heap operands defined by an instruction
(package private)  int getNumberOfHeapVariables()
          Return the total number of heap variables allocated for the IR
(package private)  int getNumberOfUses(HeapVariable<Object> A)
          Return the number of uses of a heap variable.
private  void getStaticHelper(Instruction s, BasicBlock b)
          Record the effects of a getstatic instruction on the heap array SSA form.
(package private)  HeapOperand<Object> getUniqueDef(HeapVariable<Object> A)
          Return the operand that represents a heap variable's unique def.
(package private)  boolean isExposedOnExit(HeapVariable<Object> H)
          Is heap variable H exposed on procedure exit?
(package private)  Iterator<HeapOperand<Object>> iterateHeapUses(HeapVariable<Object> A)
          Return an enumeration of all uses of a particular heap variable.
private  Iterator<HeapOperand<Object>> iterateOriginalHeapDefs(HeapVariable<Object> A)
          Return an enumeration of all the original definitions of a heap variable.
private  Iterator<HeapOperand<Object>> iterateOriginalHeapUses(HeapVariable<Object> A)
          Return an enumeration of all the original uses of a heap variable.
private  void labelHelper(Instruction s, BasicBlock b)
          Record the effects of a label instruction on the heap array SSA form.
private static Instruction makePhiInstruction(HeapVariable<Object> H, BasicBlock bb)
          Create a phi-function instruction for a heap variable
private  void newArrayHelper(Instruction s, BasicBlock b)
          Update the heap array SSA form for an array allocation instruction
private  void newHelper(Instruction s, BasicBlock b)
          Update the heap array SSA form for an allocation instruction
private  void phiHelper(Instruction s, BasicBlock b)
          Record the effects of a phi instruction on the heap array SSA form.
private  void putFieldHelper(Instruction s, BasicBlock b)
          Record the effects of a putfield instruction on the heap array SSA form.
private  void putStaticHelper(Instruction s, BasicBlock b)
          Record the effects of a putstatic instruction on the heap array SSA form.
(package private)  void recomputeArrayDU()
          Recompute the chain of uses for each heap variable.
private  void registerDef(Instruction s, BasicBlock b, FieldReference fr)
          Register that instruction s writes a heap variable for a given field.
private  void registerDef(Instruction s, BasicBlock b, String a)
          Register that the instruction s writes a heap variable for a given field.
private  void registerDef(Instruction s, BasicBlock b, TypeReference t)
          Register that an instruction writes a heap variable for a given type.
(package private)  void registerExit(Instruction s, BasicBlock b)
          Register that an instruction s can potentially leave the procedure.
(package private)  void registerInstruction(Instruction s, BasicBlock b)
          Record the heap variables that instruction s defines and uses.
(package private)  void registerUnknown(Instruction s, BasicBlock b)
          Register that an instruction s has unknown side effects.
private  void registerUse(Instruction s, FieldReference fr)
          Register that an instruction uses a heap variable for a given field.
private  void registerUse(Instruction s, String a)
          Register that an instruction uses a heap variable for a given field.
private  void registerUse(Instruction s, TypeReference t)
          Register that an instruction uses a heap variable of a given type.
(package private)  HeapOperand<Object>[] replaceDefs(Instruction s, BasicBlock b)
          Replace all heap variables that an instruction defs with new heap variables.
(package private)  void replaceUses(Instruction s, HeapOperand<Object>[] H)
          Register that an instruction now uses the set of heap operands
(package private)  boolean usesHeapVariable(Instruction s)
          Does a particular instruction use any heap variable?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

private static final boolean DEBUG
Flag to turn on debugging

See Also:
Constant Field Values

exceptionState

static final String exceptionState
The object for the heap variable that is used for modelling explicit exception dependencies

See Also:
Constant Field Values

uses

private final HashMap<Instruction,HeapOperand<Object>[]> uses
A mapping from Instruction to the set of heap operands (an HeapOperand[]) that this instruction uses. Note that PHI instructions do not appear in this mapping.


defs

private final HashMap<Instruction,HeapOperand<Object>[]> defs
A mapping from Instruction to the set of heap operands (an HeapOperand[]) that this instruction defines. Note that PHI instructions do not appear in this mapping.


heapVariables

private final HashMap<SSADictionary.HeapKey<Object>,HeapVariable<Object>> heapVariables
A mapping from HeapKey to the set of heap variables introduced for this IR


nextNumber

private HashMap<Object,Integer> nextNumber
A mapping from heap variable type to Integer This structure holds the next number to assign when creating a new heap variable name for a given type


heapPhi

private final HashMap<BasicBlock,ArrayList<Instruction>> heapPhi
A mapping from BasicBlock to ArrayList of Instruction . This map holds the list of heap phi instructions stored as lookaside for each basic block.


emptyArrayList

private static final ArrayList<Instruction> emptyArrayList
An empty vector, used for utility.


UseChain

private final HashMap<HeapVariable<Object>,HashSet<HeapOperand<Object>>> UseChain
A mapping from HeapVariable to HashSet of HeapOperand . This map holds the set of heap operands which use each heap variable.


DefChain

private final HashMap<HeapVariable<Object>,HeapOperand<Object>> DefChain
A mapping from HeapVariable to HeapOperand . This map holds the set of heap operands which define each heap variable.


exits

private final HashSet<Instruction> exits
The set of instructions which have been registered to potentially exit the procedure


originalUses

private final HashMap<Object,HashSet<HeapOperand<Object>>> originalUses
A mapping from a heap variable type to a HashSet of Instruction . The set of all uses of a heap variable type before we performed renaming for SSA.


originalDefs

private final HashMap<Object,HashSet<HeapOperand<Object>>> originalDefs
A mapping from a heap variable type to a HashSet of Instruction . The set of all definitions of a heap variable type before we performed renaming for SSA.


heapTypes

private final Set<Object> heapTypes
The set of type to build heap array variables for


uphi

private final boolean uphi
Should the heap array SSA form constructed include uphi functions? That is, does a use create a new name for a heap variable.


insertPEIDeps

private final boolean insertPEIDeps
Should PEIs and stores to the heap be modelled via an explicit exception state heap variable?


ir

private final IR ir
A pointer to the governing IR

Constructor Detail

SSADictionary

SSADictionary(Set<Object> heapTypes,
              boolean uphi,
              boolean insertPEIDeps,
              IR ir)
Initialize a structure to hold Heap Array SSA information.

Parameters:
heapTypes - only create heap arrays for these locations. if null, create all heap arrays
uphi - Should we use uphi functions? (ie. loads create a new name for heap arrays)
Method Detail

usesHeapVariable

boolean usesHeapVariable(Instruction s)
Does a particular instruction use any heap variable?

Parameters:
s - the instruction in question
Returns:
true iff the instruction uses any heap variable. false otherwise

defsHeapVariable

boolean defsHeapVariable(Instruction s)
Does a particular instruction define any heap variable?

Parameters:
s - the instruction in question
Returns:
true iff the instruction defs any heap variable. false otherwise

getHeapUses

public HeapOperand<Object>[] getHeapUses(Instruction s)
Return the heap operands used by an instruction.

Parameters:
s - the instruction in question
Returns:
an array of the heap operands this instruction uses

getHeapDefs

public HeapOperand<Object>[] getHeapDefs(Instruction s)
Return the heap operands defined by an instruction.

Parameters:
s - the instruction in question
Returns:
an array of the heap operands this instruction defs

getNumberOfHeapDefs

int getNumberOfHeapDefs(Instruction s)
Return the number of heap operands defined by an instruction

Parameters:
s - the instruction in question
Returns:
the number of heap operands this instruction defs

replaceDefs

HeapOperand<Object>[] replaceDefs(Instruction s,
                                  BasicBlock b)
Replace all heap variables that an instruction defs with new heap variables. Each new heap variable has the same type as the old one, but a new number. Essentially, this function introduces new names required for translation into SSA form. This instruction will be the single static definition for each new heap variable.

Parameters:
s - the instruction that writes to the new heap variables
b - the basic block containing s
Returns:
the new heap variables that the instruction defines

getHeapVariables

Iterator<HeapVariable<Object>> getHeapVariables()
Return an enumeration of the heap variables in this IR.

Returns:
the heap variables stored for this IR

getHeapPhiInstructions

public Iterator<Instruction> getHeapPhiInstructions(BasicBlock bb)
Return an enumeration of the control-phi functions for Heap variables at the beginning of a basic block.

Parameters:
bb - the basic block in question
Returns:
the phi instructions for heap variables at the beginning of the basic block

getAllInstructions

SSADictionary.AllInstructionEnumeration getAllInstructions(BasicBlock bb)
Return an enumeration of all instructions for a basic block, including the control-PHI functions for heap variables stored implicitly here.

Parameters:
bb - the basic block in question
Returns:
an enumeration of all instructions in this basic block, including heap phi instructions stored implicitly in this lookaside structure

iterateHeapUses

Iterator<HeapOperand<Object>> iterateHeapUses(HeapVariable<Object> A)
Return an enumeration of all uses of a particular heap variable.

Parameters:
A - the heap variable in question
Returns:
an iterator over all instructions that use this heap variable

getUniqueDef

HeapOperand<Object> getUniqueDef(HeapVariable<Object> A)
Return the operand that represents a heap variable's unique def.

Parameters:
A - the heap variable in question
Returns:
the heap operand that represents this heap variable's unique static definition

iterateOriginalHeapUses

private Iterator<HeapOperand<Object>> iterateOriginalHeapUses(HeapVariable<Object> A)
Return an enumeration of all the original uses of a heap variable. That is, return an iteration of all uses of the heap variable before we performed renaming for SSA.

Parameters:
A - the heap variable in question
Returns:
an iteration of all instructions that used this heap variable, prior to renaming for SSA

iterateOriginalHeapDefs

private Iterator<HeapOperand<Object>> iterateOriginalHeapDefs(HeapVariable<Object> A)
Return an enumeration of all the original definitions of a heap variable. That is, return an iteration of all defs of the heap variable before we performed renaming for SSA.

Parameters:
A - the heap variable in question
Returns:
an iteration of all instructions that defined this heap variable, prior to renaming for SSA

findOrCreateOriginalUses

private HashSet<HeapOperand<Object>> findOrCreateOriginalUses(Object type)
Return a set of all the original uses of a heap variable. That is, return the set of all uses of the heap variable before we performed renaming for SSA.

Parameters:
type - The heap variable in question
Returns:
the set of all instructions that used this heap variable, prior to renaming for SSA

findOrCreateOriginalDefs

private HashSet<HeapOperand<Object>> findOrCreateOriginalDefs(Object type)
Return a set of all the original definitions of a heap variable. That is, return the set of all uses of the heap variable before we performed renaming for SSA.

Parameters:
type - the heap variable in question
Returns:
the set of all instructions that defined this heap variable, prior to renaming for SSA

getNumberOfUses

int getNumberOfUses(HeapVariable<Object> A)
Return the number of uses of a heap variable.

Parameters:
A - the heap variable in question
Returns:
the number of uses of the heap variable

enumerateExposedHeapVariables

Iterator<HeapVariable<Object>> enumerateExposedHeapVariables()
Return an enumeration of all heap variables that may be exposed on procedure exit.

Returns:
an enumeration of all heap variables that may be exposed on procedure exit

isExposedOnExit

boolean isExposedOnExit(HeapVariable<Object> H)
Is heap variable H exposed on procedure exit?

Returns:
true or false as appropriate

recomputeArrayDU

void recomputeArrayDU()
Recompute the chain of uses for each heap variable. NOTE: for now this procedure does not recompute def chains


deleteFromUseChain

void deleteFromUseChain(HeapOperand<Object> op)
Delete an HeapOperand from the use chain of its heap variable

Parameters:
op - the heap operand to be deleted

addToUseChain

void addToUseChain(HeapOperand<Object> op)
Add an HeapOperand to the use chain of its heap variable

Parameters:
op - the heap operand to be added

createHeapPhiInstruction

void createHeapPhiInstruction(BasicBlock bb,
                              HeapVariable<Object> H)
Create a heap control phi instruction, and store it at the beginning of a basic block.

Parameters:
bb - the basic block
H - the heap variable to merge

replaceUses

void replaceUses(Instruction s,
                 HeapOperand<Object>[] H)
Register that an instruction now uses the set of heap operands

Parameters:
s - the instruction in question
H - the set of heap operands which s uses

getNumberOfHeapVariables

int getNumberOfHeapVariables()
Return the total number of heap variables allocated for the IR

Returns:
the total number of heap variables allocated for the IR

registerExit

void registerExit(Instruction s,
                  BasicBlock b)
Register that an instruction s can potentially leave the procedure. We conservatively record that s uses all heap variables.

NOTE: This function should be called before renaming.

NOTE: Only need to use this for backwards analyses

Parameters:
s - the instruction in question
b - s's basic block

registerUnknown

void registerUnknown(Instruction s,
                     BasicBlock b)
Register that an instruction s has unknown side effects. That is, we conservatively record that s defs and uses all heap variables.

NOTE: This function should be called before renaming.

Parameters:
s - the instruction in question
b - the basic block containing s

registerInstruction

void registerInstruction(Instruction s,
                         BasicBlock b)
Record the heap variables that instruction s defines and uses.

Parameters:
s - the instruction in question
b - the basic block containing s

getFieldHelper

private void getFieldHelper(Instruction s,
                            BasicBlock b)
Record the effects of a getfield instruction on the heap array SSA form. Register the heap variables that this instruction uses and defs. Note that if inserting uphi functions, a getfield defs a new heap variable name.

Parameters:
s - the getfield instruction
b - the basic block containing s

putFieldHelper

private void putFieldHelper(Instruction s,
                            BasicBlock b)
Record the effects of a putfield instruction on the heap array SSA form. Register the heap variables that this instruction uses and defs.

Parameters:
s - the getfield instruction
b - the basic block containing s

getStaticHelper

private void getStaticHelper(Instruction s,
                             BasicBlock b)
Record the effects of a getstatic instruction on the heap array SSA form. Register the heap variables that this instruction uses and defs. Note that if inserting uphi functions, a getstatic defs a new heap variable name.

Parameters:
s - the getstatic instruction
b - the basic block containing s

putStaticHelper

private void putStaticHelper(Instruction s,
                             BasicBlock b)
Record the effects of a putstatic instruction on the heap array SSA form. Register the heap variables that this instruction uses and defs.

Parameters:
s - the putstatic instruction
b - the basic block containing s

newHelper

private void newHelper(Instruction s,
                       BasicBlock b)
Update the heap array SSA form for an allocation instruction

Parameters:
s - the allocation instruction
b - the basic block containing the allocation

newArrayHelper

private void newArrayHelper(Instruction s,
                            BasicBlock b)
Update the heap array SSA form for an array allocation instruction

Parameters:
s - the allocation instruction
b - the basic block containing the allocation

aloadHelper

private void aloadHelper(Instruction s,
                         BasicBlock b)
Record the effects of a aload instruction on the heap array SSA form. Register the heap variables that this instruction uses and defs. Note that if inserting uphi functions, a aload defs a new heap variable name.

Parameters:
s - the aload instruction
b - the basic block containing s

astoreHelper

private void astoreHelper(Instruction s,
                          BasicBlock b)
Record the effects of an astore instruction on the heap array SSA form. Register the heap variables that this instruction uses and defs.

Parameters:
s - the astore instruction
b - the basic block containing s

arraylengthHelper

private void arraylengthHelper(Instruction s,
                               BasicBlock b)
Record the effects of an arraylength instruction on the heap array SSA form. Register the heap variable that this instruction uses.

Parameters:
s - the arraylength instruction
b - the basic block containing s

phiHelper

private void phiHelper(Instruction s,
                       BasicBlock b)
Record the effects of a phi instruction on the heap array SSA form. Register the heap variables that this instruction uses and defs.

Parameters:
s - the phi instruction
b - the basic block containing s

labelHelper

private void labelHelper(Instruction s,
                         BasicBlock b)
Record the effects of a label instruction on the heap array SSA form. Register the exception state that this instruction defs.

Parameters:
s - the label instruction
b - the basic block containing s

bbendHelper

private void bbendHelper(Instruction s,
                         BasicBlock b)
Record the effects of a bbend instruction on the heap array SSA form. Register the exception state that this instruction uses.

Parameters:
s - the label instruction
b - the basic block containing s

registerUse

private void registerUse(Instruction s,
                         TypeReference t)
Register that an instruction uses a heap variable of a given type.

Parameters:
s - the instruction in question
t - the type of the heap variable the instruction uses

registerDef

private void registerDef(Instruction s,
                         BasicBlock b,
                         TypeReference t)
Register that an instruction writes a heap variable for a given type.

Parameters:
s - the instruction in question
b - s's basic block
t - the type of the heap variable the instruction modifies

registerUse

private void registerUse(Instruction s,
                         FieldReference fr)
Register that an instruction uses a heap variable for a given field.

Parameters:
s - the instruction in question
fr - the field heap variable the instruction uses

registerDef

private void registerDef(Instruction s,
                         BasicBlock b,
                         FieldReference fr)
Register that instruction s writes a heap variable for a given field.

Parameters:
s - the instruction in question
b - s's basic block
fr - the field heap variable the instruction modifies

registerUse

private void registerUse(Instruction s,
                         String a)
Register that an instruction uses a heap variable for a given field.

Parameters:
s - the instruction in question
a - the field heap variable the instruction uses

registerDef

private void registerDef(Instruction s,
                         BasicBlock b,
                         String a)
Register that the instruction s writes a heap variable for a given field.

Parameters:
s - the instruction in question
b - s's basic block
a - XXX TODO Check this XXX The field in question.

extendHArray

private static HeapOperand<Object>[] extendHArray(HeapOperand<Object>[] H)
Returns a copy of H with an additional free slot at position 0

Parameters:
H - the array of HeapOperands to be extended.

addExceptionStateToDefs

void addExceptionStateToDefs(Instruction s,
                             BasicBlock b)
Register that an instruction defines the exception state.

Parameters:
s - the instruction in question
b - s's basic block

addExceptionStateToUses

void addExceptionStateToUses(Instruction s)
Register that an instruction defines the exception state.

Parameters:
s - the instruction in question

findOrCreateHeapVariable

private HeapVariable<Object> findOrCreateHeapVariable(Object type)
Return the heap variable for a given type or field with number 0. If no heap variable yet exits for this type or field, create a new one.

Parameters:
type - the TypeReference or RVMField identifying the desired heap variable
Returns:
the desired heap variable

getNextHeapVariableNumber

private int getNextHeapVariableNumber(Object type)
Get the next number to be assigned to a new heap variable for a given type or field.

Parameters:
type - the TypeReference or RVMField identifying the heap variable
Returns:
the next integer (monotonically increasing) to identify a new name for this heap variable

makePhiInstruction

private static Instruction makePhiInstruction(HeapVariable<Object> H,
                                              BasicBlock bb)
Create a phi-function instruction for a heap variable

Parameters:
H - a symbolic variable for a Heap variable
bb - the basic block holding the new phi function instruction
Returns:
the instruction H = phi H,H,..,H