summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bytecode/Reader/Reader.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-10-13 14:34:59 +0000
committerChris Lattner <sabre@nondot.org>2003-10-13 14:34:59 +0000
commita785563692e59393c68f3a6311d544c384bcc1dd (patch)
tree2a36266b55d8f3dc5fa01b6f3371b8d0c2276ff8 /llvm/lib/Bytecode/Reader/Reader.cpp
parent1dc3f3fdc0511f2f73afda59ec23eedc7d96585a (diff)
downloadbcm5719-llvm-a785563692e59393c68f3a6311d544c384bcc1dd.tar.gz
bcm5719-llvm-a785563692e59393c68f3a6311d544c384bcc1dd.zip
Avoid calling getTypeSlot more
llvm-svn: 9077
Diffstat (limited to 'llvm/lib/Bytecode/Reader/Reader.cpp')
-rw-r--r--llvm/lib/Bytecode/Reader/Reader.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/Bytecode/Reader/Reader.cpp b/llvm/lib/Bytecode/Reader/Reader.cpp
index e735564acbd..8713855b271 100644
--- a/llvm/lib/Bytecode/Reader/Reader.cpp
+++ b/llvm/lib/Bytecode/Reader/Reader.cpp
@@ -75,11 +75,15 @@ const Type *BytecodeParser::getType(unsigned ID) {
}
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 @@ void BytecodeParser::ParseModuleGlobalInfo(const unsigned char *&Buf,
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 @@ void BytecodeParser::ParseModuleGlobalInfo(const unsigned char *&Buf,
// 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
OpenPOWER on IntegriCloud