cfg
Class ReturnInst

java.lang.Object
  extended by cfg.TACInst
      extended by cfg.ReturnInst

public class ReturnInst
extends TACInst

A class representing a three-address code return instruction (ReturnInst). An return instruction consists of an optional source operand holding the result of the return expression. From TACInst it also inherits an opcode (RETN).

Author:
Marc Corliss and Lori Pietraszek

Field Summary
protected  java.lang.String source
          Source operand holding result of the return expression (null if none)
 
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
ReturnInst(java.lang.String source)
          ReturnInst constructor
 
Method Summary
<ReturnType,ArgumentType>
ReturnType
accept(TACInstVisitor<ReturnType,ArgumentType> visitor, ArgumentType o)
          Abstract visitor method.
 boolean equals(java.lang.Object o)
          Compares this object with the parameter object
 java.lang.String getSource()
          Get the soure operand (result of return expression, null if none)
 java.lang.String getString()
          Get string representation of instruction (without comments) (note: in general, you want to use toString() to get instruction string)
 void setSource(java.lang.String source)
          Set the soure operand (result of return expression, to null if none)
 
Methods inherited from class cfg.TACInst
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

source

protected java.lang.String source
Source operand holding result of the return expression (null if none)

Constructor Detail

ReturnInst

public ReturnInst(java.lang.String source)
ReturnInst constructor

Parameters:
source - source operand holding result of the return expression
Method Detail

getSource

public java.lang.String getSource()
Get the soure operand (result of return expression, null if none)

Returns:
source operand

setSource

public void setSource(java.lang.String source)
Set the soure operand (result of return expression, to null if none)

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)

accept

public <ReturnType,ArgumentType> ReturnType accept(TACInstVisitor<ReturnType,ArgumentType> visitor,
                                                   ArgumentType o)
Description copied from class: TACInst
Abstract visitor method.

Specified by:
accept in class TACInst
Parameters:
visitor - TACInstVisitor.
o - Data to pass down.
Returns:
return value of visitor.