mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-12 07:34:50 +00:00
57 lines
1.1 KiB
C++
57 lines
1.1 KiB
C++
|
|
||
|
#include "ssa_value.h"
|
||
|
#include "ssa_int.h"
|
||
|
#include "ssa_scope.h"
|
||
|
#include "r_compiler/llvm_include.h"
|
||
|
|
||
|
SSAValue SSAValue::load()
|
||
|
{
|
||
|
return SSAValue::from_llvm(SSAScope::builder().CreateLoad(v, false));
|
||
|
}
|
||
|
|
||
|
void SSAValue::store(llvm::Value *value)
|
||
|
{
|
||
|
SSAScope::builder().CreateStore(value, v, false);
|
||
|
}
|
||
|
|
||
|
SSAIndexLookup SSAValue::operator[](int index)
|
||
|
{
|
||
|
SSAIndexLookup result;
|
||
|
result.v = v;
|
||
|
result.indexes.push_back(SSAInt(index).v);
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
SSAIndexLookup SSAValue::operator[](SSAInt index)
|
||
|
{
|
||
|
SSAIndexLookup result;
|
||
|
result.v = v;
|
||
|
result.indexes.push_back(index.v);
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
/////////////////////////////////////////////////////////////////////////////
|
||
|
|
||
|
SSAIndexLookup::operator SSAValue()
|
||
|
{
|
||
|
return SSAValue::from_llvm(SSAScope::builder().CreateGEP(v, indexes));
|
||
|
}
|
||
|
|
||
|
SSAIndexLookup SSAIndexLookup::operator[](int index)
|
||
|
{
|
||
|
SSAIndexLookup result;
|
||
|
result.v = v;
|
||
|
result.indexes = indexes;
|
||
|
result.indexes.push_back(SSAInt(index).v);
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
SSAIndexLookup SSAIndexLookup::operator[](SSAInt index)
|
||
|
{
|
||
|
SSAIndexLookup result;
|
||
|
result.v = v;
|
||
|
result.indexes = indexes;
|
||
|
result.indexes.push_back(index.v);
|
||
|
return result;
|
||
|
}
|