[llvm-commits] [llvm] r48835 - in /llvm/branches/ggreif/use-diet/tools: Makefile bugpoint/CrashDebugger.cpp bugpoint/Miscompilation.cpp

Gabor Greif ggreif at gmail.com
Wed Mar 26 12:09:49 PDT 2008


Author: ggreif
Date: Wed Mar 26 14:09:48 2008
New Revision: 48835

URL: http://llvm.org/viewvc/llvm-project?rev=48835&view=rev
Log:
Create-ify tools/

Modified:
    llvm/branches/ggreif/use-diet/tools/Makefile
    llvm/branches/ggreif/use-diet/tools/bugpoint/CrashDebugger.cpp
    llvm/branches/ggreif/use-diet/tools/bugpoint/Miscompilation.cpp

Modified: llvm/branches/ggreif/use-diet/tools/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/tools/Makefile?rev=48835&r1=48834&r2=48835&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/tools/Makefile (original)
+++ llvm/branches/ggreif/use-diet/tools/Makefile Wed Mar 26 14:09:48 2008
@@ -12,7 +12,7 @@
 # large and three small executables. This is done to minimize memory load 
 # in parallel builds.  Please retain this ordering.
 PARALLEL_DIRS := llvm-config  \
-                 opt llvm-as llvm-dis llvm-upgrade \
+                 opt llvm-as llvm-dis \
                  llc llvm-ranlib llvm-ar llvm-nm \
                  llvm-ld llvmc llvm-prof llvm-link \
 		 lli gccas gccld llvm-extract llvm-db llvm2cpp \

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

==============================================================================
--- llvm/branches/ggreif/use-diet/tools/bugpoint/CrashDebugger.cpp (original)
+++ llvm/branches/ggreif/use-diet/tools/bugpoint/CrashDebugger.cpp Wed Mar 26 14:09:48 2008
@@ -308,8 +308,8 @@
 
         // Add a new return instruction of the appropriate type...
         const Type *RetTy = BB->getParent()->getReturnType();
-        new ReturnInst(RetTy == Type::VoidTy ? 0 :
-                       Constant::getNullValue(RetTy), BB);
+	ReturnInst::Create(RetTy == Type::VoidTy ? 0 :
+			   Constant::getNullValue(RetTy), BB);
       }
 
   // The CFG Simplifier pass may delete one of the basic blocks we are

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=48835&r1=48834&r2=48835&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/tools/bugpoint/Miscompilation.cpp (original)
+++ llvm/branches/ggreif/use-diet/tools/bugpoint/Miscompilation.cpp Wed Mar 26 14:09:48 2008
@@ -644,14 +644,14 @@
       // Rename it
       oldMain->setName("llvm_bugpoint_old_main");
       // Create a NEW `main' function with same type in the test module.
-      Function *newMain = new Function(oldMain->getFunctionType(),
-                                       GlobalValue::ExternalLinkage,
-                                       "main", Test);
+      Function *newMain = Function::Create(oldMain->getFunctionType(),
+                                           GlobalValue::ExternalLinkage,
+                                           "main", Test);
       // Create an `oldmain' prototype in the test module, which will
       // corresponds to the real main function in the same module.
-      Function *oldMainProto = new Function(oldMain->getFunctionType(),
-                                            GlobalValue::ExternalLinkage,
-                                            oldMain->getName(), Test);
+      Function *oldMainProto = Function::Create(oldMain->getFunctionType(),
+                                                GlobalValue::ExternalLinkage,
+                                                oldMain->getName(), Test);
       // Set up and remember the argument list for the main function.
       std::vector<Value*> args;
       for (Function::arg_iterator
@@ -662,12 +662,12 @@
       }
 
       // Call the old main function and return its result
-      BasicBlock *BB = new BasicBlock("entry", newMain);
-      CallInst *call = new CallInst(oldMainProto, args.begin(), args.end(),
-                                    "", BB);
+      BasicBlock *BB = BasicBlock::Create("entry", newMain);
+      CallInst *call = CallInst::Create(oldMainProto, args.begin(), args.end(),
+                                        "", BB);
 
       // If the type of old function wasn't void, return value of call
-      new ReturnInst(call, BB);
+      ReturnInst::Create(call, BB);
     }
 
   // The second nasty issue we must deal with in the JIT is that the Safe
@@ -717,35 +717,35 @@
 
           // Construct a new stub function that will re-route calls to F
           const FunctionType *FuncTy = F->getFunctionType();
-          Function *FuncWrapper = new Function(FuncTy,
-                                               GlobalValue::InternalLinkage,
-                                               F->getName() + "_wrapper",
-                                               F->getParent());
-          BasicBlock *EntryBB  = new BasicBlock("entry", FuncWrapper);
-          BasicBlock *DoCallBB = new BasicBlock("usecache", FuncWrapper);
-          BasicBlock *LookupBB = new BasicBlock("lookupfp", FuncWrapper);
+          Function *FuncWrapper = Function::Create(FuncTy,
+                                                   GlobalValue::InternalLinkage,
+                                                   F->getName() + "_wrapper",
+                                                   F->getParent());
+          BasicBlock *EntryBB  = BasicBlock::Create("entry", FuncWrapper);
+          BasicBlock *DoCallBB = BasicBlock::Create("usecache", FuncWrapper);
+          BasicBlock *LookupBB = BasicBlock::Create("lookupfp", FuncWrapper);
 
           // Check to see if we already looked up the value.
           Value *CachedVal = new LoadInst(Cache, "fpcache", EntryBB);
           Value *IsNull = new ICmpInst(ICmpInst::ICMP_EQ, CachedVal,
                                        NullPtr, "isNull", EntryBB);
-          new BranchInst(LookupBB, DoCallBB, IsNull, EntryBB);
+          BranchInst::Create(LookupBB, DoCallBB, IsNull, EntryBB);
 
           // Resolve the call to function F via the JIT API:
           //
           // call resolver(GetElementPtr...)
-          CallInst *Resolver = new CallInst(resolverFunc, ResolverArgs.begin(),
-                                            ResolverArgs.end(),
-                                            "resolver", LookupBB);
+          CallInst *Resolver = CallInst::Create(resolverFunc, ResolverArgs.begin(),
+                                                ResolverArgs.end(),
+                                                "resolver", LookupBB);
           // cast the result from the resolver to correctly-typed function
           CastInst *CastedResolver = new BitCastInst(Resolver, 
             PointerType::getUnqual(F->getFunctionType()), "resolverCast", LookupBB);
 
           // Save the value in our cache.
           new StoreInst(CastedResolver, Cache, LookupBB);
-          new BranchInst(DoCallBB, LookupBB);
+          BranchInst::Create(DoCallBB, LookupBB);
 
-          PHINode *FuncPtr = new PHINode(NullPtr->getType(), "fp", DoCallBB);
+          PHINode *FuncPtr = PHINode::Create(NullPtr->getType(), "fp", DoCallBB);
           FuncPtr->addIncoming(CastedResolver, LookupBB);
           FuncPtr->addIncoming(CachedVal, EntryBB);
 
@@ -757,12 +757,12 @@
 
           // Pass on the arguments to the real function, return its result
           if (F->getReturnType() == Type::VoidTy) {
-            new CallInst(FuncPtr, Args.begin(), Args.end(), "", DoCallBB);
-            new ReturnInst(DoCallBB);
+            CallInst::Create(FuncPtr, Args.begin(), Args.end(), "", DoCallBB);
+            ReturnInst::Create(DoCallBB);
           } else {
-            CallInst *Call = new CallInst(FuncPtr, Args.begin(), Args.end(),
-                                          "retval", DoCallBB);
-            new ReturnInst(Call, DoCallBB);
+            CallInst *Call = CallInst::Create(FuncPtr, Args.begin(), Args.end(),
+                                              "retval", DoCallBB);
+            ReturnInst::Create(Call, DoCallBB);
           }
 
           // Use the wrapper function instead of the old function





More information about the llvm-commits mailing list