(List<BasicBlock> linearizedCFG)
| 211 | } |
| 212 | |
| 213 | private void renameLocalVariables(List<BasicBlock> linearizedCFG) { |
| 214 | Map<Operand, Operand> renameMap = new HashMap<Operand, Operand>(); |
| 215 | |
| 216 | //System.out.println("BEFORE:"); |
| 217 | for (BasicBlock b: linearizedCFG) { |
| 218 | for (Instruction i: b.getInstructions()) { |
| 219 | //System.out.println("I: " + i); |
| 220 | if (i instanceof ResultInstruction) { |
| 221 | Variable v = ((ResultInstruction) i).getResult(); |
| 222 | |
| 223 | if (v instanceof LocalVariable) { |
| 224 | setupLocalVarReplacement((LocalVariable) v, renameMap); |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | for (Variable v : i.getUsedVariables()) { |
| 229 | if (v instanceof LocalVariable) { |
| 230 | setupLocalVarReplacement((LocalVariable) v, renameMap); |
| 231 | } |
| 232 | } |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | //System.out.println("AFTER:"); |
| 237 | // Rename all local var uses with their tmp-var stand-ins |
| 238 | for (BasicBlock b: linearizedCFG) { |
| 239 | for (Instruction i: b.getInstructions()) { |
| 240 | i.renameVariables(renameMap); |
| 241 | //System.out.println("I: " + i); |
| 242 | } |
| 243 | } |
| 244 | } |
| 245 | |
| 246 | private static Label[] catLabels(Label[] labels, Label cat) { |
| 247 | if (labels == null) return new Label[] {cat}; |
no test coverage detected