mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-12 07:34:50 +00:00
54 lines
913 B
C
54 lines
913 B
C
|
|
||
|
#pragma once
|
||
|
|
||
|
#include <vector>
|
||
|
|
||
|
namespace llvm { class Value; }
|
||
|
|
||
|
class SSAInt;
|
||
|
class SSAIndexLookup;
|
||
|
|
||
|
class SSAValue
|
||
|
{
|
||
|
public:
|
||
|
SSAValue() : v(0) { }
|
||
|
|
||
|
static SSAValue from_llvm(llvm::Value *v) { SSAValue val; val.v = v; return val; }
|
||
|
|
||
|
SSAValue load();
|
||
|
void store(llvm::Value *v);
|
||
|
|
||
|
template<typename Type>
|
||
|
operator Type()
|
||
|
{
|
||
|
return Type::from_llvm(v);
|
||
|
}
|
||
|
|
||
|
SSAIndexLookup operator[](int index);
|
||
|
SSAIndexLookup operator[](SSAInt index);
|
||
|
|
||
|
llvm::Value *v;
|
||
|
};
|
||
|
|
||
|
class SSAIndexLookup
|
||
|
{
|
||
|
public:
|
||
|
SSAIndexLookup() : v(0) { }
|
||
|
|
||
|
llvm::Value *v;
|
||
|
std::vector<llvm::Value *> indexes;
|
||
|
|
||
|
SSAValue load() { SSAValue value = *this; return value.load(); }
|
||
|
void store(llvm::Value *v) { SSAValue value = *this; return value.store(v); }
|
||
|
|
||
|
template<typename Type>
|
||
|
operator Type()
|
||
|
{
|
||
|
return Type::from_llvm(v);
|
||
|
}
|
||
|
|
||
|
operator SSAValue();
|
||
|
SSAIndexLookup operator[](int index);
|
||
|
SSAIndexLookup operator[](SSAInt index);
|
||
|
};
|