cfg
Class LoadInst

java.lang.Object
  extended by cfg.TACInst
      extended by cfg.LoadInst
Direct Known Subclasses:
LoadAddrInst, LoadConstInst, LoadEntryInst, LoadVarInst

public abstract class LoadInst
extends TACInst

A generic class representing a three-address code load instruction (LoadInst). It is extended by several specific load instructions (LoadVarInst, LoadConstInst, LoadAddrInst, and LoadEntryInst). A load instruction consists of a destination variable and a source operand (the type of the source depends on the particular type of load 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 varies in different load 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
LoadInst(int opcode, java.lang.String destination, java.lang.String source)
          LoadInst 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 varies in different load instructions)

Constructor Detail

LoadInst

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

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