[llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp ProfilePaths.cpp

Chris Lattner lattner at cs.uiuc.edu
Sat Aug 30 19:23:07 PDT 2003


Changes in directory llvm/lib/Transforms/Instrumentation/ProfilePaths:

InstLoops.cpp updated: 1.5 -> 1.6
ProfilePaths.cpp updated: 1.29 -> 1.30

---
Log message:

Use the new interface, simplifies code

NOTE that these two files are _BUGGY_ and need to be fixed, just not by me  :)


---
Diffs of the changes:

Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp
diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp:1.5 llvm/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp:1.6
--- llvm/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp:1.5	Tue Aug 12 17:00:24 2003
+++ llvm/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp	Sat Aug 30 19:21:59 2003
@@ -121,6 +121,12 @@
 
   removeRedundant(be);
 
+  // FIXME: THIS IS HORRIBLY BROKEN.  FunctionPass's cannot do this, except in
+  // their initialize function!!
+  Function *inCountMth = 
+    F.getParent()->getOrInsertFunction("llvm_first_trigger",
+                                       Type::VoidTy, 0);
+
   for(std::map<BasicBlock *, BasicBlock *>::iterator MI = be.begin(),
 	ME = be.end(); MI != ME; ++MI){
     BasicBlock *u = MI->first;
@@ -137,15 +143,6 @@
     ti->setSuccessor(index, newBB);
         
     BasicBlock::InstListType &lt = newBB->getInstList();
-
-    std::vector<const Type*> inCountArgs;
-    const FunctionType *cFty = FunctionType::get(Type::VoidTy, inCountArgs, 
-						 false);
-    Function *inCountMth = 
-      u->getParent()->getParent()->getOrInsertFunction("llvm_first_trigger",
-						       cFty);
-        
-    assert(inCountMth && "Initial method could not be inserted!");
 
     Instruction *call = new CallInst(inCountMth);
     lt.push_back(call);


Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp
diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp:1.29 llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp:1.30
--- llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp:1.29	Mon Jun 30 16:58:52 2003
+++ llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp	Sat Aug 30 19:21:59 2003
@@ -176,18 +176,16 @@
 
   if(fr->getParent()->getName() == "main"){
     //intialize threshold
-    vector<const Type*> initialize_args;
-    initialize_args.push_back(PointerType::get(Type::IntTy));
-    
-    const FunctionType *Fty = FunctionType::get(Type::VoidTy, initialize_args,
-                                                false);
-    Function *initialMeth = fr->getParent()->getParent()->getOrInsertFunction("reoptimizerInitialize", Fty);
-    assert(initialMeth && "Initialize method could not be inserted!");
+
+    // FIXME: THIS IS HORRIBLY BROKEN.  FUNCTION PASSES CANNOT DO THIS, EXCEPT
+    // IN THEIR INITIALIZE METHOD!!
+    Function *initialize =
+      F.getParent()->getOrInsertFunction("reoptimizerInitialize", Type::VoidTy,
+                                         PointerType::get(Type::IntTy), 0);
     
     vector<Value *> trargs;
     trargs.push_back(threshold);
-  
-    new CallInst(initialMeth, trargs, "", fr->begin());
+    new CallInst(initialize, trargs, "", fr->begin());
   }
 
 





More information about the llvm-commits mailing list