|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object avrora.core.ControlFlowGraph.Block
The Block
class represents a basic block of code within the program. A basic block
contains a straight-line piece of code that ends with a control instruction (e.g. a skip, a jump, a
branch, or a call) or an implicit fall-through to the next basic block. It contains at most two
references to successor basic blocks.
next
field refers to the
block immediately following this block, and the other
field is null.
For jumps, the other
field refers to the block that is the target of the jump, and
the next
field is null.
For skips, branches, and calls, the next
field refers to the block
immediately following this block (i.e. not-taken for branches, the return address for calls). The
other
field refers to the target address of the branch if it is taken or the address to be
called.
For indirect jumps both the next
and other
fields are null.
For indirect calls the next
field refers to the block immediately following this
block (i.e. the return address). The other
field is null because the target of the call
cannot be known.
Method Summary | |
void |
addInstr(Instr i)
The addInstr() method adds an instruction to the end of this basic block. |
boolean |
equals(java.lang.Object o)
The equals() method computes object equality for basic blocks. |
int |
getAddress()
The getAddress() method gets the starting byte address of this basic block. |
java.util.Iterator |
getEdgeIterator()
|
java.util.Iterator |
getInstrIterator()
The getInstrIterator() method returns an iterator over the instructions in this basic
block. |
int |
getLastAddress()
The getLastAddress() gets the last address that this block covers. |
int |
getLength()
The getLength() returns the length of this basic block in terms of the number of
instructions |
int |
getSize()
The getSize() method returns the size of the basic block in bytes. |
int |
hashCode()
The hashCode() method computes the hash code of this block. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public void addInstr(Instr i)
addInstr()
method adds an instruction to the end of this basic block. It is not
recommended for general use: it is generally used by the CFGBuilder
class. No
enforcement of invariants is made: this method does not check whether the instruction being added
changes the control flow or branches to another block, etc.
i
- the instruction to add to this basic blockpublic int hashCode()
hashCode()
method computes the hash code of this block. In the initial
implementation, the hash code is simply the byte address of the block
public boolean equals(java.lang.Object o)
equals()
method computes object equality for basic blocks. It simply compares the
addresses of the basic blocks and returns true if they match.
o
- the other object to compare to
public int getAddress()
getAddress()
method gets the starting byte address of this basic block.
public int getLastAddress()
getLastAddress()
gets the last address that this block covers.
public int getSize()
getSize()
method returns the size of the basic block in bytes.
public int getLength()
getLength()
returns the length of this basic block in terms of the number of
instructions
public java.util.Iterator getInstrIterator()
getInstrIterator()
method returns an iterator over the instructions in this basic
block. The resulting iterator can be used to iterate over the instructions in the basic block in
order.
public java.util.Iterator getEdgeIterator()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |