| Modifier and Type | Class and Description |
|---|---|
| private static class | DeadCodeRemover.
A callback class used to build up the initial worklist of registers defined by an instruction with no side effect. |
| Modifier and Type | Field and Description |
|---|---|
| private final int | regCount
ssaMeth.getRegCount() |
| private final SsaMethod | ssaMeth
method we're processing |
| private final ArrayList | useList
use list indexed by register; modified during operation |
| private final BitSet | worklist
indexed by register: whether reg should be examined (does it correspond to a no-side-effect insn?) |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private static boolean | Returns: true if it has a side-effectnull-ok; instruction in questionReturns true if this insn has a side-effect. |
| private boolean | Returns: true if usage is circular without side effectregister to examine regV, BitSet a set of registers that we've already determined
are only used as sources in operations with no side effect or null
if this is the first recursion set)Returns true if the only uses of this register form a circle of operations with no side effects. |
| public static void | |
| private void | |
| private void |
| regCount | back to summary |
|---|---|
| private final int regCount ssaMeth.getRegCount() | |
| ssaMeth | back to summary |
|---|---|
| private final SsaMethod ssaMeth method we're processing | |
| useList | back to summary |
|---|---|
| private final ArrayList<SsaInsn>[] useList use list indexed by register; modified during operation | |
| worklist | back to summary |
|---|---|
| private final BitSet worklist indexed by register: whether reg should be examined (does it correspond to a no-side-effect insn?) | |
| DeadCodeRemover | back to summary |
|---|---|
| private DeadCodeRemover(SsaMethod ssaMethod) Constructs an instance.
| |
| hasSideEffect | back to summary |
|---|---|
| private static boolean hasSideEffect(SsaInsn insn) Returns true if this insn has a side-effect. Returns true if the insn is null for reasons stated in the code block.
| |
| isCircularNoSideEffect | back to summary |
|---|---|
| private boolean isCircularNoSideEffect(int regV, BitSet set) Returns true if the only uses of this register form a circle of operations with no side effects.
| |
| process | back to summary |
|---|---|
| public static void process(SsaMethod ssaMethod) Process a method with the dead-code remver
| |
| pruneDeadInstructions | back to summary |
|---|---|
| private void pruneDeadInstructions() Removes all instructions from every unreachable block. | |
| run | back to summary |
|---|---|
| private void run() Runs the dead code remover. | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv BitSet |
| Access | Constructor and Description |
|---|---|
| public | NoSideEffectVisitor(BitSet
to-build bitset of regs that are
results of regs with no side effects noSideEffectRegs)Passes in data structures that will be filled out after ssaMeth.forEachInsn() is called with this instance. |
| Modifier and Type | Method and Description |
|---|---|
| public void | visitMoveInsn(NormalSsaInsn
non-null; the instruction to visitImplements org. |
| public void | visitNonMoveInsn(NormalSsaInsn
non-null; the instruction to visitImplements org. |
| public void | visitPhiInsn(PhiInsn
non-null; the instruction to visitImplements org. |
| noSideEffectRegs | back to summary |
|---|---|
| pack-priv BitSet noSideEffectRegs | |
| NoSideEffectVisitor | back to summary |
|---|---|
| public NoSideEffectVisitor(BitSet noSideEffectRegs) Passes in data structures that will be filled out after ssaMeth.forEachInsn() is called with this instance.
| |
| visitMoveInsn | back to summary |
|---|---|
| public void visitMoveInsn(NormalSsaInsn insn) Implements org. Doc from org. Any non-phi move instruction
| |
| visitNonMoveInsn | back to summary |
|---|---|
| public void visitNonMoveInsn(NormalSsaInsn insn) Implements org. Doc from org. Any insn that isn't a move or a phi (which is also a move).
| |
| visitPhiInsn | back to summary |
|---|---|
| public void visitPhiInsn(PhiInsn phi) Implements org. Doc from org. Any phi insn
| |