mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
Switch to incremental creation of the dispatcher
Before this patch the dispatcher area was created all at once at a final stage, however it's useful also while translating, since it keeps all the code reachable, which is particularly important to be able to build a exhaustive dominator tree. * Create the dispatcher area when a new instance of `JumpTargetManager` is created. * Create a fake conditional branch to the dispatcher at the beginning of the `root` function. * Incrementally build the dispatcher's switch case in `JumpTargetManager::getBlockAt`.
This commit is contained in:
@@ -515,6 +515,16 @@ void CodeGenerator::translate(size_t LoadAddress,
|
||||
GlobalVariable *PCReg = Variables.getByEnvOffset(ptc.pc, "pc");
|
||||
|
||||
JumpTargetManager JumpTargets(*TheModule, PCReg, MainFunction);
|
||||
|
||||
// Create a new block where the translation will start and emit a tautological
|
||||
// branch to it, with false part being the dispatcher, which is always
|
||||
// reachable
|
||||
Entry = BasicBlock::Create(Context,
|
||||
"translation-start",
|
||||
MainFunction);
|
||||
Builder.CreateCondBr(Builder.getTrue(), Entry, JumpTargets.dispatcher());
|
||||
|
||||
|
||||
std::map<std::string, BasicBlock *> LabeledBasicBlocks;
|
||||
std::vector<BasicBlock *> Blocks;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user