[llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp EdgeProfiling.cpp EmitFunctions.cpp ProfilingUtils.cpp ProfilingUtils.h TraceBasicBlocks.cpp TraceValues.cpp

Misha Brukman brukman at cs.uiuc.edu
Thu Apr 21 16:40:57 PDT 2005



Changes in directory llvm/lib/Transforms/Instrumentation:

BlockProfiling.cpp updated: 1.12 -> 1.13
EdgeProfiling.cpp updated: 1.5 -> 1.6
EmitFunctions.cpp updated: 1.22 -> 1.23
ProfilingUtils.cpp updated: 1.5 -> 1.6
ProfilingUtils.h updated: 1.4 -> 1.5
TraceBasicBlocks.cpp updated: 1.10 -> 1.11
TraceValues.cpp updated: 1.72 -> 1.73
---
Log message:

Remove trailing whitespace


---
Diffs of the changes:  (+69 -69)

 BlockProfiling.cpp   |   12 ++++----
 EdgeProfiling.cpp    |    4 +-
 EmitFunctions.cpp    |   34 ++++++++++++------------
 ProfilingUtils.cpp   |    8 ++---
 ProfilingUtils.h     |    4 +-
 TraceBasicBlocks.cpp |    4 +-
 TraceValues.cpp      |   72 +++++++++++++++++++++++++--------------------------
 7 files changed, 69 insertions(+), 69 deletions(-)


Index: llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp
diff -u llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp:1.12 llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp:1.13
--- llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp:1.12	Fri Jan  7 01:05:34 2005
+++ llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp	Thu Apr 21 18:40:46 2005
@@ -1,10 +1,10 @@
 //===- BlockProfiling.cpp - Insert counters for block profiling -----------===//
-// 
+//
 //                      The LLVM Compiler Infrastructure
 //
 // This file was developed by the LLVM research group and is distributed under
 // the University of Illinois Open Source License. See LICENSE.TXT for details.
-// 
+//
 //===----------------------------------------------------------------------===//
 //
 // This pass instruments the specified program with counters for basic block or
@@ -51,7 +51,7 @@
   }
 
   unsigned NumFunctions = 0;
-  for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) 
+  for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
     if (!I->isExternal())
       ++NumFunctions;
 
@@ -62,7 +62,7 @@
 
   // Instrument all of the functions...
   unsigned i = 0;
-  for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) 
+  for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
     if (!I->isExternal())
       // Insert counter at the start of the function
       IncrementCounterInBlock(I->begin(), i++, Counters);
@@ -93,7 +93,7 @@
   }
 
   unsigned NumBlocks = 0;
-  for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) 
+  for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
     NumBlocks += I->size();
 
   const Type *ATy = ArrayType::get(Type::UIntTy, NumBlocks);
@@ -103,7 +103,7 @@
 
   // Instrument all of the blocks...
   unsigned i = 0;
-  for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) 
+  for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
     for (Function::iterator BB = I->begin(), E = I->end(); BB != E; ++BB)
       // Insert counter at the start of the block
       IncrementCounterInBlock(BB, i++, Counters);


Index: llvm/lib/Transforms/Instrumentation/EdgeProfiling.cpp
diff -u llvm/lib/Transforms/Instrumentation/EdgeProfiling.cpp:1.5 llvm/lib/Transforms/Instrumentation/EdgeProfiling.cpp:1.6
--- llvm/lib/Transforms/Instrumentation/EdgeProfiling.cpp:1.5	Fri Jan  7 00:57:28 2005
+++ llvm/lib/Transforms/Instrumentation/EdgeProfiling.cpp	Thu Apr 21 18:40:46 2005
@@ -1,10 +1,10 @@
 //===- EdgeProfiling.cpp - Insert counters for edge profiling -------------===//
-// 
+//
 //                      The LLVM Compiler Infrastructure
 //
 // This file was developed by the LLVM research group and is distributed under
 // the University of Illinois Open Source License. See LICENSE.TXT for details.
-// 
+//
 //===----------------------------------------------------------------------===//
 //
 // This pass instruments the specified program with counters for edge profiling.


Index: llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp
diff -u llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp:1.22 llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp:1.23
--- llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp:1.22	Wed Jan  5 23:46:44 2005
+++ llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp	Thu Apr 21 18:40:46 2005
@@ -1,10 +1,10 @@
 //===-- EmitFunctions.cpp - interface to insert instrumentation -----------===//
-// 
+//
 //                     The LLVM Compiler Infrastructure
 //
 // This file was developed by the LLVM research group and is distributed under
 // the University of Illinois Open Source License. See LICENSE.TXT for details.
-// 
+//
 //===----------------------------------------------------------------------===//
 //
 // This inserts into the input module three new global constants containing
@@ -27,7 +27,7 @@
 #include "llvm/Transforms/Instrumentation.h"
 using namespace llvm;
 
-namespace llvm { 
+namespace llvm {
 
 namespace {
   enum Color{
@@ -35,11 +35,11 @@
     GREY,
     BLACK
   };
-  
+
   struct EmitFunctionTable : public ModulePass {
     bool runOnModule(Module &M);
   };
-  
+
   RegisterOpt<EmitFunctionTable>
   X("emitfuncs", "Emit a function table for the reoptimizer");
 }
@@ -48,9 +48,9 @@
   color[node] = GREY;
 
   for(succ_iterator vl = succ_begin(node), ve = succ_end(node); vl != ve; ++vl){
-   
-    BasicBlock *BB = *vl; 
-    
+
+    BasicBlock *BB = *vl;
+
     if(color[BB]!=GREY && color[BB]!=BLACK){
       if(!doDFS(BB, color)){
 	return 0;
@@ -75,7 +75,7 @@
 // Per Module pass for inserting function table
 bool EmitFunctionTable::runOnModule(Module &M){
   std::vector<const Type*> vType;
- 
+
   std::vector<Constant *> vConsts;
   std::vector<Constant *> sBCons;
 
@@ -83,24 +83,24 @@
   for(Module::iterator MI = M.begin(), ME = M.end(); MI != ME; ++MI)
     if (!MI->isExternal()) {
       vType.push_back(MI->getType());
-    
+
       //std::cerr<<MI;
 
       vConsts.push_back(MI);
       sBCons.push_back(ConstantInt::get(Type::SByteTy, hasBackEdge(MI)));
-      
+
       counter++;
     }
-  
+
   StructType *sttype = StructType::get(vType);
   Constant *cstruct = ConstantStruct::get(sttype, vConsts);
 
   GlobalVariable *gb = new GlobalVariable(cstruct->getType(), true,
-                                          GlobalValue::ExternalLinkage, 
+                                          GlobalValue::ExternalLinkage,
                                           cstruct, "llvmFunctionTable");
   M.getGlobalList().push_back(gb);
 
-  Constant *constArray = ConstantArray::get(ArrayType::get(Type::SByteTy, 
+  Constant *constArray = ConstantArray::get(ArrayType::get(Type::SByteTy,
 								sBCons.size()),
 						 sBCons);
 
@@ -110,9 +110,9 @@
 
   M.getGlobalList().push_back(funcArray);
 
-  ConstantInt *cnst = ConstantSInt::get(Type::IntTy, counter); 
-  GlobalVariable *fnCount = new GlobalVariable(Type::IntTy, true, 
-					       GlobalValue::ExternalLinkage, 
+  ConstantInt *cnst = ConstantSInt::get(Type::IntTy, counter);
+  GlobalVariable *fnCount = new GlobalVariable(Type::IntTy, true,
+					       GlobalValue::ExternalLinkage,
 					       cnst, "llvmFunctionCount");
   M.getGlobalList().push_back(fnCount);
   return true;  // Always modifies program


Index: llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp
diff -u llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.5 llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.6
--- llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.5	Mon Mar 14 22:54:21 2005
+++ llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp	Thu Apr 21 18:40:46 2005
@@ -1,10 +1,10 @@
 //===- ProfilingUtils.cpp - Helper functions shared by profilers ----------===//
-// 
+//
 //                     The LLVM Compiler Infrastructure
 //
 // This file was developed by the LLVM research group and is distributed under
 // the University of Illinois Open Source License. See LICENSE.TXT for details.
-// 
+//
 //===----------------------------------------------------------------------===//
 //
 // This files implements a few helper functions which are used by profile
@@ -51,7 +51,7 @@
     Args[2] = ConstantPointerNull::get(UIntPtr);
   }
   Args[3] = ConstantUInt::get(Type::UIntTy, NumElements);
-  
+
   Instruction *InitCall = new CallInst(InitFn, Args, "newargc", InsertPos);
 
   // If argc or argv are not available in main, just pass null values in.
@@ -80,7 +80,7 @@
       AI->replaceAllUsesWith(InitCall);
       InitCall->setOperand(1, AI);
     }
-    
+
   case 0: break;
   }
 }


Index: llvm/lib/Transforms/Instrumentation/ProfilingUtils.h
diff -u llvm/lib/Transforms/Instrumentation/ProfilingUtils.h:1.4 llvm/lib/Transforms/Instrumentation/ProfilingUtils.h:1.5
--- llvm/lib/Transforms/Instrumentation/ProfilingUtils.h:1.4	Fri Nov 19 10:24:57 2004
+++ llvm/lib/Transforms/Instrumentation/ProfilingUtils.h	Thu Apr 21 18:40:46 2005
@@ -1,10 +1,10 @@
 //===- ProfilingUtils.h - Helper functions shared by profilers --*- C++ -*-===//
-// 
+//
 //                     The LLVM Compiler Infrastructure
 //
 // This file was developed by the LLVM research group and is distributed under
 // the University of Illinois Open Source License. See LICENSE.TXT for details.
-// 
+//
 //===----------------------------------------------------------------------===//
 //
 // This files defines a few helper functions which are used by profile


Index: llvm/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp
diff -u llvm/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp:1.10 llvm/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp:1.11
--- llvm/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp:1.10	Fri Jan  7 00:57:28 2005
+++ llvm/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp	Thu Apr 21 18:40:46 2005
@@ -1,10 +1,10 @@
 //===- TraceBasicBlocks.cpp - Insert basic-block trace instrumentation ----===//
-// 
+//
 //                      The LLVM Compiler Infrastructure
 //
 // This file was developed by the LLVM research group and is distributed under
 // the University of Illinois Open Source License. See LICENSE.TXT for details.
-// 
+//
 //===----------------------------------------------------------------------===//
 //
 // This pass instruments the specified program with calls into a runtime


Index: llvm/lib/Transforms/Instrumentation/TraceValues.cpp
diff -u llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.72 llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.73
--- llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.72	Mon Mar 14 22:54:21 2005
+++ llvm/lib/Transforms/Instrumentation/TraceValues.cpp	Thu Apr 21 18:40:46 2005
@@ -1,10 +1,10 @@
 //===- TraceValues.cpp - Value Tracing for debugging ----------------------===//
-// 
+//
 //                     The LLVM Compiler Infrastructure
 //
 // This file was developed by the LLVM research group and is distributed under
 // the University of Illinois Open Source License. See LICENSE.TXT for details.
-// 
+//
 //===----------------------------------------------------------------------===//
 //
 // Support for inserting LLVM code to print values at basic block and function
@@ -41,7 +41,7 @@
 
 // We trace a particular function if no functions to trace were specified
 // or if the function is in the specified list.
-// 
+//
 inline static bool
 TraceThisFunction(Function &F)
 {
@@ -58,19 +58,19 @@
     Function *RecordPtrFunc, *PushOnEntryFunc, *ReleaseOnReturnFunc;
     void doInitialization(Module &M); // Add prototypes for external functions
   };
-  
+
   class InsertTraceCode : public FunctionPass {
   protected:
     ExternalFuncs externalFuncs;
   public:
-    
+
     // Add a prototype for runtime functions not already in the program.
     //
     bool doInitialization(Module &M);
-    
+
     //--------------------------------------------------------------------------
     // Function InsertCodeToTraceValues
-    // 
+    //
     // Inserts tracing code for all live values at basic block and/or function
     // exits as specified by `traceBasicBlockExits' and `traceFunctionExits'.
     //
@@ -131,13 +131,13 @@
   // uint (sbyte*)
   HashPtrFunc = M.getOrInsertFunction("HashPointerToSeqNum", Type::UIntTy, SBP,
                                       0);
-  
+
   // void (sbyte*)
-  ReleasePtrFunc = M.getOrInsertFunction("ReleasePointerSeqNum", 
+  ReleasePtrFunc = M.getOrInsertFunction("ReleasePointerSeqNum",
                                          Type::VoidTy, SBP, 0);
   RecordPtrFunc  = M.getOrInsertFunction("RecordPointer",
                                          Type::VoidTy, SBP, 0);
-  
+
   PushOnEntryFunc = M.getOrInsertFunction("PushPointerSet", Type::VoidTy, 0);
   ReleaseOnReturnFunc = M.getOrInsertFunction("ReleasePointersPopSet",
                                               Type::VoidTy, 0);
@@ -158,7 +158,7 @@
 
   // Create the global variable and record it in the module
   // The GV will be renamed to a unique name if needed.
-  GlobalVariable *GV = new GlobalVariable(Init->getType(), true, 
+  GlobalVariable *GV = new GlobalVariable(Init->getType(), true,
                                           GlobalValue::InternalLinkage, Init,
                                           "trstr");
   M->getGlobalList().push_back(GV);
@@ -166,12 +166,12 @@
 }
 
 
-// 
+//
 // Check if this instruction has any uses outside its basic block,
 // or if it used by either a Call or Return instruction (ditto).
 // (Values stored to memory within this BB are live at end of BB but are
 // traced at the store instruction, not where they are computed.)
-// 
+//
 static inline bool LiveAtBBExit(const Instruction* I) {
   const BasicBlock *BB = I->getParent();
   for (Value::use_const_iterator U = I->use_begin(); U != I->use_end(); ++U)
@@ -186,7 +186,7 @@
 static inline bool TraceThisOpCode(unsigned opCode) {
   // Explicitly test for opCodes *not* to trace so that any new opcodes will
   // be traced by default (VoidTy's are already excluded)
-  // 
+  //
   return (opCode  < Instruction::OtherOpsBegin &&
           opCode != Instruction::Alloca &&
           opCode != Instruction::PHI &&
@@ -198,7 +198,7 @@
 // by a real computation, not just a copy (see TraceThisOpCode), and
 // -- it is a load instruction: we want to check values read from memory
 // -- or it is live at exit from the basic block (i.e., ignore local temps)
-// 
+//
 static bool ShouldTraceValue(const Instruction *I) {
   return
     I->getType() != Type::VoidTy &&
@@ -216,7 +216,7 @@
     return DisablePtrHashing ? "0x%p" : "%d";
   else if (V->getType()->isIntegral())
     return "%d";
-  
+
   assert(0 && "Illegal value to print out...");
   return "";
 }
@@ -245,7 +245,7 @@
   // Turn the format string into an sbyte *
   Constant *GEP=ConstantExpr::getGetElementPtr(fmtVal,
                 std::vector<Constant*>(2,Constant::getNullValue(Type::LongTy)));
-  
+
   // Insert a call to the hash function if this is a pointer value
   if (V && isa<PointerType>(V->getType()) && !DisablePtrHashing) {
     const Type *SBP = PointerType::get(Type::SByteTy);
@@ -255,14 +255,14 @@
     std::vector<Value*> HashArgs(1, V);
     V = new CallInst(HashPtrToSeqNum, HashArgs, "ptrSeqNum", InsertBefore);
   }
-  
+
   // Insert the first print instruction to print the string flag:
   std::vector<Value*> PrintArgs;
   PrintArgs.push_back(GEP);
   if (V) PrintArgs.push_back(V);
   new CallInst(Printf, PrintArgs, "trace", InsertBefore);
 }
-                            
+
 
 static void InsertVerbosePrintInst(Value *V, BasicBlock *BB,
                                    Instruction *InsertBefore,
@@ -274,11 +274,11 @@
                   Printf, HashPtrToSeqNum);
 }
 
-static void 
+static void
 InsertReleaseInst(Value *V, BasicBlock *BB,
                   Instruction *InsertBefore,
                   Function* ReleasePtrFunc) {
-  
+
   const Type *SBP = PointerType::get(Type::SByteTy);
   if (V->getType() != SBP)    // Cast pointer to be sbyte*
     V = new CastInst(V, SBP, "RPSN_cast", InsertBefore);
@@ -287,7 +287,7 @@
   new CallInst(ReleasePtrFunc, releaseArgs, "", InsertBefore);
 }
 
-static void 
+static void
 InsertRecordInst(Value *V, BasicBlock *BB,
                  Instruction *InsertBefore,
                  Function* RecordPtrFunc) {
@@ -302,17 +302,17 @@
 // Look for alloca and free instructions. These are the ptrs to release.
 // Release the free'd pointers immediately.  Record the alloca'd pointers
 // to be released on return from the current function.
-// 
+//
 static void
 ReleasePtrSeqNumbers(BasicBlock *BB,
                      ExternalFuncs& externalFuncs) {
-  
+
   for (BasicBlock::iterator II=BB->begin(), IE = BB->end(); II != IE; ++II)
     if (FreeInst *FI = dyn_cast<FreeInst>(II))
       InsertReleaseInst(FI->getOperand(0), BB, FI,externalFuncs.ReleasePtrFunc);
     else if (AllocaInst *AI = dyn_cast<AllocaInst>(II))
       InsertRecordInst(AI, BB, AI->getNext(), externalFuncs.RecordPtrFunc);
-}  
+}
 
 
 // Insert print instructions at the end of basic block BB for each value
@@ -323,15 +323,15 @@
 // for printing at the exit from the function.  (Note that in each invocation
 // of the function, this will only get the last value stored for each static
 // store instruction).
-// 
+//
 static void TraceValuesAtBBExit(BasicBlock *BB,
                                 Function *Printf, Function* HashPtrToSeqNum,
                             std::vector<Instruction*> *valuesStoredInFunction) {
   // Get an iterator to point to the insertion location, which is
   // just before the terminator instruction.
-  // 
+  //
   TerminatorInst *InsertPos = BB->getTerminator();
-  
+
   std::ostringstream OutStr;
   WriteAsOperand(OutStr, BB, false);
   InsertPrintInst(0, BB, InsertPos, "LEAVING BB:" + OutStr.str(),
@@ -340,7 +340,7 @@
   // Insert a print instruction for each instruction preceding InsertPos.
   // The print instructions must go before InsertPos, so we use the
   // instruction *preceding* InsertPos to check when to terminate the loop.
-  // 
+  //
   for (BasicBlock::iterator II = BB->begin(); &*II != InsertPos; ++II) {
     if (StoreInst *SI = dyn_cast<StoreInst>(II)) {
       // Trace the stored value and address
@@ -380,12 +380,12 @@
                                                 Function* HashPtrToSeqNum) {
   // Get an iterator to point to the insertion location
   ReturnInst *Ret = cast<ReturnInst>(BB->getTerminator());
-  
+
   std::ostringstream OutStr;
   WriteAsOperand(OutStr, BB->getParent(), true);
   InsertPrintInst(0, BB, Ret, "LEAVING  FUNCTION: " + OutStr.str(),
                   Printf, HashPtrToSeqNum);
-  
+
   // print the return value, if any
   if (BB->getParent()->getReturnType() != Type::VoidTy)
     InsertPrintInst(Ret->getReturnValue(), BB, Ret, "  Returning: ",
@@ -396,14 +396,14 @@
 bool InsertTraceCode::runOnFunction(Function &F) {
   if (!TraceThisFunction(F))
     return false;
-  
+
   std::vector<Instruction*> valuesStoredInFunction;
   std::vector<BasicBlock*>  exitBlocks;
 
   // Insert code to trace values at function entry
   InsertCodeToShowFunctionEntry(F, externalFuncs.PrintfFunc,
                                 externalFuncs.HashPtrFunc);
-  
+
   // Push a pointer set for recording alloca'd pointers at entry.
   if (!DisablePtrHashing)
     new CallInst(externalFuncs.PushOnEntryFunc, std::vector<Value*>(), "",
@@ -419,18 +419,18 @@
     if (!DisablePtrHashing)          // release seq. numbers on free/ret
       ReleasePtrSeqNumbers(BB, externalFuncs);
   }
-  
+
   for (unsigned i=0; i != exitBlocks.size(); ++i)
     {
       // Insert code to trace values at function exit
       InsertCodeToShowFunctionExit(exitBlocks[i], externalFuncs.PrintfFunc,
                                    externalFuncs.HashPtrFunc);
-      
+
       // Release all recorded pointers before RETURN.  Do this LAST!
       if (!DisablePtrHashing)
         new CallInst(externalFuncs.ReleaseOnReturnFunc, std::vector<Value*>(),
                      "", exitBlocks[i]->getTerminator());
     }
-  
+
   return true;
 }






More information about the llvm-commits mailing list