aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-10-08 21:51:46 +0000
committerChris Lattner <sabre@nondot.org>2003-10-08 21:51:46 +0000
commit6e44802ec03647549c19a7d0313fae009fac7a49 (patch)
tree112cfabe80ec8109759f2a507d90c37483d4a03a /lib
parent1f9bcd3988ae9db0e6e767b3c7ee5f4bad487262 (diff)
downloadexternal_llvm-6e44802ec03647549c19a7d0313fae009fac7a49.zip
external_llvm-6e44802ec03647549c19a7d0313fae009fac7a49.tar.gz
external_llvm-6e44802ec03647549c19a7d0313fae009fac7a49.tar.bz2
Inline the postResolveValues method. It was poorly named anyway
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8976 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Bytecode/Reader/Reader.cpp53
-rw-r--r--lib/Bytecode/Reader/ReaderInternals.h7
2 files changed, 26 insertions, 34 deletions
diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp
index c3f7eb6..29812da 100644
--- a/lib/Bytecode/Reader/Reader.cpp
+++ b/lib/Bytecode/Reader/Reader.cpp
@@ -176,33 +176,6 @@ Constant *BytecodeParser::getConstantValue(const Type *Ty, unsigned Slot) {
}
-void BytecodeParser::postResolveValues(ValueTable &ValTab) {
- while (!ValTab.empty()) {
- ValueList &VL = *ValTab.back();
- ValTab.pop_back();
-
- while (!VL.empty()) {
- Value *V = VL.back();
- unsigned IDNumber = getValueIDNumberFromPlaceHolder(V);
- VL.pop_back();
-
- Value *NewVal = getValue(V->getType(), IDNumber, false);
- if (NewVal == 0)
- throw std::string("Unresolvable reference found: <" +
- V->getType()->getDescription() + ">:" +
- utostr(IDNumber) + ".");
-
- // Fixup all of the uses of this placeholder def...
- V->replaceAllUsesWith(NewVal);
-
- // Now that all the uses are gone, delete the placeholder...
- // If we couldn't find a def (error case), then leak a little
- delete V; // memory, 'cause otherwise we can't remove all uses!
- }
- delete &VL;
- }
-}
-
std::auto_ptr<BasicBlock>
BytecodeParser::ParseBasicBlock(const unsigned char *&Buf,
const unsigned char *EndBuf) {
@@ -381,9 +354,31 @@ void BytecodeParser::materializeFunction(Function* F) {
}
// Check for unresolvable references
- postResolveValues(LateResolveValues);
+ while (!LateResolveValues.empty()) {
+ ValueList &VL = *LateResolveValues.back();
+ LateResolveValues.pop_back();
+
+ while (!VL.empty()) {
+ Value *V = VL.back();
+ unsigned IDNumber = getValueIDNumberFromPlaceHolder(V);
+ VL.pop_back();
+
+ Value *NewVal = getValue(V->getType(), IDNumber, false);
+ if (NewVal == 0)
+ throw std::string("Unresolvable reference found: <" +
+ V->getType()->getDescription() + ">:" +
+ utostr(IDNumber) + ".");
- //ResolveReferencesToValue(F, FunctionSlot);
+ // Fixup all of the uses of this placeholder def...
+ V->replaceAllUsesWith(NewVal);
+
+ // Now that all the uses are gone, delete the placeholder...
+ // If we couldn't find a def (error case), then leak a little
+ // memory, because otherwise we can't remove all uses!
+ delete V;
+ }
+ delete &VL;
+ }
// Clear out function-level types...
FunctionTypeValues.clear();
diff --git a/lib/Bytecode/Reader/ReaderInternals.h b/lib/Bytecode/Reader/ReaderInternals.h
index c022519..8825df7 100644
--- a/lib/Bytecode/Reader/ReaderInternals.h
+++ b/lib/Bytecode/Reader/ReaderInternals.h
@@ -77,11 +77,9 @@ public:
std::cerr << "BytecodeParser instance!\n";
}
-private: // All of this data is transient across calls to ParseBytecode
+private:
struct ValueList : public User {
- ValueList() : User(Type::TypeTy, Value::TypeVal) {
- }
- ~ValueList() {}
+ ValueList() : User(Type::TypeTy, Value::TypeVal) {}
// vector compatibility methods
unsigned size() const { return getNumOperands(); }
@@ -185,7 +183,6 @@ private:
int insertValue(Value *V, ValueTable &Table); // -1 = Failure
void setValueTo(ValueTable &D, unsigned Slot, Value *V);
- void postResolveValues(ValueTable &ValTab);
unsigned getTypeSlot(const Type *Ty);