mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-12-02 08:22:25 +00:00
53 lines
913 B
C++
53 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);
|
|
};
|