[llvm-commits] [llvm] r49484 - in /llvm/branches/ggreif/use-diet: examples/BrainF/ lib/Bitcode/Reader/ lib/CodeGen/ lib/Linker/ lib/Transforms/IPO/ lib/Transforms/Instrumentation/ lib/Transforms/Utils/ lib/VMCore/ tools/bugpoint/ tools/llvm2cpp/

Gabor Greif ggreif at gmail.com
Thu Apr 10 08:13:21 PDT 2008


Author: ggreif
Date: Thu Apr 10 10:13:21 2008
New Revision: 49484

URL: http://llvm.org/viewvc/llvm-project?rev=49484&view=rev
Log:
create-ify GlobalVariable

Modified:
    llvm/branches/ggreif/use-diet/examples/BrainF/BrainF.cpp
    llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp
    llvm/branches/ggreif/use-diet/lib/CodeGen/MachineModuleInfo.cpp
    llvm/branches/ggreif/use-diet/lib/CodeGen/ShadowStackCollector.cpp
    llvm/branches/ggreif/use-diet/lib/Linker/LinkModules.cpp
    llvm/branches/ggreif/use-diet/lib/Transforms/IPO/ExtractGV.cpp
    llvm/branches/ggreif/use-diet/lib/Transforms/IPO/GlobalOpt.cpp
    llvm/branches/ggreif/use-diet/lib/Transforms/IPO/SimplifyLibCalls.cpp
    llvm/branches/ggreif/use-diet/lib/Transforms/Instrumentation/BlockProfiling.cpp
    llvm/branches/ggreif/use-diet/lib/Transforms/Instrumentation/EdgeProfiling.cpp
    llvm/branches/ggreif/use-diet/lib/Transforms/Instrumentation/RSProfiling.cpp
    llvm/branches/ggreif/use-diet/lib/Transforms/Utils/CloneModule.cpp
    llvm/branches/ggreif/use-diet/lib/Transforms/Utils/LowerInvoke.cpp
    llvm/branches/ggreif/use-diet/lib/VMCore/Core.cpp
    llvm/branches/ggreif/use-diet/lib/VMCore/Module.cpp
    llvm/branches/ggreif/use-diet/tools/bugpoint/ExtractFunction.cpp
    llvm/branches/ggreif/use-diet/tools/bugpoint/Miscompilation.cpp
    llvm/branches/ggreif/use-diet/tools/llvm2cpp/CppWriter.cpp

Modified: llvm/branches/ggreif/use-diet/examples/BrainF/BrainF.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/examples/BrainF/BrainF.cpp?rev=49484&r1=49483&r2=49484&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/examples/BrainF/BrainF.cpp (original)
+++ llvm/branches/ggreif/use-diet/examples/BrainF/BrainF.cpp Thu Apr 10 10:13:21 2008
@@ -124,7 +124,7 @@
     Constant *msg_0 = ConstantArray::
       get("Error: The head has left the tape.", true);
 
-    GlobalVariable *aberrormsg = new GlobalVariable(
+    GlobalVariable *aberrormsg = GlobalVariable::Create(
       msg_0->getType(),
       true,
       GlobalValue::InternalLinkage,

Modified: llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp?rev=49484&r1=49483&r2=49484&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp Thu Apr 10 10:13:21 2008
@@ -1021,7 +1021,7 @@
         isThreadLocal = Record[7];
 
       GlobalVariable *NewGV =
-        new GlobalVariable(Ty, isConstant, Linkage, 0, "", TheModule, 
+        GlobalVariable::Create(Ty, isConstant, Linkage, 0, "", TheModule, 
                            isThreadLocal, AddressSpace);
       NewGV->setAlignment(Alignment);
       if (!Section.empty())

Modified: llvm/branches/ggreif/use-diet/lib/CodeGen/MachineModuleInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/CodeGen/MachineModuleInfo.cpp?rev=49484&r1=49483&r2=49484&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/lib/CodeGen/MachineModuleInfo.cpp (original)
+++ llvm/branches/ggreif/use-diet/lib/CodeGen/MachineModuleInfo.cpp Thu Apr 10 10:13:21 2008
@@ -337,7 +337,7 @@
     }
     
     Constant *CA = ConstantArray::get(AT, ArrayElements);
-    GlobalVariable *CAGV = new GlobalVariable(AT, true,
+    GlobalVariable *CAGV = GlobalVariable::Create(AT, true,
                                               GlobalValue::InternalLinkage,
                                               CA, "llvm.dbg.array",
                                               SR.getModule());
@@ -1333,7 +1333,7 @@
     // Construct string as an llvm constant.
     Constant *ConstStr = ConstantArray::get(String);
     // Otherwise create and return a new string global.
-    GlobalVariable *StrGV = new GlobalVariable(ConstStr->getType(), true,
+    GlobalVariable *StrGV = GlobalVariable::Create(ConstStr->getType(), true,
                                                GlobalVariable::InternalLinkage,
                                                ConstStr, ".str", M);
     StrGV->setSection("llvm.metadata");
@@ -1357,11 +1357,11 @@
   const StructType *Ty = getTagType(DD);
 
   // Create the GlobalVariable early to prevent infinite recursion.
-  GlobalVariable *GV = new GlobalVariable(Ty, true, DD->getLinkage(),
+  GlobalVariable *GV = GlobalVariable::Create(Ty, true, DD->getLinkage(),
                                           NULL, DD->getDescString(), M);
   GV->setSection("llvm.metadata");
 
-  // Insert new GlobalVariable in DescGlobals map.
+  // Insert GlobalVariable::Create in DescGlobals map.
   Slot = GV;
  
   // Set up elements vector

Modified: llvm/branches/ggreif/use-diet/lib/CodeGen/ShadowStackCollector.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/CodeGen/ShadowStackCollector.cpp?rev=49484&r1=49483&r2=49484&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/lib/CodeGen/ShadowStackCollector.cpp (original)
+++ llvm/branches/ggreif/use-diet/lib/CodeGen/ShadowStackCollector.cpp Thu Apr 10 10:13:21 2008
@@ -229,7 +229,7 @@
   //        to be a ModulePass (which means it cannot be in the 'llc' pipeline
   //        (which uses a FunctionPassManager (which segfaults (not asserts) if
   //        provided a ModulePass))).
-  Constant *GV = new GlobalVariable(FrameMap->getType(), true,
+  Constant *GV = GlobalVariable::Create(FrameMap->getType(), true,
                                     GlobalVariable::InternalLinkage,
                                     FrameMap, "__gc_" + F.getName(),
                                     F.getParent());
@@ -292,7 +292,7 @@
   if (!Head) {
     // If the root chain does not exist, insert a new one with linkonce
     // linkage!
-    Head = new GlobalVariable(StackEntryPtrTy, false,
+    Head = GlobalVariable::Create(StackEntryPtrTy, false,
                               GlobalValue::LinkOnceLinkage,
                               Constant::getNullValue(StackEntryPtrTy),
                               "llvm_gc_root_chain", &M);

Modified: llvm/branches/ggreif/use-diet/lib/Linker/LinkModules.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/Linker/LinkModules.cpp?rev=49484&r1=49483&r2=49484&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/lib/Linker/LinkModules.cpp (original)
+++ llvm/branches/ggreif/use-diet/lib/Linker/LinkModules.cpp Thu Apr 10 10:13:21 2008
@@ -499,7 +499,7 @@
       // symbol over in the dest module... the initializer will be filled in
       // later by LinkGlobalInits...
       GlobalVariable *NewDGV =
-        new GlobalVariable(SGV->getType()->getElementType(),
+        GlobalVariable::Create(SGV->getType()->getElementType(),
                            SGV->isConstant(), SGV->getLinkage(), /*init*/0,
                            SGV->getName(), Dest);
       // Propagate alignment, visibility and section info.
@@ -523,7 +523,7 @@
       // AppendingVars map.  The name is cleared out so that no linkage is
       // performed.
       GlobalVariable *NewDGV =
-        new GlobalVariable(SGV->getType()->getElementType(),
+        GlobalVariable::Create(SGV->getType()->getElementType(),
                            SGV->isConstant(), SGV->getLinkage(), /*init*/0,
                            "", Dest);
 
@@ -558,7 +558,7 @@
         // DGV and create a new one of the appropriate type.
         if (SGV->getType() != DGVar->getType()) {
           GlobalVariable *NewDGV =
-            new GlobalVariable(SGV->getType()->getElementType(),
+            GlobalVariable::Create(SGV->getType()->getElementType(),
                                DGVar->isConstant(), DGVar->getLinkage(),
                                /*init*/0, DGVar->getName(), Dest);
           CopyGVAttributes(NewDGV, DGVar);
@@ -1034,7 +1034,7 @@
       
       // Create the new global variable...
       GlobalVariable *NG =
-        new GlobalVariable(NewType, G1->isConstant(), G1->getLinkage(),
+        GlobalVariable::Create(NewType, G1->isConstant(), G1->getLinkage(),
                            /*init*/0, First->first, M, G1->isThreadLocal());
 
       // Propagate alignment, visibility and section info.

Modified: llvm/branches/ggreif/use-diet/lib/Transforms/IPO/ExtractGV.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/Transforms/IPO/ExtractGV.cpp?rev=49484&r1=49483&r2=49484&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/lib/Transforms/IPO/ExtractGV.cpp (original)
+++ llvm/branches/ggreif/use-diet/lib/Transforms/IPO/ExtractGV.cpp Thu Apr 10 10:13:21 2008
@@ -106,7 +106,7 @@
         }
         ArrayType *AT = ArrayType::get(SBP, AUGs.size());
         Constant *Init = ConstantArray::get(AT, AUGs);
-        GlobalValue *gv = new GlobalVariable(AT, false, 
+        GlobalValue *gv = GlobalVariable::Create(AT, false, 
                                              GlobalValue::AppendingLinkage, 
                                              Init, "llvm.used", &M);
         gv->setSection("llvm.metadata");

Modified: llvm/branches/ggreif/use-diet/lib/Transforms/IPO/GlobalOpt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/Transforms/IPO/GlobalOpt.cpp?rev=49484&r1=49483&r2=49484&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/lib/Transforms/IPO/GlobalOpt.cpp (original)
+++ llvm/branches/ggreif/use-diet/lib/Transforms/IPO/GlobalOpt.cpp Thu Apr 10 10:13:21 2008
@@ -473,7 +473,7 @@
       Constant *In = getAggregateConstantElement(Init,
                                             ConstantInt::get(Type::Int32Ty, i));
       assert(In && "Couldn't get element of initializer?");
-      GlobalVariable *NGV = new GlobalVariable(STy->getElementType(i), false,
+      GlobalVariable *NGV = GlobalVariable::Create(STy->getElementType(i), false,
                                                GlobalVariable::InternalLinkage,
                                                In, GV->getName()+"."+utostr(i),
                                                (Module *)NULL,
@@ -498,7 +498,7 @@
                                             ConstantInt::get(Type::Int32Ty, i));
       assert(In && "Couldn't get element of initializer?");
 
-      GlobalVariable *NGV = new GlobalVariable(STy->getElementType(), false,
+      GlobalVariable *NGV = GlobalVariable::Create(STy->getElementType(), false,
                                                GlobalVariable::InternalLinkage,
                                                In, GV->getName()+"."+utostr(i),
                                                (Module *)NULL,
@@ -799,7 +799,7 @@
   // Create the new global variable.  The contents of the malloc'd memory is
   // undefined, so initialize with an undef value.
   Constant *Init = UndefValue::get(MI->getAllocatedType());
-  GlobalVariable *NewGV = new GlobalVariable(MI->getAllocatedType(), false,
+  GlobalVariable *NewGV = GlobalVariable::Create(MI->getAllocatedType(), false,
                                              GlobalValue::InternalLinkage, Init,
                                              GV->getName()+".body",
                                              (Module *)NULL,
@@ -817,7 +817,7 @@
   // If there is a comparison against null, we will insert a global bool to
   // keep track of whether the global was initialized yet or not.
   GlobalVariable *InitBool =
-    new GlobalVariable(Type::Int1Ty, false, GlobalValue::InternalLinkage,
+    GlobalVariable::Create(Type::Int1Ty, false, GlobalValue::InternalLinkage,
                        ConstantInt::getFalse(), GV->getName()+".init",
                        (Module *)NULL, GV->isThreadLocal());
   bool InitBoolUsed = false;
@@ -1132,7 +1132,7 @@
     const Type *PFieldTy = PointerType::getUnqual(FieldTy);
     
     GlobalVariable *NGV =
-      new GlobalVariable(PFieldTy, false, GlobalValue::InternalLinkage,
+      GlobalVariable::Create(PFieldTy, false, GlobalValue::InternalLinkage,
                          Constant::getNullValue(PFieldTy),
                          GV->getName() + ".f" + utostr(FieldNo), GV,
                          GV->isThreadLocal());
@@ -1356,7 +1356,7 @@
   DOUT << "   *** SHRINKING TO BOOL: " << *GV;
   
   // Create the new global, initializing it to false.
-  GlobalVariable *NewGV = new GlobalVariable(Type::Int1Ty, false,
+  GlobalVariable *NewGV = GlobalVariable::Create(Type::Int1Ty, false,
          GlobalValue::InternalLinkage, ConstantInt::getFalse(),
                                              GV->getName()+".b",
                                              (Module *)NULL,
@@ -1754,7 +1754,7 @@
   }
   
   // Create the new global and insert it next to the existing list.
-  GlobalVariable *NGV = new GlobalVariable(CA->getType(), GCL->isConstant(),
+  GlobalVariable *NGV = GlobalVariable::Create(CA->getType(), GCL->isConstant(),
                                            GCL->getLinkage(), CA, "",
                                            (Module *)NULL,
                                            GCL->isThreadLocal());
@@ -1992,7 +1992,7 @@
     } else if (AllocaInst *AI = dyn_cast<AllocaInst>(CurInst)) {
       if (AI->isArrayAllocation()) return false;  // Cannot handle array allocs.
       const Type *Ty = AI->getType()->getElementType();
-      AllocaTmps.push_back(new GlobalVariable(Ty, false,
+      AllocaTmps.push_back(GlobalVariable::Create(Ty, false,
                                               GlobalValue::InternalLinkage,
                                               UndefValue::get(Ty),
                                               AI->getName()));

Modified: llvm/branches/ggreif/use-diet/lib/Transforms/IPO/SimplifyLibCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/Transforms/IPO/SimplifyLibCalls.cpp?rev=49484&r1=49483&r2=49484&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/lib/Transforms/IPO/SimplifyLibCalls.cpp (original)
+++ llvm/branches/ggreif/use-diet/lib/Transforms/IPO/SimplifyLibCalls.cpp Thu Apr 10 10:13:21 2008
@@ -1232,7 +1232,7 @@
       // pass to be run after this pass, to merge duplicate strings.
       FormatStr.erase(FormatStr.end()-1);
       Constant *Init = ConstantArray::get(FormatStr, true);
-      Constant *GV = new GlobalVariable(Init->getType(), true,
+      Constant *GV = GlobalVariable::Create(Init->getType(), true,
                                         GlobalVariable::InternalLinkage,
                                         Init, "str",
                                      CI->getParent()->getParent()->getParent());

Modified: llvm/branches/ggreif/use-diet/lib/Transforms/Instrumentation/BlockProfiling.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/Transforms/Instrumentation/BlockProfiling.cpp?rev=49484&r1=49483&r2=49484&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/lib/Transforms/Instrumentation/BlockProfiling.cpp (original)
+++ llvm/branches/ggreif/use-diet/lib/Transforms/Instrumentation/BlockProfiling.cpp Thu Apr 10 10:13:21 2008
@@ -64,7 +64,7 @@
 
   const Type *ATy = ArrayType::get(Type::Int32Ty, NumFunctions);
   GlobalVariable *Counters =
-    new GlobalVariable(ATy, false, GlobalValue::InternalLinkage,
+    GlobalVariable::Create(ATy, false, GlobalValue::InternalLinkage,
                        Constant::getNullValue(ATy), "FuncProfCounters", &M);
 
   // Instrument all of the functions...
@@ -109,7 +109,7 @@
 
   const Type *ATy = ArrayType::get(Type::Int32Ty, NumBlocks);
   GlobalVariable *Counters =
-    new GlobalVariable(ATy, false, GlobalValue::InternalLinkage,
+    GlobalVariable::Create(ATy, false, GlobalValue::InternalLinkage,
                        Constant::getNullValue(ATy), "BlockProfCounters", &M);
 
   // Instrument all of the blocks...

Modified: llvm/branches/ggreif/use-diet/lib/Transforms/Instrumentation/EdgeProfiling.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/Transforms/Instrumentation/EdgeProfiling.cpp?rev=49484&r1=49483&r2=49484&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/lib/Transforms/Instrumentation/EdgeProfiling.cpp (original)
+++ llvm/branches/ggreif/use-diet/lib/Transforms/Instrumentation/EdgeProfiling.cpp Thu Apr 10 10:13:21 2008
@@ -65,7 +65,7 @@
 
   const Type *ATy = ArrayType::get(Type::Int32Ty, NumEdges);
   GlobalVariable *Counters =
-    new GlobalVariable(ATy, false, GlobalValue::InternalLinkage,
+    GlobalVariable::Create(ATy, false, GlobalValue::InternalLinkage,
                        Constant::getNullValue(ATy), "EdgeProfCounters", &M);
 
   // Instrument all of the edges...

Modified: llvm/branches/ggreif/use-diet/lib/Transforms/Instrumentation/RSProfiling.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/Transforms/Instrumentation/RSProfiling.cpp?rev=49484&r1=49483&r2=49484&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/lib/Transforms/Instrumentation/RSProfiling.cpp (original)
+++ llvm/branches/ggreif/use-diet/lib/Transforms/Instrumentation/RSProfiling.cpp Thu Apr 10 10:13:21 2008
@@ -193,7 +193,7 @@
                                          uint64_t resetval) : T(t) {
   ConstantInt* Init = ConstantInt::get(T, resetval); 
   ResetValue = Init;
-  Counter = new GlobalVariable(T, false, GlobalValue::InternalLinkage,
+  Counter = GlobalVariable::Create(T, false, GlobalValue::InternalLinkage,
                                Init, "RandomSteeringCounter", &M);
 }
 
@@ -230,7 +230,7 @@
   : AI(0), T(t) {
   ConstantInt* Init = ConstantInt::get(T, resetval);
   ResetValue  = Init;
-  Counter = new GlobalVariable(T, false, GlobalValue::InternalLinkage,
+  Counter = GlobalVariable::Create(T, false, GlobalValue::InternalLinkage,
                                Init, "RandomSteeringCounter", &M);
 }
 

Modified: llvm/branches/ggreif/use-diet/lib/Transforms/Utils/CloneModule.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/Transforms/Utils/CloneModule.cpp?rev=49484&r1=49483&r2=49484&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/lib/Transforms/Utils/CloneModule.cpp (original)
+++ llvm/branches/ggreif/use-diet/lib/Transforms/Utils/CloneModule.cpp Thu Apr 10 10:13:21 2008
@@ -56,7 +56,7 @@
   //
   for (Module::const_global_iterator I = M->global_begin(), E = M->global_end();
        I != E; ++I)
-    ValueMap[I] = new GlobalVariable(I->getType()->getElementType(), false,
+    ValueMap[I] = GlobalVariable::Create(I->getType()->getElementType(), false,
                                      GlobalValue::ExternalLinkage, 0,
                                      I->getName(), New);
 

Modified: llvm/branches/ggreif/use-diet/lib/Transforms/Utils/LowerInvoke.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/Transforms/Utils/LowerInvoke.cpp?rev=49484&r1=49483&r2=49484&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/lib/Transforms/Utils/LowerInvoke.cpp (original)
+++ llvm/branches/ggreif/use-diet/lib/Transforms/Utils/LowerInvoke.cpp Thu Apr 10 10:13:21 2008
@@ -138,7 +138,7 @@
     // Now that we've done that, insert the jmpbuf list head global, unless it
     // already exists.
     if (!(JBListHead = M.getGlobalVariable("llvm.sjljeh.jblist", PtrJBList))) {
-      JBListHead = new GlobalVariable(PtrJBList, false,
+      JBListHead = GlobalVariable::Create(PtrJBList, false,
                                       GlobalValue::LinkOnceLinkage,
                                       Constant::getNullValue(PtrJBList),
                                       "llvm.sjljeh.jblist", &M);
@@ -166,7 +166,7 @@
       ConstantArray::get("ERROR: Exception thrown, but not caught!\n");
     AbortMessageLength = Msg->getNumOperands()-1;  // don't include \0
 
-    GlobalVariable *MsgGV = new GlobalVariable(Msg->getType(), true,
+    GlobalVariable *MsgGV = GlobalVariable::Create(Msg->getType(), true,
                                                GlobalValue::InternalLinkage,
                                                Msg, "abortmsg", M);
     std::vector<Constant*> GEPIdx(2, Constant::getNullValue(Type::Int32Ty));
@@ -179,7 +179,7 @@
                          " program with -enable-correct-eh-support.\n");
     AbortMessageLength = Msg->getNumOperands()-1;  // don't include \0
 
-    GlobalVariable *MsgGV = new GlobalVariable(Msg->getType(), true,
+    GlobalVariable *MsgGV = GlobalVariable::Create(Msg->getType(), true,
                                                GlobalValue::InternalLinkage,
                                                Msg, "abortmsg", M);
     std::vector<Constant*> GEPIdx(2, Constant::getNullValue(Type::Int32Ty));

Modified: llvm/branches/ggreif/use-diet/lib/VMCore/Core.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/VMCore/Core.cpp?rev=49484&r1=49483&r2=49484&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/lib/VMCore/Core.cpp (original)
+++ llvm/branches/ggreif/use-diet/lib/VMCore/Core.cpp Thu Apr 10 10:13:21 2008
@@ -592,7 +592,7 @@
 /*--.. Operations on global variables ......................................--*/
 
 LLVMValueRef LLVMAddGlobal(LLVMModuleRef M, LLVMTypeRef Ty, const char *Name) {
-  return wrap(new GlobalVariable(unwrap(Ty), false,
+  return wrap(GlobalVariable::Create(unwrap(Ty), false,
                                  GlobalValue::ExternalLinkage, 0, Name,
                                  unwrap(M)));
 }

Modified: llvm/branches/ggreif/use-diet/lib/VMCore/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/VMCore/Module.cpp?rev=49484&r1=49483&r2=49484&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/lib/VMCore/Module.cpp (original)
+++ llvm/branches/ggreif/use-diet/lib/VMCore/Module.cpp Thu Apr 10 10:13:21 2008
@@ -38,7 +38,7 @@
   return Ret;
 }
 GlobalVariable *ilist_traits<GlobalVariable>::createSentinel() {
-  GlobalVariable *Ret = new GlobalVariable(Type::Int32Ty, false,
+  GlobalVariable *Ret = GlobalVariable::Create(Type::Int32Ty, false,
                                            GlobalValue::ExternalLinkage);
   // This should not be garbage monitored.
   LeakDetector::removeGarbageObject(Ret);

Modified: llvm/branches/ggreif/use-diet/tools/bugpoint/ExtractFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/tools/bugpoint/ExtractFunction.cpp?rev=49484&r1=49483&r2=49484&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/tools/bugpoint/ExtractFunction.cpp (original)
+++ llvm/branches/ggreif/use-diet/tools/bugpoint/ExtractFunction.cpp Thu Apr 10 10:13:21 2008
@@ -233,7 +233,7 @@
   GV->eraseFromParent();
   if (!M1Tors.empty()) {
     Constant *M1Init = GetTorInit(M1Tors);
-    new GlobalVariable(M1Init->getType(), false, GlobalValue::AppendingLinkage,
+    GlobalVariable::Create(M1Init->getType(), false, GlobalValue::AppendingLinkage,
                        M1Init, GlobalName, M1);
   }
 
@@ -244,7 +244,7 @@
   GV->eraseFromParent();
   if (!M2Tors.empty()) {
     Constant *M2Init = GetTorInit(M2Tors);
-    new GlobalVariable(M2Init->getType(), false, GlobalValue::AppendingLinkage,
+    GlobalVariable::Create(M2Init->getType(), false, GlobalValue::AppendingLinkage,
                        M2Init, GlobalName, M2);
   }
 }

Modified: llvm/branches/ggreif/use-diet/tools/bugpoint/Miscompilation.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/tools/bugpoint/Miscompilation.cpp?rev=49484&r1=49483&r2=49484&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/tools/bugpoint/Miscompilation.cpp (original)
+++ llvm/branches/ggreif/use-diet/tools/bugpoint/Miscompilation.cpp Thu Apr 10 10:13:21 2008
@@ -693,7 +693,7 @@
         // 1. Add a string constant with its name to the global file
         Constant *InitArray = ConstantArray::get(F->getName());
         GlobalVariable *funcName =
-          new GlobalVariable(InitArray->getType(), true /*isConstant*/,
+          GlobalVariable::Create(InitArray->getType(), true /*isConstant*/,
                              GlobalValue::InternalLinkage, InitArray,
                              F->getName() + "_name", Safe);
 
@@ -712,7 +712,7 @@
           // Create a new global to hold the cached function pointer.
           Constant *NullPtr = ConstantPointerNull::get(F->getType());
           GlobalVariable *Cache =
-            new GlobalVariable(F->getType(), false,GlobalValue::InternalLinkage,
+            GlobalVariable::Create(F->getType(), false,GlobalValue::InternalLinkage,
                                NullPtr,F->getName()+".fpcache", F->getParent());
 
           // Construct a new stub function that will re-route calls to F

Modified: llvm/branches/ggreif/use-diet/tools/llvm2cpp/CppWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/tools/llvm2cpp/CppWriter.cpp?rev=49484&r1=49483&r2=49484&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/tools/llvm2cpp/CppWriter.cpp (original)
+++ llvm/branches/ggreif/use-diet/tools/llvm2cpp/CppWriter.cpp Thu Apr 10 10:13:21 2008
@@ -989,7 +989,7 @@
      nl(Out) << "if (!" << getCppName(GV) << ") {";
      in(); nl(Out) << getCppName(GV);
   }
-  Out << " = new GlobalVariable(";
+  Out << " = GlobalVariable::Create(";
   nl(Out) << "/*Type=*/";
   printCppName(GV->getType()->getElementType());
   Out << ",";





More information about the llvm-commits mailing list