#pragma once #include 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 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 indexes; SSAValue load() { SSAValue value = *this; return value.load(); } void store(llvm::Value *v) { SSAValue value = *this; return value.store(v); } template operator Type() { return Type::from_llvm(v); } operator SSAValue(); SSAIndexLookup operator[](int index); SSAIndexLookup operator[](SSAInt index); };