Hooked up LLVM wall drawers

This commit is contained in:
Magnus Norddahl 2016-09-30 07:27:25 +02:00
commit 28bb5da181
9 changed files with 411 additions and 48 deletions

View file

@ -1,6 +1,7 @@
#include "ssa_int.h"
#include "ssa_float.h"
#include "ssa_bool.h"
#include "ssa_scope.h"
#include "r_compiler/llvm_include.h"
@ -31,6 +32,16 @@ llvm::Type *SSAInt::llvm_type()
return llvm::Type::getInt32Ty(SSAScope::context());
}
SSAInt SSAInt::MIN(SSAInt a, SSAInt b)
{
return SSAInt::from_llvm(SSAScope::builder().CreateSelect((a < b).v, a.v, b.v, SSAScope::hint()));
}
SSAInt SSAInt::MAX(SSAInt a, SSAInt b)
{
return SSAInt::from_llvm(SSAScope::builder().CreateSelect((a > b).v, a.v, b.v, SSAScope::hint()));
}
SSAInt operator+(const SSAInt &a, const SSAInt &b)
{
return SSAInt::from_llvm(SSAScope::builder().CreateAdd(a.v, b.v, SSAScope::hint()));