summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-05-01 07:01:57 +0000
committerChris Lattner <sabre@nondot.org>2007-05-01 07:01:57 +0000
commit8393055447ffe8a9912e1c2bb42bc464bc864b6a (patch)
tree6b21bc4754ae2f3fca53311ee35391c5c5a45c32 /llvm/lib/Bitcode/Reader/BitcodeReader.h
parentfd788aafbafed70ca8220d417b021480b8b878ae (diff)
downloadbcm5719-llvm-8393055447ffe8a9912e1c2bb42bc464bc864b6a.tar.gz
bcm5719-llvm-8393055447ffe8a9912e1c2bb42bc464bc864b6a.zip
handle function-level forward references, read binops.
llvm-svn: 36620
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.h')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.h b/llvm/lib/Bitcode/Reader/BitcodeReader.h
index 65c495b6699..36972734e80 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.h
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.h
@@ -51,6 +51,22 @@ public:
virtual void print(std::ostream&) const {}
Constant *getConstantFwdRef(unsigned Idx, const Type *Ty);
+ Value *getValueFwdRef(unsigned Idx, const Type *Ty);
+
+ void AssignValue(Value *V, unsigned Idx) {
+ if (Idx == size()) {
+ push_back(V);
+ } else if (Value *OldV = getOperand(Idx)) {
+ // If there was a forward reference to this value, replace it.
+ setOperand(Idx, V);
+ OldV->replaceAllUsesWith(V);
+ delete OldV;
+ } else {
+ initVal(Idx, V);
+ }
+ }
+
+private:
void initVal(unsigned Idx, Value *V) {
assert(Uses[Idx] == 0 && "Cannot init an already init'd Use!");
Uses[Idx].init(V, this);
@@ -113,6 +129,9 @@ public:
bool ParseBitcode();
private:
const Type *getTypeByID(unsigned ID, bool isTypeTable = false);
+ Value *getFnValueByID(unsigned ID, const Type *Ty) {
+ return ValueList.getValueFwdRef(ID, Ty);
+ }
bool ParseModule(const std::string &ModuleID);
bool ParseTypeTable();
OpenPOWER on IntegriCloud