[llvm-commits] [parallel] CVS: llvm/lib/Bytecode/Reader/ConstantReader.cpp InstructionReader.cpp Reader.cpp ReaderInternals.h

Misha Brukman brukman at cs.uiuc.edu
Mon Mar 1 18:04:24 PST 2004


Changes in directory llvm/lib/Bytecode/Reader:

ConstantReader.cpp updated: 1.72 -> 1.72.2.1
InstructionReader.cpp updated: 1.66.2.1 -> 1.66.2.2
Reader.cpp updated: 1.102 -> 1.102.2.1
ReaderInternals.h updated: 1.76 -> 1.76.2.1

---
Log message:

Merge from trunk

---
Diffs of the changes:  (+33 -28)

Index: llvm/lib/Bytecode/Reader/ConstantReader.cpp
diff -u llvm/lib/Bytecode/Reader/ConstantReader.cpp:1.72 llvm/lib/Bytecode/Reader/ConstantReader.cpp:1.72.2.1
--- llvm/lib/Bytecode/Reader/ConstantReader.cpp:1.72	Sun Jan 18 15:08:15 2004
+++ llvm/lib/Bytecode/Reader/ConstantReader.cpp	Mon Mar  1 17:58:13 2004
@@ -89,7 +89,6 @@
 // something and when we reread the type later, we can replace the opaque type
 // with a new resolved concrete type.
 //
-namespace llvm { void debug_type_tables(); }
 void BytecodeParser::parseTypeConstants(const unsigned char *&Buf,
                                         const unsigned char *EndBuf,
 					TypeValuesListTy &Tab,
@@ -129,7 +128,6 @@
   for (unsigned i = 0; i < NumEntries; ++i) {
     BCR_TRACE(5, (void*)Tab[i].get() << " - " << Tab[i].get() << "\n");
   }
-  debug_type_tables();
 }
 
 
@@ -233,12 +231,12 @@
 
   case Type::StructTyID: {
     const StructType *ST = cast<StructType>(Ty);
-    const StructType::ElementTypes &ET = ST->getElementTypes();
 
     std::vector<Constant *> Elements;
-    Elements.reserve(ET.size());
-    for (unsigned i = 0; i != ET.size(); ++i)
-      Elements.push_back(getConstantValue(ET[i], read_vbr_uint(Buf, EndBuf)));
+    Elements.reserve(ST->getNumElements());
+    for (unsigned i = 0; i != ST->getNumElements(); ++i)
+      Elements.push_back(getConstantValue(ST->getElementType(i),
+                                          read_vbr_uint(Buf, EndBuf)));
 
     return ConstantStruct::get(ST, Elements);
   }    


Index: llvm/lib/Bytecode/Reader/InstructionReader.cpp
diff -u llvm/lib/Bytecode/Reader/InstructionReader.cpp:1.66.2.1 llvm/lib/Bytecode/Reader/InstructionReader.cpp:1.66.2.2
--- llvm/lib/Bytecode/Reader/InstructionReader.cpp:1.66.2.1	Thu Jan 29 19:27:45 2004
+++ llvm/lib/Bytecode/Reader/InstructionReader.cpp	Mon Mar  1 17:58:13 2004
@@ -230,16 +230,16 @@
     if (FTy == 0) throw std::string("Call to non function pointer value!");
 
     std::vector<Value *> Params;
-    const FunctionType::ParamTypes &PL = FTy->getParamTypes();
-
     if (!FTy->isVarArg()) {
-      FunctionType::ParamTypes::const_iterator It = PL.begin();
+      FunctionType::param_iterator It = FTy->param_begin();
 
       for (unsigned i = 1, e = Args.size(); i != e; ++i) {
-        if (It == PL.end()) throw std::string("Invalid call instruction!");
+        if (It == FTy->param_end())
+          throw std::string("Invalid call instruction!");
         Params.push_back(getValue(getTypeSlot(*It++), Args[i]));
       }
-      if (It != PL.end()) throw std::string("Invalid call instruction!");
+      if (It != FTy->param_end())
+        throw std::string("Invalid call instruction!");
     } else {
       Args.erase(Args.begin(), Args.begin()+1+hasVarArgCallPadding);
 
@@ -280,18 +280,18 @@
     std::vector<Value *> Params;
     BasicBlock *Normal, *Except;
 
-    const FunctionType::ParamTypes &PL = FTy->getParamTypes();
-
     if (!FTy->isVarArg()) {
       Normal = getBasicBlock(Args[1]);
       Except = getBasicBlock(Args[2]);
 
-      FunctionType::ParamTypes::const_iterator It = PL.begin();
+      FunctionType::param_iterator It = FTy->param_begin();
       for (unsigned i = 3, e = Args.size(); i != e; ++i) {
-        if (It == PL.end()) throw std::string("Invalid invoke instruction!");
+        if (It == FTy->param_end())
+          throw std::string("Invalid invoke instruction!");
         Params.push_back(getValue(getTypeSlot(*It++), Args[i]));
       }
-      if (It != PL.end()) throw std::string("Invalid invoke instruction!");
+      if (It != FTy->param_end())
+        throw std::string("Invalid invoke instruction!");
     } else {
       Args.erase(Args.begin(), Args.begin()+1+hasVarArgCallPadding);
 


Index: llvm/lib/Bytecode/Reader/Reader.cpp
diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.102 llvm/lib/Bytecode/Reader/Reader.cpp:1.102.2.1
--- llvm/lib/Bytecode/Reader/Reader.cpp:1.102	Tue Jan 20 11:06:29 2004
+++ llvm/lib/Bytecode/Reader/Reader.cpp	Mon Mar  1 17:58:13 2004
@@ -381,11 +381,10 @@
         // Insert arguments into the value table before we parse the first basic
         // block in the function, but after we potentially read in the
         // compaction table.
-        const FunctionType::ParamTypes &Params =
-          F->getFunctionType()->getParamTypes();
+        const FunctionType *FT = F->getFunctionType();
         Function::aiterator AI = F->abegin();
-        for (FunctionType::ParamTypes::const_iterator It = Params.begin();
-             It != Params.end(); ++It, ++AI)
+        for (FunctionType::param_iterator It = FT->param_begin();
+             It != FT->param_end(); ++It, ++AI)
           insertValue(AI, getTypeSlot(AI->getType()), Values);
         InsertedArguments = true;
       }
@@ -404,11 +403,10 @@
         // Insert arguments into the value table before we parse the first basic
         // block in the function, but after we potentially read in the
         // compaction table.
-        const FunctionType::ParamTypes &Params =
-          F->getFunctionType()->getParamTypes();
+        const FunctionType *FT = F->getFunctionType();
         Function::aiterator AI = F->abegin();
-        for (FunctionType::ParamTypes::const_iterator It = Params.begin();
-             It != Params.end(); ++It, ++AI)
+        for (FunctionType::param_iterator It = FT->param_begin();
+             It != FT->param_end(); ++It, ++AI)
           insertValue(AI, getTypeSlot(AI->getType()), Values);
         InsertedArguments = true;
       }
@@ -424,11 +422,10 @@
       // list for the function, but after we potentially read in the compaction
       // table.
       if (!InsertedArguments) {
-        const FunctionType::ParamTypes &Params =
-          F->getFunctionType()->getParamTypes();
+        const FunctionType *FT = F->getFunctionType();
         Function::aiterator AI = F->abegin();
-        for (FunctionType::ParamTypes::const_iterator It = Params.begin();
-             It != Params.end(); ++It, ++AI)
+        for (FunctionType::param_iterator It = FT->param_begin();
+             It != FT->param_end(); ++It, ++AI)
           insertValue(AI, getTypeSlot(AI->getType()), Values);
         InsertedArguments = true;
       }


Index: llvm/lib/Bytecode/Reader/ReaderInternals.h
diff -u llvm/lib/Bytecode/Reader/ReaderInternals.h:1.76 llvm/lib/Bytecode/Reader/ReaderInternals.h:1.76.2.1
--- llvm/lib/Bytecode/Reader/ReaderInternals.h:1.76	Sun Jan 18 15:08:15 2004
+++ llvm/lib/Bytecode/Reader/ReaderInternals.h	Mon Mar  1 17:58:13 2004
@@ -55,6 +55,16 @@
     freeTable(ModuleValues);
   }
 
+  Module* materializeModule() {
+    while (! LazyFunctionLoadMap.empty()) {
+      std::map<Function*, LazyFunctionInfo>::iterator i = 
+        LazyFunctionLoadMap.begin();
+      materializeFunction((*i).first);
+    }
+
+    return TheModule;
+  }
+
   Module* releaseModule() {
     // Since we're losing control of this Module, we must hand it back complete
     Module *M = ModuleProvider::releaseModule();





More information about the llvm-commits mailing list