com.togethersoft.sca.dataflow.flowgraph
Interface ITuple

All Superinterfaces:
AstSourcePosition

public interface ITuple
extends AstSourcePosition

Instruction for intermediate representation


Field Summary
static int ADD
          res = op1 + op2
static int ASG
          res = op1
static int ASSUME
          Special pseudo-tuple meaning that condition specified as the operand is assumed to be true<\code>.
static int BAND
          res = op1 & op2
static int BOR
          res = op1 | op2
static int BXOR
          res = op1 ^ op2
static int CALL
          res = op1(op2, ..., opN)
static int CAST
          res = (op1)op2
static int COM
          res = ~op1
static int DEC
          res = --op1
static int DIV
          res = op1 / op2
static int EQ
          res = op1 == op2
static int GE
          res = op1 >= op2
static int GOTO
          unconditional transfer of control goto [lab1]
static int GT
          res = op1 > op2
static int IDX
          res = op1[op2]
static int IF
          conditional control transfer if op1 then goto target[0] else goto target[1]
static int INC
          res = ++op1
static int INIT
          Pseudo tuple, initializing variable (used to init method parameters, and exceptions in handlers) res =
static int IOF
          res = op1 instanceof op2
static int LABEL
          target for control transfer
static int LE
          res = op1 <= op2
static int LENGTH
          op1.length (op1 is assumed to be array type)
static int LT
          res = op1 < op2
static int MBR
          res = op1.op2
static int MOD
          res = op1 % op2
static int MUL
          res = op0 * op2
static int NE
          res = op1 != op2
static int NEG
          res = -op1
static int NEW
          res = new (op1, ....
static int NEWARR
          res = new [op1]...[opN] (operands are optional)
static int NOP
          The NO operation tuple
static int NOT
          res = !op1
static int PGOTO
          Possible goto (used in representation of dataflow for exception handling)
static int PHI
          Phi function (used in SSA ad SSI)
static int REQUIRE
          Special pseudo-tuple meaning that condition specified as the operand is required to be true<\code>.
static int RETURN
          return from method return or return op1;
static int RHO
          Rho function (used in SSI)
static int SL
          res = op1 << op2
static int SR
          res = op1 >> op2
static int SUB
          res = op1 - op2
static int SWITCH
          switch statement ...
static int SYNC
          Synchronization primitive
static int THROW
          throw op1
static int UPL
          res = +op1
static int USR
          res = op1 >>> op2
 
Method Summary
 IBasicBlock basicBlock()
          returns the basic block, this tuple belongs to
 AstObject getAstObject()
          Obtain an associated AstObject, for which the tuple was generated returns null if no AstObject is associated.
 int getCode()
          Get instruction type
 ITuple getNext()
          Get next tuple in the list of all items
 ITuple getPrev()
          Get previous tuple in the list of all items
 int getTupleId()
          Get unique tuple id
 AstTypeReference getTypeReference()
          Get front end type reference for result value.
 boolean hasSideEffect()
          does the tuple may produce any side effect.
 void insertAfter(ITuple prevTuple)
          insert tuple after prevTuple tuple
 boolean isAssertGenerated()
          is the tuple generated from assertion-like code
 boolean isConstant()
          Returns true if this tuple represents a compile-time constant expression, false otherwise.
 boolean isTarget()
          tells if the current instruction can be target of control flow transfer
 boolean isUsed()
          is the result of this tuple used.
 java.lang.String mnemo()
          Returns string with mnemonic name for this tuple
 int nOperands()
          Get number of operands of this tuple
 IVal operand(int operandNumber)
          Get argument with number i.
 IVal[] operands()
          Get array of argument value nodes for the tuple For tuples, that take no argument, returns null
 IVar[][] operandsSymbolicValues()
          get access to all information on operands symbolic values returns null if no such information is available
 IVar operandSymbolicValue(int operandNumber, int valueNumber)
          get access to specific symbolic value for a specific operand returns null if no such information is available
 IVar[] operandSymbolicValues(int operandNumber)
          get access to all information on symbolic values for a specific operand returns null if no such information is available
 com.togethersoft.sca.dataflow.values.IValueDomain operandValue(int operandNumber)
          Get calculated value domain for tuple operand.
 com.togethersoft.sca.dataflow.values.IValueDomain[] operandValues()
          Get array of all calculated value domains for a tuple.
 void print(java.io.PrintStream out)
          Print information about current tuple (for debugging purpose)
 void removeFromList()
          Remove this tuple from list
 IVar result()
          Get variable holding result of tuple For tuples, that produce no value, returns null
 com.togethersoft.sca.dataflow.values.IValueDomain resultValue()
          Get calculated value domain for tuple result.
 ITuple target(int targetNumber)
          Return target with specified number For tuples, that do no branching, returns null
 ITuple[] targets()
          Return array of branch targets For tuples, that do no branching, returns null
 boolean transfersControl()
          tells if the current tuple can transfer control to instruction other than next instruction
 
Methods inherited from interface com.togethersoft.sca.ast.AstSourcePosition
getEndColumn, getEndLine, getFileName, getOffset, getStartColumn, getStartLine
 

Field Detail

ADD

public static final int ADD
res = op1 + op2

ASG

public static final int ASG
res = op1

ASSUME

public static final int ASSUME
Special pseudo-tuple meaning that condition specified as the operand is assumed to be true<\code>. For example as result of design by contract @ pre<\code> statement. ASSUME op0<\code>

BAND

public static final int BAND
res = op1 & op2

BOR

public static final int BOR
res = op1 | op2

BXOR

public static final int BXOR
res = op1 ^ op2

CALL

public static final int CALL
res = op1(op2, ..., opN)

CAST

public static final int CAST
res = (op1)op2

COM

public static final int COM
res = ~op1

DEC

public static final int DEC
res = --op1

DIV

public static final int DIV
res = op1 / op2

EQ

public static final int EQ
res = op1 == op2

GE

public static final int GE
res = op1 >= op2

GOTO

public static final int GOTO
unconditional transfer of control goto [lab1]

GT

public static final int GT
res = op1 > op2

IDX

public static final int IDX
res = op1[op2]

IF

public static final int IF
conditional control transfer if op1 then goto target[0] else goto target[1]

INC

public static final int INC
res = ++op1

INIT

public static final int INIT
Pseudo tuple, initializing variable (used to init method parameters, and exceptions in handlers) res =

IOF

public static final int IOF
res = op1 instanceof op2

LABEL

public static final int LABEL
target for control transfer

LE

public static final int LE
res = op1 <= op2

LENGTH

public static final int LENGTH
op1.length (op1 is assumed to be array type)

LT

public static final int LT
res = op1 < op2

MBR

public static final int MBR
res = op1.op2

MOD

public static final int MOD
res = op1 % op2

MUL

public static final int MUL
res = op0 * op2

NE

public static final int NE
res = op1 != op2

NEG

public static final int NEG
res = -op1

NEW

public static final int NEW
res = new (op1, .... opN) (operands are optional)

NEWARR

public static final int NEWARR
res = new [op1]...[opN] (operands are optional)

NOP

public static final int NOP
The NO operation tuple

NOT

public static final int NOT
res = !op1

PGOTO

public static final int PGOTO
Possible goto (used in representation of dataflow for exception handling)

PHI

public static final int PHI
Phi function (used in SSA ad SSI)

REQUIRE

public static final int REQUIRE
Special pseudo-tuple meaning that condition specified as the operand is required to be true<\code>. For example as result of design by contract @ post<\code> statement. REQUIRE op0<\code>

RETURN

public static final int RETURN
return from method return or return op1;

RHO

public static final int RHO
Rho function (used in SSI)

SL

public static final int SL
res = op1 << op2

SR

public static final int SR
res = op1 >> op2

SUB

public static final int SUB
res = op1 - op2

SWITCH

public static final int SWITCH
switch statement ... ...

SYNC

public static final int SYNC
Synchronization primitive

THROW

public static final int THROW
throw op1

UPL

public static final int UPL
res = +op1

USR

public static final int USR
res = op1 >>> op2
Method Detail

basicBlock

public IBasicBlock basicBlock()
returns the basic block, this tuple belongs to

getAstObject

public AstObject getAstObject()
Obtain an associated AstObject, for which the tuple was generated returns null if no AstObject is associated. (This may happen only for methods which are generated from bytecode)

getCode

public int getCode()
Get instruction type

getNext

public ITuple getNext()
Get next tuple in the list of all items

getPrev

public ITuple getPrev()
Get previous tuple in the list of all items

getTupleId

public int getTupleId()
Get unique tuple id

getTypeReference

public AstTypeReference getTypeReference()
Get front end type reference for result value. will return null<\code> for tuples which produce no value and for tuples which are associated with ill-formed ASTs, and for tuples generated from bytecode

hasSideEffect

public boolean hasSideEffect()
does the tuple may produce any side effect.

insertAfter

public void insertAfter(ITuple prevTuple)
insert tuple after prevTuple tuple

isAssertGenerated

public boolean isAssertGenerated()
is the tuple generated from assertion-like code
Returns:
true iff the tuple was marked as generated for assert type pseudocomment

isConstant

public boolean isConstant()
Returns true if this tuple represents a compile-time constant expression, false otherwise. For definition of compile-time constant expressions see JLS Section 5.28.

isTarget

public boolean isTarget()
tells if the current instruction can be target of control flow transfer

isUsed

public boolean isUsed()
is the result of this tuple used. This value is set by the doDeadAssignmentDetection method of Data Flow Graph. if the result of this method is false, then the local variable changed by the tuple is not used after this tuple was executed

mnemo

public java.lang.String mnemo()
Returns string with mnemonic name for this tuple

nOperands

public int nOperands()
Get number of operands of this tuple
Returns:
integer > 0 --- number of operands of the tuple

operand

public IVal operand(int operandNumber)
Get argument with number i.

operands

public IVal[] operands()
Get array of argument value nodes for the tuple For tuples, that take no argument, returns null

operandsSymbolicValues

public IVar[][] operandsSymbolicValues()
get access to all information on operands symbolic values returns null if no such information is available

operandSymbolicValue

public IVar operandSymbolicValue(int operandNumber,
                                 int valueNumber)
get access to specific symbolic value for a specific operand returns null if no such information is available

operandSymbolicValues

public IVar[] operandSymbolicValues(int operandNumber)
get access to all information on symbolic values for a specific operand returns null if no such information is available

operandValue

public com.togethersoft.sca.dataflow.values.IValueDomain operandValue(int operandNumber)
Get calculated value domain for tuple operand. May return null if dataflow analysis was not performed for this tuple

operandValues

public com.togethersoft.sca.dataflow.values.IValueDomain[] operandValues()
Get array of all calculated value domains for a tuple. May return null if tuple has no arguments, (like LABEL and GOTO) or if values where not computed yet. The values are normally computed not at the tuple creation time, but during dataflow analysis phase.

print

public void print(java.io.PrintStream out)
Print information about current tuple (for debugging purpose)
Parameters:
out - -- stream on which to print the information

removeFromList

public void removeFromList()
Remove this tuple from list

result

public IVar result()
Get variable holding result of tuple For tuples, that produce no value, returns null

resultValue

public com.togethersoft.sca.dataflow.values.IValueDomain resultValue()
Get calculated value domain for tuple result. May return null for Tuples which do not produce any values or if dataflow analysis was not performed for this tuple

target

public ITuple target(int targetNumber)
Return target with specified number For tuples, that do no branching, returns null

targets

public ITuple[] targets()
Return array of branch targets For tuples, that do no branching, returns null

transfersControl

public boolean transfersControl()
tells if the current tuple can transfer control to instruction other than next instruction