cfg
Class CallInst

java.lang.Object
  extended by cfg.TACInst
      extended by cfg.CallInst
Direct Known Subclasses:
DirCallInst, InDirCallInst

public abstract class CallInst
extends TACInst

A generic class representing a three-address code call instruction (CallInst). It is extended by two specific call instructions: InDirCallInst and DirCallInst. A call instruction consists of a target (possibly a variable or address) to jump to, an optional destination variable to assign the result of the call to, and the number of parameters (ref. and standard) used by the call. From TACInst it also inherits an opcode. Note about parameters: if at least one parameter is used, then a reference parameter must be supplied. For indirect calls, a reference parameter must always be supplied. If parameters are supplied (excluding error parameters), then the reference parameter must be supplied first followed by the standard parameters in the order that they were listed in the source program. the ordering of error parameters does not matter.

Author:
Marc Corliss and Lori Pietraszek

Field Summary
protected  java.lang.String callType
          Type of call (e.g., "indircall", "dircall")
protected  java.lang.String destVar
          (Optional) destination variable to assign result of call (null if none)
protected  java.lang.String target
          Target to jump to
 
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
CallInst(int opcode, java.lang.String callType, java.lang.String target, java.lang.String destVar, int numParams)
          CallInst constructor
 
Method Summary
 boolean equals(java.lang.Object o)
          Compares this object with the parameter object
 java.lang.String getDestVar()
          Get the destination variable (variable to assign result to -- null if none)
 int getNumParam()
          Get the number of parameters (both ref.
 java.lang.String getString()
          Get string representation of instruction (without comments) (note: in general, you want to use toString() to get instruction string)
 java.lang.String getTarget()
          Get the target of the call
 void setDestVar(java.lang.String destVar)
          Set the destination variable (variable to assign result to -- null if none)
 void setNumParam(int numParams)
          Set the number of parameters (both ref.
abstract  void setTarget(java.lang.String target)
          Set the target of the call
 
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

callType

protected java.lang.String callType
Type of call (e.g., "indircall", "dircall")


target

protected java.lang.String target
Target to jump to


destVar

protected java.lang.String destVar
(Optional) destination variable to assign result of call (null if none)

Constructor Detail

CallInst

public CallInst(int opcode,
                java.lang.String callType,
                java.lang.String target,
                java.lang.String destVar,
                int numParams)
CallInst constructor

Parameters:
opcode - opcode of call instruction
callType - type of call (e.g., "indircall", "dircall")
target - target to jump to
destVar - (Optional) destination variable to assign result of call (null if none)
numParams - number of parameters (both ref. and standard but not error)
Method Detail

getTarget

public java.lang.String getTarget()
Get the target of the call

Returns:
target

setTarget

public abstract void setTarget(java.lang.String target)
Set the target of the call

Parameters:
target - new target

getDestVar

public java.lang.String getDestVar()
Get the destination variable (variable to assign result to -- null if none)

Returns:
destination variable

setDestVar

public void setDestVar(java.lang.String destVar)
Set the destination variable (variable to assign result to -- null if none)

Parameters:
destVar - new destination variable

getNumParam

public int getNumParam()
Get the number of parameters (both ref. and standard but not error)

Returns:
number of parameters

setNumParam

public void setNumParam(int numParams)
Set the number of parameters (both ref. and standard but not error)

Parameters:
numParams - new number of parameters

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)