Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
hernanponcedeleon committed Jul 31, 2024
1 parent 2e069fc commit aad7cd4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public static NormalizeLoops newInstance() {
public void run(Function function) {

// Guarantees header is the only entry point
int labelCounter = 0;
for (Label label : function.getEvents(Label.class)) {

final List<CondJump> backJumps = label.getJumpSet().stream()
Expand All @@ -106,7 +107,7 @@ public void run(Function function) {
final Label loopBegin = label;
final CondJump uniqueBackJump = backJumps.get(0);

final Register sourceReg = function.newRegister(String.format("__jumpedTo_%s_From", label), types.getArchType());
final Register sourceReg = function.newRegister(String.format("__jumpedTo_%s#%s_From", label, labelCounter), types.getArchType());
final Local initJumpedFromOutside = EventFactory.newLocal(sourceReg, expressions.makeZero(types.getArchType()));
function.getEntry().insertAfter(initJumpedFromOutside);

Expand Down Expand Up @@ -140,6 +141,8 @@ public void run(Function function) {
uniqueBackJump.getPredecessor().insertAfter(resetJumpFromOutside);
}
}

labelCounter++;
}

IdReassignment.newInstance().run(function);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ private ProcessingManager(Configuration config) throws InvalidConfigurationExcep
final FunctionProcessor removeDeadJumps = RemoveDeadCondJumps.fromConfig(config);
programProcessors.addAll(Arrays.asList(
printBeforeProcessing ? DebugPrint.withHeader("Before processing", Printer.Mode.ALL) : null,
ProgramProcessor.fromFunctionProcessor(NormalizeLoops.newInstance(), Target.FUNCTIONS, true),
intrinsics.markIntrinsicsPass(),
GEPToAddition.newInstance(),
NaiveDevirtualisation.newInstance(),
Expand All @@ -101,6 +100,7 @@ private ProcessingManager(Configuration config) throws InvalidConfigurationExcep
),
RegisterDecomposition.newInstance(),
RemoveDeadFunctions.newInstance(),
ProgramProcessor.fromFunctionProcessor(NormalizeLoops.newInstance(), Target.FUNCTIONS, true),
printAfterSimplification ? DebugPrint.withHeader("After simplification", Printer.Mode.ALL) : null,
Compilation.fromConfig(config), // We keep compilation global for now
LoopFormVerification.fromConfig(config),
Expand Down

0 comments on commit aad7cd4

Please sign in to comment.