cfg
Class LoadEntryInst

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

public class LoadEntryInst
extends LoadInst

A class representing a three-address code load entry instruction (LoadEntryInst), which loads an entry from an indexable variable or string constant. A load entry instruction consists of a destination variable and a source operand (note: the operand must be indexable, e.g., an object variable), which are both inherited from LoadInst. A LoadEntryInst also consists of an index, which is either an int variable or constant. From TACInst it also inherits an opcode (LDENTRY).

Author:
Marc Corliss and Lori Pietraszek

Field Summary
 
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
LoadEntryInst(java.lang.String destination, java.lang.String source, java.lang.String index)
          LoadEntryInst 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 getIndex()
          Get the index
 java.lang.String getString()
          Get string representation of instruction (without comments) (note: in general, you want to use toString() to get instruction string)
 void setIndex(java.lang.String index)
          Set the index
 void setSource(java.lang.String source)
          Set the source operand
 
Methods inherited from class cfg.LoadInst
getDestination, getSource, 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
 

Constructor Detail

LoadEntryInst

public LoadEntryInst(java.lang.String destination,
                     java.lang.String source,
                     java.lang.String index)
LoadEntryInst constructor

Parameters:
destination - destination variable
source - source object (variable or string constant to load from)
index - index to load entry from in source operand (either int variable or constant)
Method Detail

setSource

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

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

getIndex

public java.lang.String getIndex()
Get the index

Returns:
index

setIndex

public void setIndex(java.lang.String index)
Set the index

Parameters:
index - new index

equals

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

Overrides:
equals in class LoadInst
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)

Overrides:
getString in class LoadInst
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.