[llvm-commits] [llvm-gcc-4.2] r75026 - in /llvm-gcc-4.2/trunk/gcc: llvm-backend.cpp llvm-convert.cpp llvm-types.cpp

Owen Anderson resistor at mac.com
Wed Jul 8 12:04:44 PDT 2009


Author: resistor
Date: Wed Jul  8 14:04:14 2009
New Revision: 75026

URL: http://llvm.org/viewvc/llvm-project?rev=75026&view=rev
Log:
Update for LLVM API change.

Modified:
    llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
    llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
    llvm-gcc-4.2/trunk/gcc/llvm-types.cpp

Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=75026&r1=75025&r2=75026&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Wed Jul  8 14:04:14 2009
@@ -286,10 +286,10 @@
   Constant *LLVMValuesTable = ConstantStruct::get(ValuesForPCH, false);
 
   // Create variable to hold this string table.
-  new GlobalVariable(TheModule->getContext(), LLVMValuesTable->getType(), true,
+  new GlobalVariable(*TheModule, LLVMValuesTable->getType(), true,
                      GlobalValue::ExternalLinkage,
                      LLVMValuesTable,
-                     "llvm.pch.values", TheModule);
+                     "llvm.pch.values");
 }
 
 /// eraseLocalLLVMValues - drop all non-global values from the LLVM values map.
@@ -804,9 +804,9 @@
   Constant *Array =
     ConstantArray::get(ArrayType::get(InitList[0]->getType(), InitList.size()),
                        InitList);
-  new GlobalVariable(TheModule->getContext(), Array->getType(), false, 
+  new GlobalVariable(*TheModule, Array->getType(), false,
                      GlobalValue::AppendingLinkage,
-                     Array, Name, TheModule);
+                     Array, Name);
 }
 
 // llvm_asm_file_end - Finish the .s file.
@@ -839,9 +839,9 @@
 
     ArrayType *AT = ArrayType::get(SBP, AUGs.size());
     Constant *Init = ConstantArray::get(AT, AUGs);
-    GlobalValue *gv = new GlobalVariable(TheModule->getContext(), AT, false,
+    GlobalValue *gv = new GlobalVariable(*TheModule, AT, false,
                        GlobalValue::AppendingLinkage, Init,
-                       "llvm.used", TheModule);
+                       "llvm.used");
     gv->setSection("llvm.metadata");
     AttributeUsedGlobals.clear();
   }
@@ -852,10 +852,9 @@
     ConstantArray::get(ArrayType::get(AttributeAnnotateGlobals[0]->getType(),
                                       AttributeAnnotateGlobals.size()),
                        AttributeAnnotateGlobals);
-    GlobalValue *gv = new GlobalVariable(TheModule->getContext(),
-                                         Array->getType(), false,
+    GlobalValue *gv = new GlobalVariable(*TheModule, Array->getType(), false,
                                          GlobalValue::AppendingLinkage, Array,
-                                         "llvm.global.annotations", TheModule);
+                                         "llvm.global.annotations");
     gv->setSection("llvm.metadata");
     AttributeAnnotateGlobals.clear();
   }
@@ -1015,10 +1014,10 @@
     if (!Aliasee) {
       if (lookup_attribute ("weakref", DECL_ATTRIBUTES (decl))) {
         if (GlobalVariable *GV = dyn_cast<GlobalVariable>(V))
-          Aliasee = new GlobalVariable(TheModule->getContext(),
-                                       GV->getType(), GV->isConstant(),
+          Aliasee = new GlobalVariable(*TheModule, GV->getType(),
+                                       GV->isConstant(),
                                        GlobalVariable::ExternalWeakLinkage,
-                                       NULL, AliaseeName, TheModule);
+                                       NULL, AliaseeName);
         else if (Function *F = dyn_cast<Function>(V))
           Aliasee = Function::Create(F->getFunctionType(),
                                      Function::ExternalWeakLinkage,
@@ -1087,10 +1086,9 @@
   if (Slot) return Slot;
   
   // Create a new string global.
-  GlobalVariable *GV = new GlobalVariable(TheModule->getContext(),
-                                          Init->getType(), true,
+  GlobalVariable *GV = new GlobalVariable(*TheModule, Init->getType(), true,
                                           GlobalVariable::InternalLinkage,
-                                          Init, ".str", TheModule);
+                                          Init, ".str");
   GV->setSection("llvm.metadata");
   Slot = GV;
   return GV;
@@ -1197,10 +1195,10 @@
   // different from the union element used for the type.
   if (GV->getType()->getElementType() != Init->getType()) {
     GV->removeFromParent();
-    GlobalVariable *NGV = new GlobalVariable(TheModule->getContext(),
-                                             Init->getType(), GV->isConstant(),
+    GlobalVariable *NGV = new GlobalVariable(*TheModule, Init->getType(), 
+                                             GV->isConstant(),
                                              GV->getLinkage(), 0,
-                                             GV->getName(), TheModule);
+                                             GV->getName());
     NGV->setVisibility(GV->getVisibility());
     NGV->setSection(GV->getSection());
     NGV->setAlignment(GV->getAlignment());
@@ -1274,10 +1272,10 @@
   // different from the union element used for the type.
   if (GV->getType()->getElementType() != Init->getType()) {
     GV->removeFromParent();
-    GlobalVariable *NGV = new GlobalVariable(TheModule->getContext(),
-                                             Init->getType(), GV->isConstant(),
+    GlobalVariable *NGV = new GlobalVariable(*TheModule, Init->getType(),
+                                             GV->isConstant(),
                                              GlobalValue::ExternalLinkage, 0,
-                                             GV->getName(), TheModule);
+                                             GV->getName());
     GV->replaceAllUsesWith(TheFolder->CreateBitCast(NGV, GV->getType()));
     changeLLVMConstant(GV, NGV);
     delete GV;
@@ -1568,9 +1566,8 @@
     if (Ty == Type::VoidTy) Ty = StructType::get(NULL, NULL);
 
     if (Name[0] == 0) {   // Global has no name.
-      GV = new GlobalVariable(TheModule->getContext(),
-                              Ty, false, GlobalValue::ExternalLinkage, 0,
-                              "", TheModule);
+      GV = new GlobalVariable(*TheModule, Ty, false, 
+                              GlobalValue::ExternalLinkage, 0, "");
 
       // Check for external weak linkage.
       if (DECL_EXTERNAL(decl) && DECL_WEAK(decl))
@@ -1587,9 +1584,8 @@
       GlobalVariable *GVE = TheModule->getGlobalVariable(Name, true);
     
       if (GVE == 0) {
-        GV = new GlobalVariable(TheModule->getContext(),
-                                Ty, false, GlobalValue::ExternalLinkage,0,
-                                Name, TheModule);
+        GV = new GlobalVariable(*TheModule, Ty, false,
+                                GlobalValue::ExternalLinkage, 0, Name);
 
         // Check for external weak linkage.
         if (DECL_EXTERNAL(decl) && DECL_WEAK(decl))

Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=75026&r1=75025&r2=75026&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Wed Jul  8 14:04:14 2009
@@ -7779,9 +7779,9 @@
   if (Slot) return Slot;
 
   // Create a new complex global.
-  Slot = new GlobalVariable(TheModule->getContext(), Init->getType(), true,
+  Slot = new GlobalVariable(*TheModule, Init->getType(), true,
                             GlobalVariable::InternalLinkage,
-                            Init, ".cpx", TheModule);
+                            Init, ".cpx");
   return Slot;
 }
 
@@ -7804,12 +7804,12 @@
     
   // Create a new string global.
   const TargetAsmInfo *TAI = TheTarget->getTargetAsmInfo();
-  GlobalVariable *GV = new GlobalVariable(TheModule->getContext(),
-                                          Init->getType(), StringIsConstant,
+  GlobalVariable *GV = new GlobalVariable(*TheModule, Init->getType(), 
+                                          StringIsConstant,
                                           GlobalVariable::InternalLinkage, Init,
                                            TAI ? 
                                             TAI->getStringConstantPrefix() : 
-                                            ".str", TheModule);
+                                            ".str");
 
   GV->setAlignment(TYPE_ALIGN(TREE_TYPE(exp)) / 8);
 

Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=75026&r1=75025&r2=75026&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Wed Jul  8 14:04:14 2009
@@ -192,11 +192,11 @@
   Constant *LTypesNameTable = ConstantStruct::get(LTypesNames, false);
 
   // Create variable to hold this string table.
-  GlobalVariable *GV = new GlobalVariable(TheModule->getContext(),
+  GlobalVariable *GV = new GlobalVariable(*TheModule,   
                                           LTypesNameTable->getType(), true,
                                           GlobalValue::ExternalLinkage, 
                                           LTypesNameTable,
-                                          "llvm.pch.types", TheModule);
+                                          "llvm.pch.types");
 }
 
 //===----------------------------------------------------------------------===//





More information about the llvm-commits mailing list