net.sf.jode.flow
Class InstructionBlock

java.lang.Object
  extended by net.sf.jode.flow.StructuredBlock
      extended by net.sf.jode.flow.InstructionContainer
          extended by net.sf.jode.flow.InstructionBlock

public class InstructionBlock
extends InstructionContainer

This is the structured block for atomic instructions.


Constructor Summary
InstructionBlock(Expression instr)
           
InstructionBlock(Instruction bytecodeInstr, Expression instr)
           
 
Method Summary
 void checkDeclaration(Set declareSet)
          Check if this is an local store instruction to a not yet declared variable.
 void dumpInstruction(TabbedPrintWriter writer)
          Print the instruction expressing this structured block.
 void makeDeclaration(Set done)
          Make the declarations, i.e.
 VariableStack mapStackToLocal(VariableStack stack)
          This does take the instr into account and modifies stack accordingly.
 boolean needsBraces()
          Tells if this block needs braces when used in a if or while block.
 void removePush()
          This is called after mapStackToLocal to do the stack to local transformation.
 
Methods inherited from class net.sf.jode.flow.InstructionContainer
doTransformations, fillInGenSet, getDeclarables, getInstruction, removeOnetimeLocals, setInstruction, simplify
 
Methods inherited from class net.sf.jode.flow.StructuredBlock
appendBlock, checkConsistent, contains, copyJump, dumpSource, flowMayBeChanged, getBCELInstructions, getBytecodeInstructions, getNextBlock, getNextBlock, getNextFlowBlock, getNextFlowBlock, getSubBlocks, isEmpty, isSingleExit, jumpMayBeChanged, moveJump, prependBlock, propagateUsage, removeBlock, removeJump, replace, replaceSubBlock, setFlowBlock, setJump, setSuccessors, swapJump, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InstructionBlock

public InstructionBlock(Expression instr)

InstructionBlock

public InstructionBlock(Instruction bytecodeInstr,
                        Expression instr)
Method Detail

mapStackToLocal

public VariableStack mapStackToLocal(VariableStack stack)
This does take the instr into account and modifies stack accordingly. It then calls super.mapStackToLocal.

Overrides:
mapStackToLocal in class StructuredBlock
Parameters:
stack - the stack before the instruction is called
Returns:
stack the stack afterwards.

removePush

public void removePush()
Description copied from class: StructuredBlock
This is called after mapStackToLocal to do the stack to local transformation.

Overrides:
removePush in class StructuredBlock

needsBraces

public boolean needsBraces()
Tells if this block needs braces when used in a if or while block.

Overrides:
needsBraces in class StructuredBlock
Returns:
true if this block should be sorrounded by braces.

checkDeclaration

public void checkDeclaration(Set declareSet)
Check if this is an local store instruction to a not yet declared variable. In that case mark this as declaration and return the variable.


makeDeclaration

public void makeDeclaration(Set done)
Make the declarations, i.e. initialize the declare variable to correct values. This will declare every variable that is marked as used, but not done.

Overrides:
makeDeclaration in class InstructionContainer
Parameters:
done - The set of the already declare variables.

dumpInstruction

public void dumpInstruction(TabbedPrintWriter writer)
                     throws IOException
Description copied from class: StructuredBlock
Print the instruction expressing this structured block.

Specified by:
dumpInstruction in class StructuredBlock
Parameters:
writer - The tabbed print writer, where we print to.
Throws:
IOException