cfg
Class BinaryInst

java.lang.Object
  extended by cfg.TACInst
      extended by cfg.BinaryInst
Direct Known Subclasses:
BinaryAddInst, BinaryAndInst, BinaryDivInst, BinaryModInst, BinaryMulInst, BinaryOrInst, BinarySubInst

public abstract class BinaryInst
extends TACInst

A generic class representing a three-address code binary instruction (BinaryInst). It is extended by several specific binary instructions: (BinaryAddInst, BinarySubInst, BinaryMulInst, BinaryDivInst, BinaryModInst, BinaryAndInst, BinaryOrInst, BinaryEqInst, BinaryNEInst, BinaryLTInst, BinaryLEInst, and BinaryGTInst, and BinaryGEInst). A binary instruction consists of a destination variable and two source operands (the types allowed for the two sources depends on the particular type of binary instruction). From TACInst it also inherits an opcode.

Author:
Marc Corliss and Lori Pietraszek

Field Summary
protected  java.lang.String destination
          Destination variable
protected  java.lang.String leftSource
          Left source operand (type of source allowed varies in different binary instructions)
protected  java.lang.String rightSource
          Right source operand (type of source allowed varies in different binary instructions)
 
Fields inherited from class cfg.TACInst
BINADD, BINAND, BINDIV, BINMOD, BINMUL, BINOR, BINSUB, comments, DIRCALL, ERRPARAM, IF, INDIRCALL, LDADDR, LDCONST, LDENTRY, LDVAR, NUM_INSN_TYPES, opcode, PHI, REFPARAM, RETN, STDPARAM, STENTRY, UNNEG, UNNOT
 
Constructor Summary
BinaryInst(int opcode, java.lang.String destination, java.lang.String leftSource, java.lang.String rightSource)
          BinaryInst constructor
 
Method Summary
 boolean equals(java.lang.Object o)
          Compares this object with the parameter object
 java.lang.String getDestination()
          Get the destination operand variable
 java.lang.String getLeftSource()
          Get the left source operand
 java.lang.String getRightSource()
          Get the right source operand
 java.lang.String getString()
          Get string representation of instruction (without comments) (note: in general, you want to use toString() to get instruction string)
 void setDestination(java.lang.String destination)
          Set the destination operand variable
abstract  void setLeftSource(java.lang.String leftSource)
          Set the left source operand
abstract  void setRightSource(java.lang.String rightSource)
          Set the right source operand
 
Methods inherited from class cfg.TACInst
accept, addComment, checkBoolConst, checkConst, checkIntConst, checkLabel, checkStrConst, checkVar, getBinaryOpcode, getComments, getOp, getOpcode, getUnaryOpcode, isBinary, isCall, isIf, isLoad, isParam, isReturn, isStore, isUnary, isValidID, removeComments, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

destination

protected java.lang.String destination
Destination variable


leftSource

protected java.lang.String leftSource
Left source operand (type of source allowed varies in different binary instructions)


rightSource

protected java.lang.String rightSource
Right source operand (type of source allowed varies in different binary instructions)

Constructor Detail

BinaryInst

public BinaryInst(int opcode,
                  java.lang.String destination,
                  java.lang.String leftSource,
                  java.lang.String rightSource)
BinaryInst constructor

Parameters:
opcode - opcode of binary instruction
destination - destination variable
leftSource - source operand (type of source allowed varies in different binary insn)
rightSource - source operand (type of source allowed varies in different binary insn)
branch - branch of this phi assignment (for upward recursion)
Method Detail

getDestination

public java.lang.String getDestination()
Get the destination operand variable

Returns:
destination operand

setDestination

public void setDestination(java.lang.String destination)
Set the destination operand variable

Parameters:
destination - new destination operand

getLeftSource

public java.lang.String getLeftSource()
Get the left source operand

Returns:
left source operand

setLeftSource

public abstract void setLeftSource(java.lang.String leftSource)
Set the left source operand

Parameters:
leftSource - new left source operand

getRightSource

public java.lang.String getRightSource()
Get the right source operand

Returns:
right source operand

setRightSource

public abstract void setRightSource(java.lang.String rightSource)
Set the right source operand

Parameters:
rightSource - new right source operand

equals

public boolean equals(java.lang.Object o)
Compares this object with the parameter object

Specified by:
equals in class TACInst
Parameters:
o - object to compare the reference object with
Returns:
boolean indicating whether the objects are equivalent

getString

public java.lang.String getString()
Get string representation of instruction (without comments) (note: in general, you want to use toString() to get instruction string)

Specified by:
getString in class TACInst
Returns:
string representation of three address code instruction (without comments)