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

Owen Anderson resistor at mac.com
Tue Jul 7 18:29:46 PDT 2009


Author: resistor
Date: Tue Jul  7 20:29:46 2009
New Revision: 74987

URL: http://llvm.org/viewvc/llvm-project?rev=74987&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=74987&r1=74986&r2=74987&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Tue Jul  7 20:29:46 2009
@@ -286,7 +286,7 @@
   Constant *LLVMValuesTable = ConstantStruct::get(ValuesForPCH, false);
 
   // Create variable to hold this string table.
-  new GlobalVariable(LLVMValuesTable->getType(), true,
+  new GlobalVariable(TheModule->getContext(), LLVMValuesTable->getType(), true,
                      GlobalValue::ExternalLinkage,
                      LLVMValuesTable,
                      "llvm.pch.values", TheModule);
@@ -804,7 +804,8 @@
   Constant *Array =
     ConstantArray::get(ArrayType::get(InitList[0]->getType(), InitList.size()),
                        InitList);
-  new GlobalVariable(Array->getType(), false, GlobalValue::AppendingLinkage,
+  new GlobalVariable(TheModule->getContext(), Array->getType(), false, 
+                     GlobalValue::AppendingLinkage,
                      Array, Name, TheModule);
 }
 
@@ -838,7 +839,7 @@
 
     ArrayType *AT = ArrayType::get(SBP, AUGs.size());
     Constant *Init = ConstantArray::get(AT, AUGs);
-    GlobalValue *gv = new GlobalVariable(AT, false,
+    GlobalValue *gv = new GlobalVariable(TheModule->getContext(), AT, false,
                        GlobalValue::AppendingLinkage, Init,
                        "llvm.used", TheModule);
     gv->setSection("llvm.metadata");
@@ -851,7 +852,8 @@
     ConstantArray::get(ArrayType::get(AttributeAnnotateGlobals[0]->getType(),
                                       AttributeAnnotateGlobals.size()),
                        AttributeAnnotateGlobals);
-    GlobalValue *gv = new GlobalVariable(Array->getType(), false,
+    GlobalValue *gv = new GlobalVariable(TheModule->getContext(),
+                                         Array->getType(), false,
                                          GlobalValue::AppendingLinkage, Array,
                                          "llvm.global.annotations", TheModule);
     gv->setSection("llvm.metadata");
@@ -1013,7 +1015,8 @@
     if (!Aliasee) {
       if (lookup_attribute ("weakref", DECL_ATTRIBUTES (decl))) {
         if (GlobalVariable *GV = dyn_cast<GlobalVariable>(V))
-          Aliasee = new GlobalVariable(GV->getType(), GV->isConstant(),
+          Aliasee = new GlobalVariable(TheModule->getContext(),
+                                       GV->getType(), GV->isConstant(),
                                        GlobalVariable::ExternalWeakLinkage,
                                        NULL, AliaseeName, TheModule);
         else if (Function *F = dyn_cast<Function>(V))
@@ -1084,7 +1087,8 @@
   if (Slot) return Slot;
   
   // Create a new string global.
-  GlobalVariable *GV = new GlobalVariable(Init->getType(), true,
+  GlobalVariable *GV = new GlobalVariable(TheModule->getContext(),
+                                          Init->getType(), true,
                                           GlobalVariable::InternalLinkage,
                                           Init, ".str", TheModule);
   GV->setSection("llvm.metadata");
@@ -1193,7 +1197,8 @@
   // different from the union element used for the type.
   if (GV->getType()->getElementType() != Init->getType()) {
     GV->removeFromParent();
-    GlobalVariable *NGV = new GlobalVariable(Init->getType(), GV->isConstant(),
+    GlobalVariable *NGV = new GlobalVariable(TheModule->getContext(),
+                                             Init->getType(), GV->isConstant(),
                                              GV->getLinkage(), 0,
                                              GV->getName(), TheModule);
     NGV->setVisibility(GV->getVisibility());
@@ -1269,7 +1274,8 @@
   // different from the union element used for the type.
   if (GV->getType()->getElementType() != Init->getType()) {
     GV->removeFromParent();
-    GlobalVariable *NGV = new GlobalVariable(Init->getType(), GV->isConstant(),
+    GlobalVariable *NGV = new GlobalVariable(TheModule->getContext(),
+                                             Init->getType(), GV->isConstant(),
                                              GlobalValue::ExternalLinkage, 0,
                                              GV->getName(), TheModule);
     GV->replaceAllUsesWith(TheFolder->CreateBitCast(NGV, GV->getType()));
@@ -1562,7 +1568,8 @@
     if (Ty == Type::VoidTy) Ty = StructType::get(NULL, NULL);
 
     if (Name[0] == 0) {   // Global has no name.
-      GV = new GlobalVariable(Ty, false, GlobalValue::ExternalLinkage, 0,
+      GV = new GlobalVariable(TheModule->getContext(),
+                              Ty, false, GlobalValue::ExternalLinkage, 0,
                               "", TheModule);
 
       // Check for external weak linkage.
@@ -1580,7 +1587,8 @@
       GlobalVariable *GVE = TheModule->getGlobalVariable(Name, true);
     
       if (GVE == 0) {
-        GV = new GlobalVariable(Ty, false, GlobalValue::ExternalLinkage,0,
+        GV = new GlobalVariable(TheModule->getContext(),
+                                Ty, false, GlobalValue::ExternalLinkage,0,
                                 Name, TheModule);
 
         // Check for external weak linkage.

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=74987&r1=74986&r2=74987&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Jul  7 20:29:46 2009
@@ -7779,7 +7779,7 @@
   if (Slot) return Slot;
 
   // Create a new complex global.
-  Slot = new GlobalVariable(Init->getType(), true,
+  Slot = new GlobalVariable(TheModule->getContext(), Init->getType(), true,
                             GlobalVariable::InternalLinkage,
                             Init, ".cpx", TheModule);
   return Slot;
@@ -7804,7 +7804,8 @@
     
   // Create a new string global.
   const TargetAsmInfo *TAI = TheTarget->getTargetAsmInfo();
-  GlobalVariable *GV = new GlobalVariable(Init->getType(), StringIsConstant,
+  GlobalVariable *GV = new GlobalVariable(TheModule->getContext(),
+                                          Init->getType(), StringIsConstant,
                                           GlobalVariable::InternalLinkage, Init,
                                            TAI ? 
                                             TAI->getStringConstantPrefix() : 

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=74987&r1=74986&r2=74987&view=diff

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





More information about the llvm-commits mailing list