mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 20:26:41 +00:00
Cleanups: move basic block linking to separated function
This commit is contained in:
parent
577438e243
commit
a338b88588
2 changed files with 11 additions and 2 deletions
|
|
@ -789,6 +789,15 @@ std::unique_ptr<llvm::Module> Compiler::compile(const dev::bytes& bytecode)
|
||||||
builder.SetInsertPoint(finalBlock);
|
builder.SetInsertPoint(finalBlock);
|
||||||
builder.CreateRet(builder.getInt64(0));
|
builder.CreateRet(builder.getInt64(0));
|
||||||
|
|
||||||
|
linkBasicBlocks();
|
||||||
|
|
||||||
|
return module;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Compiler::linkBasicBlocks()
|
||||||
|
{
|
||||||
|
/// Helper function that finds basic block given LLVM basic block pointer
|
||||||
auto findBB = [this](llvm::BasicBlock* _llvmBB)
|
auto findBB = [this](llvm::BasicBlock* _llvmBB)
|
||||||
{
|
{
|
||||||
for (auto&& bb : basicBlocks)
|
for (auto&& bb : basicBlocks)
|
||||||
|
|
@ -821,8 +830,6 @@ std::unique_ptr<llvm::Module> Compiler::compile(const dev::bytes& bytecode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return module;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@ private:
|
||||||
BasicBlock& getOrCreateBasicBlockAtPC(ProgramCounter pc);
|
BasicBlock& getOrCreateBasicBlockAtPC(ProgramCounter pc);
|
||||||
void createBasicBlocks(const dev::bytes& bytecode);
|
void createBasicBlocks(const dev::bytes& bytecode);
|
||||||
|
|
||||||
|
void linkBasicBlocks();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maps a program counter pc to a basic block which starts at pc (if any).
|
* Maps a program counter pc to a basic block which starts at pc (if any).
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue