|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--EDU.purdue.cs.bloat.tree.Node
|
+--EDU.purdue.cs.bloat.tree.Tree
Tree represents the expression tree of a basic Block. It consists of an operand (expression) stack comprised of expressions and a list of statements contained in the block.
Block,
Expr,
OperandStack,
see StmtList| Field Summary | |
static boolean |
AUPDATE_FIX_HACK
|
static boolean |
AUPDATE_FIX_HACK_CHANGED
|
static boolean |
DEBUG
|
static boolean |
FLATTEN
|
static boolean |
USE_PERSISTENT
|
static boolean |
USE_STACK
|
| Fields inherited from class EDU.purdue.cs.bloat.tree.Node |
parent |
| Constructor Summary | |
Tree(Block block,
OperandStack predStack)
Constructor. |
|
| Method Summary | |
void |
addInstruction(Instruction inst)
Adds an instruction that does not change the control flow (a normal instruction). |
void |
addInstruction(Instruction inst,
Block next)
Adds an instruction that jumps to another basic block. |
void |
addInstruction(Instruction inst,
Subroutine sub)
Add an instruction such as ret or astore that may involve a subroutine. |
void |
addLabel(Label label)
Add a label to the statement list. |
void |
addStmt(Stmt stmt)
Save the contents of the stack and add stmt to the statement list. |
void |
addStmtAfter(Stmt stmt,
Stmt after)
Inserts a statement into the statement list after another given statement. |
void |
addStmtBefore(Stmt stmt,
Stmt before)
Inserts a statement into the statement list before a specified statement. |
void |
addStmtBeforeJump(Stmt stmt)
Adds a statement to the statement list before the last jump statement. |
Block |
block()
Returns the basic block in which this Node resides. |
void |
cleanupOnly()
Cleans up this node. |
void |
initLocals(java.util.Collection locals)
Add a Collection of local variables to the block. |
Stmt |
lastStmt()
Returns the last non-Label statement in the statement list. |
LocalExpr |
newLocal(int index,
Type type)
Returns a new LocalExpr that is not allocated on the stack. |
LocalExpr |
newLocal(Type type)
Returns a local variable (LocalExpr) located in this method. |
StackExpr |
newStack(Type type)
Returns a new StackExpr for the top of the operand stack. |
LocalExpr |
newStackLocal(int index,
Type type)
Returns a new LocalExpr that represents an element of the stack. |
Node |
parent()
|
void |
prependStmt(Stmt stmt)
Add an statement to the statement list before the first non-Label statement. |
void |
removeLastStmt()
Removes the last non-Label statement from the statement list. |
void |
removeStmt(Stmt stmt)
Removes a statement from the statement list. |
OperandStack |
stack()
Returns the operand stack. |
java.util.List |
stmts()
|
java.lang.String |
toString()
Returns a String representation of this Tree. |
void |
visit_aaload(Instruction inst)
|
void |
visit_aastore(Instruction inst)
|
void |
visit_aload(Instruction inst)
|
void |
visit_areturn(Instruction inst)
|
void |
visit_arraylength(Instruction inst)
Pushes an ArrayLengthExpr onto the operand stack. |
void |
visit_astore(Instruction inst)
Visit an astore instruction. |
void |
visit_aswizzle(Instruction inst)
Add a SCStmt to the statement list |
void |
visit_aswrange(Instruction inst)
Add a SRStmt to the statement list. |
void |
visit_athrow(Instruction inst)
Adds a ThrowStmt to the statement list. |
void |
visit_aupdate(Instruction inst)
|
void |
visit_baload(Instruction inst)
|
void |
visit_bastore(Instruction inst)
|
void |
visit_caload(Instruction inst)
|
void |
visit_castore(Instruction inst)
|
void |
visit_checkcast(Instruction inst)
Pushes a CastExpr onto the operand stack. |
void |
visit_d2f(Instruction inst)
|
void |
visit_d2i(Instruction inst)
|
void |
visit_d2l(Instruction inst)
|
void |
visit_dadd(Instruction inst)
|
void |
visit_daload(Instruction inst)
|
void |
visit_dastore(Instruction inst)
|
void |
visit_dcmpg(Instruction inst)
|
void |
visit_dcmpl(Instruction inst)
|
void |
visit_ddiv(Instruction inst)
|
void |
visit_dload(Instruction inst)
|
void |
visit_dmul(Instruction inst)
|
void |
visit_dneg(Instruction inst)
|
void |
visit_drem(Instruction inst)
|
void |
visit_dreturn(Instruction inst)
|
void |
visit_dstore(Instruction inst)
|
void |
visit_dsub(Instruction inst)
|
void |
visit_dup_x1(Instruction inst)
|
void |
visit_dup_x2(Instruction inst)
|
void |
visit_dup(Instruction inst)
When processing the dup instructions one of two situations can occur. |
void |
visit_dup2_x1(Instruction inst)
|
void |
visit_dup2_x2(Instruction inst)
|
void |
visit_dup2(Instruction inst)
|
void |
visit_f2d(Instruction inst)
|
void |
visit_f2i(Instruction inst)
|
void |
visit_f2l(Instruction inst)
|
void |
visit_fadd(Instruction inst)
|
void |
visit_faload(Instruction inst)
|
void |
visit_fastore(Instruction inst)
|
void |
visit_fcmpg(Instruction inst)
|
void |
visit_fcmpl(Instruction inst)
|
void |
visit_fdiv(Instruction inst)
|
void |
visit_fload(Instruction inst)
|
void |
visit_fmul(Instruction inst)
|
void |
visit_fneg(Instruction inst)
|
void |
visit_frem(Instruction inst)
|
void |
visit_freturn(Instruction inst)
|
void |
visit_fstore(Instruction inst)
|
void |
visit_fsub(Instruction inst)
|
void |
visit_getfield(Instruction inst)
Pushes a FieldExpr onto the operand stack. |
void |
visit_getstatic(Instruction inst)
Pushes a StaticFieldExpr onto the operand stack. |
void |
visit_goto(Instruction inst)
Adds a GotoStmt to the statement list. |
void |
visit_i2b(Instruction inst)
|
void |
visit_i2c(Instruction inst)
|
void |
visit_i2d(Instruction inst)
|
void |
visit_i2f(Instruction inst)
|
void |
visit_i2l(Instruction inst)
All cast visitors push a CastExpr onto the operand stack. |
void |
visit_i2s(Instruction inst)
|
void |
visit_iadd(Instruction inst)
All visit_xadd, visit_xsub, visit_xmul, visit_xdiv, etc. |
void |
visit_iaload(Instruction inst)
All visit_xaload push an ArrayRefExpr onto the operand stack. |
void |
visit_iand(Instruction inst)
All visit_x op push an ArithExpr onto the stack. |
void |
visit_iastore(Instruction inst)
|
void |
visit_idiv(Instruction inst)
|
void |
visit_if_acmpeq(Instruction inst)
|
void |
visit_if_acmpne(Instruction inst)
|
void |
visit_if_icmpeq(Instruction inst)
All visit_if_xcmpy add a IfCmpStmt to the statement list. |
void |
visit_if_icmpge(Instruction inst)
|
void |
visit_if_icmpgt(Instruction inst)
|
void |
visit_if_icmple(Instruction inst)
|
void |
visit_if_icmplt(Instruction inst)
|
void |
visit_if_icmpne(Instruction inst)
|
void |
visit_ifeq(Instruction inst)
All visit_xeg add an IfZeroStmt to the statement list. |
void |
visit_ifge(Instruction inst)
|
void |
visit_ifgt(Instruction inst)
|
void |
visit_ifle(Instruction inst)
|
void |
visit_iflt(Instruction inst)
|
void |
visit_ifne(Instruction inst)
|
void |
visit_ifnonnull(Instruction inst)
|
void |
visit_ifnull(Instruction inst)
Both visit_xnull add an IfZeroStmt to the statement list. |
void |
visit_iinc(Instruction inst)
Visiting an iinc involves creating a ConstantExpr, LocalExpr, ArithExpr StoreExpr, and a ExprStmt. |
void |
visit_iload(Instruction inst)
All visit_xload push a LocalExpr onto the operand stack. |
void |
visit_imul(Instruction inst)
|
void |
visit_ineg(Instruction inst)
All visit_xneg push a NegExpr onto the stack. |
void |
visit_instanceof(Instruction inst)
Pushes an InstanceOfExpr onto the operand stack. |
void |
visit_invokeinterface(Instruction inst)
|
void |
visit_invokespecial(Instruction inst)
|
void |
visit_invokestatic(Instruction inst)
|
void |
visit_invokevirtual(Instruction inst)
All visit_invokex deal with a CallMethodExpr or a CallStaticExpr. |
void |
visit_ior(Instruction inst)
|
void |
visit_irem(Instruction inst)
|
void |
visit_ireturn(Instruction inst)
All visit_xreturn add a ReturnExprStmt to the statement list. |
void |
visit_ishl(Instruction inst)
All visit_xshd push a ShiftExpr onto the operand stack. |
void |
visit_ishr(Instruction inst)
|
void |
visit_istore(Instruction inst)
All visit_xstore add a LocalExpr statement to the statement list. |
void |
visit_isub(Instruction inst)
|
void |
visit_iushr(Instruction inst)
|
void |
visit_ixor(Instruction inst)
|
void |
visit_jsr(Instruction inst)
Adds a JsrStmt to the statement list. |
void |
visit_l2d(Instruction inst)
|
void |
visit_l2f(Instruction inst)
|
void |
visit_l2i(Instruction inst)
|
void |
visit_ladd(Instruction inst)
|
void |
visit_laload(Instruction inst)
|
void |
visit_land(Instruction inst)
|
void |
visit_lastore(Instruction inst)
|
void |
visit_lcmp(Instruction inst)
All visit_xcmp push an ArithExpr onto the stack. |
void |
visit_ldc(Instruction inst)
Pushes a ConstantExpr onto the operand stack. |
void |
visit_ldiv(Instruction inst)
|
void |
visit_lload(Instruction inst)
|
void |
visit_lmul(Instruction inst)
|
void |
visit_lneg(Instruction inst)
|
void |
visit_lor(Instruction inst)
|
void |
visit_lrem(Instruction inst)
|
void |
visit_lreturn(Instruction inst)
|
void |
visit_lshl(Instruction inst)
|
void |
visit_lshr(Instruction inst)
|
void |
visit_lstore(Instruction inst)
|
void |
visit_lsub(Instruction inst)
|
void |
visit_lushr(Instruction inst)
|
void |
visit_lxor(Instruction inst)
|
void |
visit_monitorenter(Instruction inst)
Both monitor visitors add a MonitorStmt to the statement list. |
void |
visit_monitorexit(Instruction inst)
|
void |
visit_multianewarray(Instruction inst)
Push a NewMultiArrayExpr onto the operand stack. |
void |
visit_new(Instruction inst)
Pushes a NewExpr onto the operand stack. |
void |
visit_newarray(Instruction inst)
Pushes a NewArrayExpr onto the operand stack. |
void |
visit_nop(Instruction inst)
Adds no statements to the statement list. |
void |
visit_pop(Instruction inst)
Pop the expression off the top of the stack and add it as an ExprStmt to the statement list. |
void |
visit_pop2(Instruction inst)
|
void |
visit_putfield_nowb(Instruction inst)
|
void |
visit_putfield(Instruction inst)
|
void |
visit_putstatic_nowb(Instruction inst)
|
void |
visit_putstatic(Instruction inst)
|
void |
visit_rc(Instruction inst)
Replaces the expression on the top of the stack with an RCExpr. |
void |
visit_ret(Instruction inst)
Adds a RetStmt to the statement list. |
void |
visit_return(Instruction inst)
Adds a ReturnStmt to the statement list. |
void |
visit_saload(Instruction inst)
|
void |
visit_sastore(Instruction inst)
|
void |
visit_supdate(Instruction inst)
Replace the expression at the stack depth specified in the instruction with a UCExpr. |
void |
visit_swap(Instruction inst)
|
void |
visit_switch(Instruction inst)
Add a SwitchStmt to the statement list. |
void |
visit(TreeVisitor visitor)
|
void |
visitForceChildren(TreeVisitor visitor)
Visit all the statements in the statement list. |
| Methods inherited from class EDU.purdue.cs.bloat.tree.Node |
cleanup,
copyInto,
hasParent,
key,
replaceWith,
replaceWith,
setKey,
setParent,
setValueNumber,
valueNumber,
visitChildren,
visitOnly |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Field Detail |
public static boolean DEBUG
public static boolean FLATTEN
public static boolean USE_STACK
public static boolean AUPDATE_FIX_HACK
public static boolean AUPDATE_FIX_HACK_CHANGED
public static boolean USE_PERSISTENT
| Constructor Detail |
public Tree(Block block,
OperandStack predStack)
block - The basic Block of code represented in this Tree.predStack - The contents of the operand stack from the previous basic Block.| Method Detail |
public void cleanupOnly()
public void initLocals(java.util.Collection locals)
LocalExpr,
InitStmtpublic void removeStmt(Stmt stmt)
stmt - The statement to removepublic void removeLastStmt()
public java.util.List stmts()
public Stmt lastStmt()
public OperandStack stack()
public void addStmtAfter(Stmt stmt,
Stmt after)
stmt - The statement to add.after - The statement after which to add stmt.
public void addStmtBefore(Stmt stmt,
Stmt before)
stmt - The statement to insertbefore - The statement before which to add stmt.public void prependStmt(Stmt stmt)
stmt - The statement to add.public void addStmt(Stmt stmt)
stmt - A statement to add to the statement list.public void addStmtBeforeJump(Stmt stmt)
JumpStmt
public void addInstruction(Instruction inst,
Block next)
inst - The instruction to add.next - The basic block after the jump. Remember that a jump ends
a basic block.Instruction.isJsr(),
Instruction.isConditionalJump()public void addInstruction(Instruction inst)
inst - Instruction to add.
public void addInstruction(Instruction inst,
Subroutine sub)
inst - Instruction to add.sub - Subroutine in which inst resides. The ret instruction
always resides in a Subroutine. An astore may store
the return address of a subroutine in a local variable.Instruction.isRet()public void addLabel(Label label)
label - Label to add.public StackExpr newStack(Type type)
public LocalExpr newStackLocal(int index,
Type type)
index - Stack index of variable.type - The type of the LocalExpr
public LocalExpr newLocal(int index,
Type type)
index - Stack index of variable.type - The type of the LocalExprpublic LocalExpr newLocal(Type type)
type - The type of the new LocalExpr.public java.lang.String toString()
public void visit_nop(Instruction inst)
public void visit_ldc(Instruction inst)
ConstantExprpublic void visit_iload(Instruction inst)
LocalExprpublic void visit_lload(Instruction inst)
public void visit_fload(Instruction inst)
public void visit_dload(Instruction inst)
public void visit_aload(Instruction inst)
public void visit_iaload(Instruction inst)
public void visit_laload(Instruction inst)
public void visit_faload(Instruction inst)
public void visit_daload(Instruction inst)
public void visit_aaload(Instruction inst)
public void visit_baload(Instruction inst)
public void visit_caload(Instruction inst)
public void visit_saload(Instruction inst)
public void visit_istore(Instruction inst)
public void visit_lstore(Instruction inst)
public void visit_fstore(Instruction inst)
public void visit_dstore(Instruction inst)
public void visit_astore(Instruction inst)
AddressStoreStmt,
LocalExpr,
StoreExprpublic void visit_iastore(Instruction inst)
public void visit_lastore(Instruction inst)
public void visit_fastore(Instruction inst)
public void visit_dastore(Instruction inst)
public void visit_aastore(Instruction inst)
public void visit_bastore(Instruction inst)
public void visit_castore(Instruction inst)
public void visit_sastore(Instruction inst)
public void visit_pop(Instruction inst)
ExprStmtpublic void visit_pop2(Instruction inst)
public void visit_dup(Instruction inst)
LocalExpr,
StackExpr,
StackManipStmtpublic void visit_dup_x1(Instruction inst)
public void visit_dup_x2(Instruction inst)
public void visit_dup2(Instruction inst)
public void visit_dup2_x1(Instruction inst)
public void visit_dup2_x2(Instruction inst)
public void visit_swap(Instruction inst)
public void visit_iadd(Instruction inst)
ArithExprpublic void visit_ladd(Instruction inst)
public void visit_fadd(Instruction inst)
public void visit_dadd(Instruction inst)
public void visit_isub(Instruction inst)
public void visit_lsub(Instruction inst)
public void visit_fsub(Instruction inst)
public void visit_dsub(Instruction inst)
public void visit_imul(Instruction inst)
public void visit_lmul(Instruction inst)
public void visit_fmul(Instruction inst)
public void visit_dmul(Instruction inst)
public void visit_idiv(Instruction inst)
public void visit_ldiv(Instruction inst)
public void visit_fdiv(Instruction inst)
public void visit_ddiv(Instruction inst)
public void visit_irem(Instruction inst)
public void visit_lrem(Instruction inst)
public void visit_frem(Instruction inst)
public void visit_drem(Instruction inst)
public void visit_ineg(Instruction inst)
NegExprpublic void visit_lneg(Instruction inst)
public void visit_fneg(Instruction inst)
public void visit_dneg(Instruction inst)
public void visit_ishl(Instruction inst)
ShiftExprpublic void visit_lshl(Instruction inst)
public void visit_ishr(Instruction inst)
public void visit_lshr(Instruction inst)
public void visit_iushr(Instruction inst)
public void visit_lushr(Instruction inst)
public void visit_iand(Instruction inst)
ArithExprpublic void visit_land(Instruction inst)
public void visit_ior(Instruction inst)
public void visit_lor(Instruction inst)
public void visit_ixor(Instruction inst)
public void visit_lxor(Instruction inst)
public void visit_iinc(Instruction inst)
public void visit_i2l(Instruction inst)
public void visit_i2f(Instruction inst)
public void visit_i2d(Instruction inst)
public void visit_l2i(Instruction inst)
public void visit_l2f(Instruction inst)
public void visit_l2d(Instruction inst)
public void visit_f2i(Instruction inst)
public void visit_f2l(Instruction inst)
public void visit_f2d(Instruction inst)
public void visit_d2i(Instruction inst)
public void visit_d2l(Instruction inst)
public void visit_d2f(Instruction inst)
public void visit_i2b(Instruction inst)
public void visit_i2c(Instruction inst)
public void visit_i2s(Instruction inst)
public void visit_lcmp(Instruction inst)
ArithExprpublic void visit_fcmpl(Instruction inst)
public void visit_fcmpg(Instruction inst)
public void visit_dcmpl(Instruction inst)
public void visit_dcmpg(Instruction inst)
public void visit_ifeq(Instruction inst)
IfZeroStmtpublic void visit_ifne(Instruction inst)
public void visit_iflt(Instruction inst)
public void visit_ifge(Instruction inst)
public void visit_ifgt(Instruction inst)
public void visit_ifle(Instruction inst)
public void visit_if_icmpeq(Instruction inst)
public void visit_if_icmpne(Instruction inst)
public void visit_if_icmplt(Instruction inst)
public void visit_if_icmpge(Instruction inst)
public void visit_if_icmpgt(Instruction inst)
public void visit_if_icmple(Instruction inst)
public void visit_if_acmpeq(Instruction inst)
public void visit_if_acmpne(Instruction inst)
public void visit_goto(Instruction inst)
GotoStmtpublic void visit_jsr(Instruction inst)
JsrStmtpublic void visit_ret(Instruction inst)
RetStmtpublic void visit_switch(Instruction inst)
SwitchStmtpublic void visit_ireturn(Instruction inst)
ReturnExprStmtpublic void visit_lreturn(Instruction inst)
public void visit_freturn(Instruction inst)
public void visit_dreturn(Instruction inst)
public void visit_areturn(Instruction inst)
public void visit_return(Instruction inst)
public void visit_getstatic(Instruction inst)
public void visit_putstatic(Instruction inst)
public void visit_putstatic_nowb(Instruction inst)
public void visit_getfield(Instruction inst)
public void visit_putfield(Instruction inst)
public void visit_putfield_nowb(Instruction inst)
public void visit_invokevirtual(Instruction inst)
CallMethodExpr,
CallStaticExprpublic void visit_invokespecial(Instruction inst)
public void visit_invokestatic(Instruction inst)
public void visit_invokeinterface(Instruction inst)
public void visit_new(Instruction inst)
NewExprpublic void visit_newarray(Instruction inst)
public void visit_arraylength(Instruction inst)
ArrayLengthExprpublic void visit_athrow(Instruction inst)
ThrowStmtpublic void visit_checkcast(Instruction inst)
CastExprpublic void visit_instanceof(Instruction inst)
InstanceOfExprpublic void visit_monitorenter(Instruction inst)
MonitorStmtpublic void visit_monitorexit(Instruction inst)
public void visit_multianewarray(Instruction inst)
NewMultiArrayExprpublic void visit_ifnull(Instruction inst)
public void visit_ifnonnull(Instruction inst)
public void visit_rc(Instruction inst)
RCExprpublic void visit_aupdate(Instruction inst)
public void visit_supdate(Instruction inst)
UCExprpublic void visit_aswizzle(Instruction inst)
SCStmtpublic void visit_aswrange(Instruction inst)
SRStmtpublic void visitForceChildren(TreeVisitor visitor)
public void visit(TreeVisitor visitor)
public Node parent()
public Block block()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||