2016-09-26 07:00:19 +00:00
|
|
|
|
|
|
|
#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; }
|
|
|
|
|
2016-10-08 07:29:26 +00:00
|
|
|
SSAValue load(bool constantScopeDomain);
|
2016-09-26 07:00:19 +00:00
|
|
|
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;
|
|
|
|
|
2016-10-08 07:29:26 +00:00
|
|
|
SSAValue load(bool constantScopeDomain) { SSAValue value = *this; return value.load(constantScopeDomain); }
|
2016-09-26 07:00:19 +00:00
|
|
|
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);
|
|
|
|
};
|