public static SsaMethod debugRenaming(RopMethod rmeth, int paramWidth, boolean isStatic, boolean inPreserveLocals, TranslationAdvice inAdvice) { preserveLocals = inPreserveLocals; advice = inAdvice; return SsaConverter.convertToSsaMethod(rmeth, paramWidth, isStatic); }
/** * See Appel section 19.1: * * Converts CFG into "edge-split" form, such that each node either a * unique successor or unique predecessor.<p> * * In addition, the SSA form we use enforces a further constraint, * requiring each block with a final instruction that returns a * value to have a primary successor that has no other * predecessor. This ensures move statements can always be * inserted correctly when phi statements are removed. * * @param result method to process */ private static void edgeSplit(SsaMethod result) { edgeSplitPredecessors(result); edgeSplitMoveExceptionsAndResults(result); edgeSplitSuccessors(result); }
public static SsaMethod debugEdgeSplit(RopMethod rmeth, int paramWidth, boolean isStatic, boolean inPreserveLocals, TranslationAdvice inAdvice) { preserveLocals = inPreserveLocals; advice = inAdvice; return SsaConverter.testEdgeSplit(rmeth, paramWidth, isStatic); }
/** * Returns an SSA represention with only the steps through the * phi placement run. * * @param rmeth method to process * @param paramWidth width of all arguments in the method * @param isStatic {@code true} if this method has no {@code this} * pointer argument * @return an SSA represention with only the edge-splitter run */ public static SsaMethod testPhiPlacement (RopMethod rmeth, int paramWidth, boolean isStatic) { SsaMethod result; result = SsaMethod.newFromRopMethod(rmeth, paramWidth, isStatic); edgeSplit(result); LocalVariableInfo localInfo = LocalVariableExtractor.extract(result); placePhiFunctions(result, localInfo, 0); return result; }
/** * Inserts Z nodes as new predecessors for every node that has multiple * successors and multiple predecessors. * * @param result {@code non-null;} method to process */ private static void edgeSplitPredecessors(SsaMethod result) { ArrayList<SsaBasicBlock> blocks = result.getBlocks(); /* * New blocks are added to the end of the block list during * this iteration. */ for (int i = blocks.size() - 1; i >= 0; i-- ) { SsaBasicBlock block = blocks.get(i); if (nodeNeedsUniquePredecessor(block)) { block.insertNewPredecessor(); } } }
/** * Inserts Z nodes for every node that needs a new * successor. * * @param result {@code non-null;} method to process */ private static void edgeSplitSuccessors(SsaMethod result) { ArrayList<SsaBasicBlock> blocks = result.getBlocks(); /* * New blocks are added to the end of the block list during * this iteration. */ for (int i = blocks.size() - 1; i >= 0; i-- ) { SsaBasicBlock block = blocks.get(i); // Successors list is modified in loop below. BitSet successors = (BitSet)block.getSuccessors().clone(); for (int j = successors.nextSetBit(0); j >= 0; j = successors.nextSetBit(j+1)) { SsaBasicBlock succ = blocks.get(j); if (needsNewSuccessor(block, succ)) { block.insertNewSuccessor(succ); } } } }
/** * Updates an SSA representation, placing phi functions and renaming all * registers above a certain threshold number. * * @param ssaMeth input * @param threshold registers below this number are unchanged */ public static void updateSsaMethod(SsaMethod ssaMeth, int threshold) { LocalVariableInfo localInfo = LocalVariableExtractor.extract(ssaMeth); placePhiFunctions(ssaMeth, localInfo, threshold); new SsaRenamer(ssaMeth, threshold).run(); }
/** * Returns an SSA represention with only the edge-splitter run. * * @param rmeth method to process * @param paramWidth width of all arguments in the method * @param isStatic {@code true} if this method has no {@code this} * pointer argument * @return an SSA represention with only the edge-splitter run */ public static SsaMethod testEdgeSplit (RopMethod rmeth, int paramWidth, boolean isStatic) { SsaMethod result; result = SsaMethod.newFromRopMethod(rmeth, paramWidth, isStatic); edgeSplit(result); return result; }
public static SsaMethod debugPhiPlacement(RopMethod rmeth, int paramWidth, boolean isStatic, boolean inPreserveLocals, TranslationAdvice inAdvice) { preserveLocals = inPreserveLocals; advice = inAdvice; return SsaConverter.testPhiPlacement(rmeth, paramWidth, isStatic); }
/** * Returns an SSA represention with only the steps through the * phi placement run. * * @param rmeth method to process * @param paramWidth width of all arguments in the method * @param isStatic {@code true} if this method has no {@code this} * pointer argument * @return an SSA represention with only the edge-splitter run */ public static SsaMethod testPhiPlacement (RopMethod rmeth, int paramWidth, boolean isStatic) { SsaMethod result; result = SsaMethod.newFromRopMethod(rmeth, paramWidth, isStatic); edgeSplit(result); LocalVariableInfo localInfo = LocalVariableExtractor.extract(result); placePhiFunctions(result, localInfo, 0); return result; }
/** * Inserts Z nodes as new predecessors for every node that has multiple * successors and multiple predecessors. * * @param result {@code non-null;} method to process */ private static void edgeSplitPredecessors(SsaMethod result) { ArrayList<SsaBasicBlock> blocks = result.getBlocks(); /* * New blocks are added to the end of the block list during * this iteration. */ for (int i = blocks.size() - 1; i >= 0; i-- ) { SsaBasicBlock block = blocks.get(i); if (nodeNeedsUniquePredecessor(block)) { block.insertNewPredecessor(); } } }
/** * Inserts Z nodes for every node that needs a new * successor. * * @param result {@code non-null;} method to process */ private static void edgeSplitSuccessors(SsaMethod result) { ArrayList<SsaBasicBlock> blocks = result.getBlocks(); /* * New blocks are added to the end of the block list during * this iteration. */ for (int i = blocks.size() - 1; i >= 0; i-- ) { SsaBasicBlock block = blocks.get(i); // Successors list is modified in loop below. BitSet successors = (BitSet)block.getSuccessors().clone(); for (int j = successors.nextSetBit(0); j >= 0; j = successors.nextSetBit(j+1)) { SsaBasicBlock succ = blocks.get(j); if (needsNewSuccessor(block, succ)) { block.insertNewSuccessor(succ); } } } }
/** * Updates an SSA representation, placing phi functions and renaming all * registers above a certain threshold number. * * @param ssaMeth input * @param threshold registers below this number are unchanged */ public static void updateSsaMethod(SsaMethod ssaMeth, int threshold) { LocalVariableInfo localInfo = LocalVariableExtractor.extract(ssaMeth); placePhiFunctions(ssaMeth, localInfo, threshold); new SsaRenamer(ssaMeth, threshold).run(); }
/** * Returns an SSA represention with only the edge-splitter run. * * @param rmeth method to process * @param paramWidth width of all arguments in the method * @param isStatic {@code true} if this method has no {@code this} * pointer argument * @return an SSA represention with only the edge-splitter run */ public static SsaMethod testEdgeSplit (RopMethod rmeth, int paramWidth, boolean isStatic) { SsaMethod result; result = SsaMethod.newFromRopMethod(rmeth, paramWidth, isStatic); edgeSplit(result); return result; }
public static SsaMethod debugPhiPlacement(RopMethod rmeth, int paramWidth, boolean isStatic, boolean inPreserveLocals, TranslationAdvice inAdvice) { preserveLocals = inPreserveLocals; advice = inAdvice; return SsaConverter.testPhiPlacement(rmeth, paramWidth, isStatic); }
/** * See Appel section 19.1: * * Converts CFG into "edge-split" form, such that each node either a * unique successor or unique predecessor.<p> * * In addition, the SSA form we use enforces a further constraint, * requiring each block with a final instruction that returns a * value to have a primary successor that has no other * predecessor. This ensures move statements can always be * inserted correctly when phi statements are removed. * * @param result method to process */ private static void edgeSplit(SsaMethod result) { edgeSplitPredecessors(result); edgeSplitMoveExceptionsAndResults(result); edgeSplitSuccessors(result); }
/** * Returns an SSA represention with only the steps through the * phi placement run. * * @param rmeth method to process * @param paramWidth width of all arguments in the method * @param isStatic {@code true} if this method has no {@code this} * pointer argument * @return an SSA represention with only the edge-splitter run */ public static SsaMethod testPhiPlacement (RopMethod rmeth, int paramWidth, boolean isStatic) { SsaMethod result; result = SsaMethod.newFromRopMethod(rmeth, paramWidth, isStatic); edgeSplit(result); LocalVariableInfo localInfo = LocalVariableExtractor.extract(result); placePhiFunctions(result, localInfo, 0); return result; }
public static SsaMethod debugRenaming(RopMethod rmeth, int paramWidth, boolean isStatic, boolean inPreserveLocals, TranslationAdvice inAdvice) { preserveLocals = inPreserveLocals; advice = inAdvice; return SsaConverter.convertToSsaMethod(rmeth, paramWidth, isStatic); }
/** * Inserts Z nodes as new predecessors for every node that has multiple * successors and multiple predecessors. * * @param result {@code non-null;} method to process */ private static void edgeSplitPredecessors(SsaMethod result) { ArrayList<SsaBasicBlock> blocks = result.getBlocks(); /* * New blocks are added to the end of the block list during * this iteration. */ for (int i = blocks.size() - 1; i >= 0; i-- ) { SsaBasicBlock block = blocks.get(i); if (nodeNeedsUniquePredecessor(block)) { block.insertNewPredecessor(); } } }
/** * Inserts Z nodes for every node that needs a new * successor. * * @param result {@code non-null;} method to process */ private static void edgeSplitSuccessors(SsaMethod result) { ArrayList<SsaBasicBlock> blocks = result.getBlocks(); /* * New blocks are added to the end of the block list during * this iteration. */ for (int i = blocks.size() - 1; i >= 0; i-- ) { SsaBasicBlock block = blocks.get(i); // Successors list is modified in loop below. BitSet successors = (BitSet)block.getSuccessors().clone(); for (int j = successors.nextSetBit(0); j >= 0; j = successors.nextSetBit(j+1)) { SsaBasicBlock succ = blocks.get(j); if (needsNewSuccessor(block, succ)) { block.insertNewSuccessor(succ); } } } }