[llvm-commits] CVS: llvm/lib/Bitcode/Reader/BitcodeReader.cpp BitcodeReader.h
Chris Lattner
sabre at nondot.org
Wed Apr 25 20:28:15 PDT 2007
Changes in directory llvm/lib/Bitcode/Reader:
BitcodeReader.cpp updated: 1.13 -> 1.14
BitcodeReader.h updated: 1.9 -> 1.10
---
Log message:
move some code around, fix a bug in the reader reading globalinits (which
I just introduced), stub out function reading, purge aggregate values from
the value table before reading functions.
---
Diffs of the changes: (+16 -3)
BitcodeReader.cpp | 14 +++++++++++---
BitcodeReader.h | 5 +++++
2 files changed, 16 insertions(+), 3 deletions(-)
Index: llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff -u llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.13 llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.14
--- llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.13 Wed Apr 25 21:46:40 2007
+++ llvm/lib/Bitcode/Reader/BitcodeReader.cpp Wed Apr 25 22:27:58 2007
@@ -408,10 +408,10 @@
AliasInitWorklist.swap(AliasInits);
while (!GlobalInitWorklist.empty()) {
- unsigned ValID = GlobalInits.back().second;
+ unsigned ValID = GlobalInitWorklist.back().second;
if (ValID >= ValueList.size()) {
// Not ready to resolve this yet, it requires something later in the file.
- GlobalInitWorklist.push_back(GlobalInits.back());
+ GlobalInits.push_back(GlobalInitWorklist.back());
} else {
if (Constant *C = dyn_cast<Constant>(ValueList[ValID]))
GlobalInitWorklist.back().first->setInitializer(C);
@@ -826,7 +826,7 @@
break;
}
// ALIAS: [alias type, aliasee val#, linkage]
- case bitc::MODULE_CODE_ALIAS:
+ case bitc::MODULE_CODE_ALIAS: {
if (Record.size() < 3)
return Error("Invalid MODULE_ALIAS record");
const Type *Ty = getTypeByID(Record[0]);
@@ -839,6 +839,14 @@
AliasInits.push_back(std::make_pair(NewGA, Record[1]));
break;
}
+ /// MODULE_CODE_PURGEVALS: [numvals]
+ case bitc::MODULE_CODE_PURGEVALS:
+ // Trim down the value list to the specified size.
+ if (Record.size() < 1 || Record[0] > ValueList.size())
+ return Error("Invalid MODULE_PURGEVALS record");
+ ValueList.shrinkTo(Record[0]);
+ break;
+ }
Record.clear();
}
Index: llvm/lib/Bitcode/Reader/BitcodeReader.h
diff -u llvm/lib/Bitcode/Reader/BitcodeReader.h:1.9 llvm/lib/Bitcode/Reader/BitcodeReader.h:1.10
--- llvm/lib/Bitcode/Reader/BitcodeReader.h:1.9 Wed Apr 25 21:46:40 2007
+++ llvm/lib/Bitcode/Reader/BitcodeReader.h Wed Apr 25 22:27:58 2007
@@ -41,6 +41,11 @@
Value *back() const { return Uses.back(); }
void pop_back() { Uses.pop_back(); --NumOperands; }
bool empty() const { return NumOperands == 0; }
+ void shrinkTo(unsigned N) {
+ assert(N < NumOperands && "Invalid shrinkTo request!");
+ Uses.resize(N);
+ NumOperands = N;
+ }
virtual void print(std::ostream&) const {}
Constant *getConstantFwdRef(unsigned Idx, const Type *Ty);
More information about the llvm-commits
mailing list