|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcfg.TACInst
cfg.IfInst
public class IfInst
A class representing a three-address code if instruction (IfInst). An if instruction consists of a condition type ('==', '!=', '<', '>', '>='), a left and right source operand to conditionally compare, a true target block, which is taken when the condition is true, and a false target block, which is taken when the condition is false. From TACInst it also inherits an opcode (INDIRCALL).
Field Summary | |
---|---|
static int |
EQ
Equals ('==') condition type ID |
protected BasicBlock |
falseTarg
Target block when condition is false (fall through target) |
static int |
GE
Equals ('>=') condition type ID |
static int |
GT
Equals ('>') condition type ID |
static int |
LE
Equals ('<=') condition type ID |
protected java.lang.String |
leftSource
Left source operand in condition |
static int |
LT
Equals ('<') condition type ID |
static int |
NE
Equals ('!=') condition type ID |
protected java.lang.String |
rightSource
Right source operand in condition |
protected BasicBlock |
trueTarg
Target block when condition is true (jump target) |
protected int |
type
Type of condition (e.g., IfInst.EQ for '==', etc.) |
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 | |
---|---|
IfInst(int type,
java.lang.String leftSource,
java.lang.String rightSource,
BasicBlock trueTarg,
BasicBlock falseTarg)
IfInst constructor |
Method Summary | ||
---|---|---|
|
accept(TACInstVisitor<ReturnType,ArgumentType> visitor,
ArgumentType o)
Abstract visitor method. |
|
boolean |
equals(java.lang.Object o)
Compares this object with the parameter object |
|
BasicBlock |
getFalseTarg()
Get the false target block |
|
java.lang.String |
getLeftSource()
Get the left source operand |
|
java.lang.String |
getRightSource()
Get the right 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) |
|
BasicBlock |
getTrueTarg()
Get the true target block |
|
int |
getType()
Get the type of If condition |
|
void |
setFalseTarg(BasicBlock falseTarg)
Get the false target block |
|
void |
setLeftSource(java.lang.String leftSource)
Set the left soure operand |
|
void |
setRightSource(java.lang.String rightSource)
Set the right soure operand |
|
void |
setTrueTarg(BasicBlock trueTarg)
Set the true target block |
|
void |
setType(int type)
Set the type of If condition |
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 |
---|
public static final int EQ
public static final int NE
public static final int LT
public static final int LE
public static final int GT
public static final int GE
protected int type
protected java.lang.String leftSource
protected java.lang.String rightSource
protected BasicBlock trueTarg
protected BasicBlock falseTarg
Constructor Detail |
---|
public IfInst(int type, java.lang.String leftSource, java.lang.String rightSource, BasicBlock trueTarg, BasicBlock falseTarg)
type
- type of condition (e.g., IfInst.EQ for '==', etc.)leftSource
- left source operand in conditionrightSource
- right source operand in conditiontrueTarg
- target block when condition is true (jump target)falseTarg
- target block when condition is false (fall through target)Method Detail |
---|
public int getType()
public void setType(int type)
type
- the new type of Ifpublic java.lang.String getLeftSource()
public void setLeftSource(java.lang.String leftSource)
leftSource
- new left source operandpublic java.lang.String getRightSource()
public void setRightSource(java.lang.String rightSource)
rightSource
- new right source operandpublic BasicBlock getTrueTarg()
public void setTrueTarg(BasicBlock trueTarg)
trueTarg
- new true target blockpublic BasicBlock getFalseTarg()
public void setFalseTarg(BasicBlock falseTarg)
falseTarg
- new false target blockpublic boolean equals(java.lang.Object o)
equals
in class TACInst
o
- object to compare the reference object with
public java.lang.String getString()
getString
in class TACInst
public <ReturnType,ArgumentType> ReturnType accept(TACInstVisitor<ReturnType,ArgumentType> visitor, ArgumentType o)
TACInst
accept
in class TACInst
visitor
- TACInstVisitor.o
- Data to pass down.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |