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:
Alessandro Di Federico
2016-04-14 08:58:13 +02:00
parent 670ca9d990
commit fbca5bba2e
9 changed files with 2861 additions and 162 deletions
+7 -4
View File
@@ -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