cfg
Class LoadConstInst

java.lang.Object
  extended by cfg.TACInst
      extended by cfg.LoadInst
          extended by cfg.LoadConstInst

public class LoadConstInst
extends LoadInst

A class representing a three-address code load constant instruction (LoadConstInst). A load constant instruction consists of a destination variable and a source constant (int, boolean, or String), which are both inherited from LoadInst. It also contains (non-inherited) type, which indicates the constant type (int, boolean, or String). From TACInst it also inherits an opcode (LDCONST).

Author:
Marc Corliss and Lori Pietraszek

Field Summary
static int BOOL
          Boolean constant ID
static int INT
          Integer constant ID
static int NULL
          Null constant ID
static int STR
          String constant ID
 
Fields inherited from class cfg.LoadInst
destination, source
 
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
LoadConstInst(java.lang.String destination, java.lang.String source)
          LoadConstInst constructor
 
Method Summary
<ReturnType,ArgumentType>
ReturnType
accept(TACInstVisitor<ReturnType,ArgumentType> visitor, ArgumentType o)
          Abstract visitor method.
 int getType()
          Get the type of the constant (e.g., LoadConstInst.INT)
 void setSource(java.lang.String source)
          Set the source operand
 
Methods inherited from class cfg.LoadInst
equals, getDestination, getSource, getString, setDestination
 
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

INT

public static final int INT
Integer constant ID

See Also:
Constant Field Values

BOOL

public static final int BOOL
Boolean constant ID

See Also:
Constant Field Values

STR

public static final int STR
String constant ID

See Also:
Constant Field Values

NULL

public static final int NULL
Null constant ID

See Also:
Constant Field Values
Constructor Detail

LoadConstInst

public LoadConstInst(java.lang.String destination,
                     java.lang.String source)
LoadConstInst constructor

Parameters:
destination - destination variable
source - source constant (int, boolean, String, or null -- String needs double quotes)
Method Detail

getType

public int getType()
Get the type of the constant (e.g., LoadConstInst.INT)

Returns:
constant type

setSource

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

Specified by:
setSource in class LoadInst
Parameters:
source - new source operand

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.