Class PhiInstruction


  • public class PhiInstruction
    extends IRInstruction
    An SSA phi merging one incoming value per predecessor block.
    • Constructor Detail

      • PhiInstruction

        public PhiInstruction​(SSAValue result)
        Creates a phi with no incoming values yet.
        Parameters:
        result - the SSA value receiving the merged value
    • Method Detail

      • getIncomingValues

        public Map<IRBlock,​Value> getIncomingValues()
        Returns:
        the incoming values
      • addIncoming

        public void addIncoming​(Value value,
                                IRBlock fromBlock)
        Adds an incoming value from a predecessor block.
        Parameters:
        value - the incoming value
        fromBlock - the predecessor block
      • removeIncoming

        public void removeIncoming​(IRBlock fromBlock)
        Removes an incoming value from a predecessor block.
        Parameters:
        fromBlock - the predecessor block
      • getIncoming

        public Value getIncoming​(IRBlock fromBlock)
        Gets the incoming value from a specific predecessor block.
        Parameters:
        fromBlock - the predecessor block
        Returns:
        the incoming value, or null if not present
      • getIncomingBlocks

        public Set<IRBlock> getIncomingBlocks()
        Gets all predecessor blocks with incoming values.
        Returns:
        set of predecessor blocks
      • replaceOperand

        public void replaceOperand​(Value oldValue,
                                   Value newValue)
        Description copied from class: IRInstruction
        Replaces an operand value with a new value.
        Specified by:
        replaceOperand in class IRInstruction
        Parameters:
        oldValue - the value to replace
        newValue - the replacement value
      • accept

        public <T> T accept​(IRVisitor<T> visitor)
        Description copied from class: IRInstruction
        Accepts a visitor for this instruction.
        Specified by:
        accept in class IRInstruction
        Type Parameters:
        T - the return type
        Parameters:
        visitor - the visitor to accept
        Returns:
        the visitor result
      • isPhi

        public boolean isPhi()
        Description copied from class: IRInstruction
        Checks if this is a phi instruction.
        Overrides:
        isPhi in class IRInstruction
        Returns:
        true if this is a phi instruction