From f0d9273af7079c3057d62689babf8e61cbbc3eaa Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 13 Oct 2003 14:34:59 +0000 Subject: Avoid calling getTypeSlot more git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9077 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Bytecode/Reader/Reader.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lib/Bytecode/Reader/Reader.cpp') diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp index e735564acb..8713855b27 100644 --- a/lib/Bytecode/Reader/Reader.cpp +++ b/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(Val) || Val->getType()->isPrimitiveType() || !cast(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(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 -- cgit v1.2.3