First try at a horrible global value reference wrapper

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@701 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2001-10-03 06:12:09 +00:00
parent d05adbcdce
commit f4ba6c710c
3 changed files with 79 additions and 19 deletions

View File

@@ -218,10 +218,38 @@ protected:
~ConstPoolPointer() {}
public:
static ConstPoolPointer *getNullPointer(const PointerType *T) {
// FIXME: These should all be shared!
return new ConstPoolPointer(T);
}
virtual string getStrValue() const;
};
// ConstPoolPointerReference - a constant pointer value that is initialized to
// point to a global value, which is a constant.
//
class ConstPoolPointerReference : public ConstPoolPointer {
ConstPoolPointerReference(const ConstPoolPointerReference &); // DNI!
protected:
ConstPoolPointerReference(GlobalVariable *GV);
~ConstPoolPointerReference() {}
public:
static ConstPoolPointerReference *get(GlobalVariable *GV) {
// FIXME: These should all be shared!
return new ConstPoolPointerReference(GV);
}
virtual string getStrValue() const;
const GlobalVariable *getValue() const {
return cast<GlobalVariable>(Operands[0].get());
}
GlobalVariable *getValue() {
return cast<GlobalVariable>(Operands[0].get());
}
};
#endif