mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
Import OSRA and update SET
* Import OSRA * Improve the SET (aka `JumpTargetFromConstants`) by introducing the `OperationsStack` class. * Review `harvest` logic * Allow to disable OSRA (along with the sumjump heuristic) * Take the core of `getNextPC` out of it and move it to `getPC`, a function returning both the current and the next PC. Also, fix a bug when reaching the beginning of a basic block. * Detect "reliable" jump targets: a "reliable" jump target is a jump target obtained from a store to a PC but it's not a fallthrough jump.
This commit is contained in:
+7
-4
@@ -58,12 +58,14 @@ CodeGenerator::CodeGenerator(std::string Input,
|
||||
DebugInfoType DebugInfo,
|
||||
std::string Debug,
|
||||
std::string LinkingInfoPath,
|
||||
std::string CoveragePath) :
|
||||
std::string CoveragePath,
|
||||
bool EnableOSRA) :
|
||||
TargetArchitecture(Target),
|
||||
Context(getGlobalContext()),
|
||||
TheModule((new Module("top", Context))),
|
||||
OutputPath(Output),
|
||||
Debug(new DebugHelper(Output, Debug, TheModule.get(), DebugInfo))
|
||||
Debug(new DebugHelper(Output, Debug, TheModule.get(), DebugInfo)),
|
||||
EnableOSRA(EnableOSRA)
|
||||
{
|
||||
OriginalInstrMDKind = Context.getMDKindID("oi");
|
||||
PTCInstrMDKind = Context.getMDKindID("pi");
|
||||
@@ -644,7 +646,8 @@ void CodeGenerator::translate(uint64_t VirtualAddress,
|
||||
JumpTargetManager JumpTargets(MainFunction,
|
||||
PCReg,
|
||||
SourceArchitecture,
|
||||
Segments);
|
||||
Segments,
|
||||
EnableOSRA);
|
||||
|
||||
if (VirtualAddress == 0) {
|
||||
JumpTargets.harvestGlobalData();
|
||||
@@ -795,7 +798,7 @@ void CodeGenerator::translate(uint64_t VirtualAddress,
|
||||
} // End loop over instructions
|
||||
|
||||
if (ForceNewBlock)
|
||||
JumpTargets.getBlockAt(EndPC);
|
||||
JumpTargets.getBlockAt(EndPC, false);
|
||||
|
||||
// We might have a leftover block, probably due to the block created after
|
||||
// the last call to exit_tb
|
||||
|
||||
Reference in New Issue
Block a user