cfg
Class UnaryInst

java.lang.Object
  extended by cfg.TACInst
      extended by cfg.UnaryInst
Direct Known Subclasses:
UnaryNegInst, UnaryNotInst

public abstract class UnaryInst
extends TACInst

A generic class representing a three-address code unary instruction (UnaryInst). It is extended by several specific unary instructions (UnaryNegInst and UnaryNotInst). A unary instruction consists of a destination variable and a source operand (the types allowed for the source depends on the particular type of unary 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 source
          Source operand (type of source allowed varies in different unary 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
UnaryInst(int opcode, java.lang.String destination, java.lang.String source)
          UnaryInst 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 getSource()
          Get the 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 setSource(java.lang.String source)
          Set the 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


source

protected java.lang.String source
Source operand (type of source allowed varies in different unary instructions)

Constructor Detail

UnaryInst

public UnaryInst(int opcode,
                 java.lang.String destination,
                 java.lang.String source)
UnaryInst constructor

Parameters:
opcode - opcode of unary instruction
destination - destination variable
source - source operand (type of source allowed varies in different unary insn)
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

getSource

public java.lang.String getSource()
Get the source operand

Returns:
source operand

setSource

public abstract void setSource(java.lang.String source)
Set the source operand

Parameters:
source - new 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)