Use LLVM to JIT the code for one of the drawer functions
This commit is contained in:
parent
5ef46d1730
commit
3dd8b593b6
52 changed files with 4705 additions and 0 deletions
30
src/r_compiler/ssa/ssa_if_block.cpp
Normal file
30
src/r_compiler/ssa/ssa_if_block.cpp
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
|
||||
#include "ssa_if_block.h"
|
||||
#include "ssa_scope.h"
|
||||
|
||||
SSAIfBlock::SSAIfBlock()
|
||||
: if_basic_block(0), else_basic_block(0), end_basic_block(0)
|
||||
{
|
||||
}
|
||||
|
||||
void SSAIfBlock::if_block(SSABool true_condition)
|
||||
{
|
||||
if_basic_block = llvm::BasicBlock::Create(SSAScope::context(), "if", SSAScope::builder().GetInsertBlock()->getParent());
|
||||
else_basic_block = llvm::BasicBlock::Create(SSAScope::context(), "else", SSAScope::builder().GetInsertBlock()->getParent());
|
||||
end_basic_block = else_basic_block;
|
||||
SSAScope::builder().CreateCondBr(true_condition.v, if_basic_block, else_basic_block);
|
||||
SSAScope::builder().SetInsertPoint(if_basic_block);
|
||||
}
|
||||
|
||||
void SSAIfBlock::else_block()
|
||||
{
|
||||
end_basic_block = llvm::BasicBlock::Create(SSAScope::context(), "end", SSAScope::builder().GetInsertBlock()->getParent());
|
||||
SSAScope::builder().CreateBr(end_basic_block);
|
||||
SSAScope::builder().SetInsertPoint(else_basic_block);
|
||||
}
|
||||
|
||||
void SSAIfBlock::end_block()
|
||||
{
|
||||
SSAScope::builder().CreateBr(end_basic_block);
|
||||
SSAScope::builder().SetInsertPoint(end_basic_block);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue