public abstract class BranchSimplifier extends Object
This module performs no analysis, it simply attempts to simplify any branching instructions of a basic block that have constant operands. The intent is that analysis modules can call this transformation engine, allowing us to share the simplification code among multiple analysis modules.
Constructor and Description |
---|
BranchSimplifier() |
Modifier and Type | Method and Description |
---|---|
private static void |
insertTrueGuard(Instruction inst,
RegisterOperand guard) |
(package private) static boolean |
processIfCmp(IR ir,
BasicBlock bb,
Instruction s) |
(package private) static boolean |
processIfCmp2(IR ir,
BasicBlock bb,
Instruction s) |
(package private) static boolean |
processInlineGuard(IR ir,
BasicBlock bb,
Instruction s) |
(package private) static boolean |
processLookupSwitch(IR ir,
BasicBlock bb,
Instruction s) |
(package private) static boolean |
processTableSwitch(IR ir,
BasicBlock bb,
Instruction s) |
private static void |
removeBranchesAfterGotos(BasicBlock bb)
To maintain IR integrity, remove any branches that are after the
first GOTO in the basic block.
|
static boolean |
simplify(BasicBlock bb,
IR ir)
Given a basic block, attempt to simplify any conditional branch
instructions with constant operands.
|
public BranchSimplifier()
public static boolean simplify(BasicBlock bb, IR ir)
bb
- the basic block to simplifyir
- the governing IRtrue
if we do something, false
otherwise.static boolean processIfCmp(IR ir, BasicBlock bb, Instruction s)
static boolean processIfCmp2(IR ir, BasicBlock bb, Instruction s)
static boolean processLookupSwitch(IR ir, BasicBlock bb, Instruction s)
static boolean processTableSwitch(IR ir, BasicBlock bb, Instruction s)
static boolean processInlineGuard(IR ir, BasicBlock bb, Instruction s)
private static void removeBranchesAfterGotos(BasicBlock bb)
bb
- the block to search for gotosprivate static void insertTrueGuard(Instruction inst, RegisterOperand guard)