[llvm-commits] CVS: llvm/lib/Bytecode/Reader/ConstantReader.cpp Reader.cpp ReaderInternals.h
Chris Lattner
lattner at cs.uiuc.edu
Mon Oct 13 09:36:01 PDT 2003
Changes in directory llvm/lib/Bytecode/Reader:
ConstantReader.cpp updated: 1.57 -> 1.58
Reader.cpp updated: 1.80 -> 1.81
ReaderInternals.h updated: 1.58 -> 1.59
---
Log message:
Avoid calling getTypeSlot more
---
Diffs of the changes: (+9 -4)
Index: llvm/lib/Bytecode/Reader/ConstantReader.cpp
diff -u llvm/lib/Bytecode/Reader/ConstantReader.cpp:1.57 llvm/lib/Bytecode/Reader/ConstantReader.cpp:1.58
--- llvm/lib/Bytecode/Reader/ConstantReader.cpp:1.57 Thu Oct 9 15:41:16 2003
+++ llvm/lib/Bytecode/Reader/ConstantReader.cpp Mon Oct 13 09:34:59 2003
@@ -350,7 +350,7 @@
Constant *C = parseConstantValue(Buf, EndBuf, Ty);
assert(C && "parseConstantValue returned NULL!");
BCR_TRACE(4, "Read Constant: '" << *C << "'\n");
- unsigned Slot = insertValue(C, Tab);
+ unsigned Slot = insertValue(C, Typ, Tab);
// If we are reading a function constant table, make sure that we adjust
// the slot number to be the real global constant number.
Index: llvm/lib/Bytecode/Reader/Reader.cpp
diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.80 llvm/lib/Bytecode/Reader/Reader.cpp:1.81
--- llvm/lib/Bytecode/Reader/Reader.cpp:1.80 Fri Oct 10 00:43:47 2003
+++ llvm/lib/Bytecode/Reader/Reader.cpp Mon Oct 13 09:34:59 2003
@@ -75,11 +75,15 @@
}
unsigned BytecodeParser::insertValue(Value *Val, ValueTable &ValueTab) {
+ return insertValue(Val, getTypeSlot(Val->getType()), ValueTab);
+}
+
+unsigned BytecodeParser::insertValue(Value *Val, unsigned type,
+ ValueTable &ValueTab) {
assert((!HasImplicitZeroInitializer || !isa<Constant>(Val) ||
Val->getType()->isPrimitiveType() ||
!cast<Constant>(Val)->isNullValue()) &&
"Cannot read null values from bytecode!");
- unsigned type = getTypeSlot(Val->getType());
assert(type != Type::TypeTyID && "Types should never be insertValue'd!");
if (ValueTab.size() <= type) {
@@ -452,7 +456,7 @@
GlobalVariable *GV = new GlobalVariable(ElTy, VarType & 1, Linkage,
0, "", TheModule);
BCR_TRACE(2, "Global Variable of type: " << *Ty << "\n");
- ResolveReferencesToValue(GV, insertValue(GV, ModuleValues));
+ ResolveReferencesToValue(GV, insertValue(GV, SlotNo, ModuleValues));
if (VarType & 2) { // Does it have an initializer?
unsigned InitSlot;
@@ -483,7 +487,7 @@
// Insert the placeholder...
Function *Func = new Function(cast<FunctionType>(Ty),
GlobalValue::InternalLinkage, "", TheModule);
- unsigned DestSlot = insertValue(Func, ModuleValues);
+ unsigned DestSlot = insertValue(Func, FnSignature, ModuleValues);
ResolveReferencesToValue(Func, DestSlot);
// Keep track of this information in a list that is emptied as functions are
Index: llvm/lib/Bytecode/Reader/ReaderInternals.h
diff -u llvm/lib/Bytecode/Reader/ReaderInternals.h:1.58 llvm/lib/Bytecode/Reader/ReaderInternals.h:1.59
--- llvm/lib/Bytecode/Reader/ReaderInternals.h:1.58 Sun Oct 12 23:22:07 2003
+++ llvm/lib/Bytecode/Reader/ReaderInternals.h Mon Oct 13 09:34:59 2003
@@ -170,6 +170,7 @@
Constant *getConstantValue(const Type *Ty, unsigned num);
unsigned insertValue(Value *V, ValueTable &Table);
+ unsigned insertValue(Value *V, unsigned Type, ValueTable &Table);
unsigned getTypeSlot(const Type *Ty);
More information about the llvm-commits
mailing list