dspl.intermediate.instructions
Class BranchInstruction

java.lang.Object
  extended by dspl.intermediate.instructions.Instruction
      extended by dspl.intermediate.instructions.BranchInstruction
Direct Known Subclasses:
PartialBranchInstruction

public class BranchInstruction
extends Instruction


Field Summary
 Comparison comp
          Contains the binary comparison which if true, the ifInstructions are evaluated, else, the elseInstructions are evaluated
 Instruction elseInst
          Instructions to be executed if hte "if" statement is not true (the else portion to be evaluated)
 Instruction ifInst
          Instructions to be executed if the "if" statement is true
 
Fields inherited from class dspl.intermediate.instructions.Instruction
INST_TYPE_ARITHMATIC, INST_TYPE_BRANCH, INST_TYPE_CCALL, INST_TYPE_FORLOOP, lastInstruction, nextInstruction, prevInstruction
 
Constructor Summary
BranchInstruction(Comparison comp, Instruction ifInst, Instruction elseInst)
           
 
Method Summary
 int getInstType()
           
 boolean usesVariable(Variable v)
          Designed to be a recursive call to see if a given variable is used anymore within a code block, after the current instruction.
 
Methods inherited from class dspl.intermediate.instructions.Instruction
setNextInstruction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

comp

public Comparison comp
Contains the binary comparison which if true, the ifInstructions are evaluated, else, the elseInstructions are evaluated


ifInst

public Instruction ifInst
Instructions to be executed if the "if" statement is true


elseInst

public Instruction elseInst
Instructions to be executed if hte "if" statement is not true (the else portion to be evaluated)

Constructor Detail

BranchInstruction

public BranchInstruction(Comparison comp,
                         Instruction ifInst,
                         Instruction elseInst)
Method Detail

usesVariable

public boolean usesVariable(Variable v)
Description copied from class: Instruction
Designed to be a recursive call to see if a given variable is used anymore within a code block, after the current instruction. Intention is to allow a way to parse the Instruction tree to see if a specific variable is used again. NOTE: may not be necessary, or may need to be augmented to return a value indicating how far away from the current instruction will it be used again if desire to perform better register allocation.

Specified by:
usesVariable in class Instruction
Parameters:
v - the variable to search for to see if it is used
Returns:

getInstType

public int getInstType()
Specified by:
getInstType in class Instruction
Returns:
the instruction type of this instruction