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

Jeff Cohen jeffc at jolt-lang.org
Sat Oct 22 21:37:39 PDT 2005



Changes in directory llvm/lib/Transforms/Instrumentation:

ProfilingUtils.cpp updated: 1.6 -> 1.7
TraceBasicBlocks.cpp updated: 1.12 -> 1.13
TraceValues.cpp updated: 1.74 -> 1.75
---
Log message:

When a function takes a variable number of pointer arguments, with a zero
pointer marking the end of the list, the zero *must* be cast to the pointer
type.  An un-cast zero is a 32-bit int, and at least on x86_64, gcc will
not extend the zero to 64 bits, thus allowing the upper 32 bits to be
random junk.

The new END_WITH_NULL macro may be used to annotate a such a function
so that GCC (version 4 or newer) will detect the use of un-casted zero
at compile time.


---
Diffs of the changes:  (+9 -7)

 ProfilingUtils.cpp   |    3 ++-
 TraceBasicBlocks.cpp |    2 +-
 TraceValues.cpp      |   11 ++++++-----
 3 files changed, 9 insertions(+), 7 deletions(-)


Index: llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp
diff -u llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.6 llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.7
--- llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.6	Thu Apr 21 18:40:46 2005
+++ llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp	Sat Oct 22 23:37:20 2005
@@ -26,7 +26,8 @@
   const PointerType *UIntPtr = PointerType::get(Type::UIntTy);
   Module &M = *MainFn->getParent();
   Function *InitFn = M.getOrInsertFunction(FnName, Type::IntTy, Type::IntTy,
-                                           ArgVTy, UIntPtr, Type::UIntTy, 0);
+                                           ArgVTy, UIntPtr, Type::UIntTy,
+                                           (Type *)0);
 
   // This could force argc and argv into programs that wouldn't otherwise have
   // them, but instead we just pass null values in.


Index: llvm/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp
diff -u llvm/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp:1.12 llvm/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp:1.13
--- llvm/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp:1.12	Sat Apr 23 16:38:35 2005
+++ llvm/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp	Sat Oct 22 23:37:20 2005
@@ -46,7 +46,7 @@
                    << "\", \"" << FnName << "\", " << BBNumber << ")\n");
   Module &M = *BB->getParent ()->getParent ();
   Function *InstrFn = M.getOrInsertFunction (FnName, Type::VoidTy,
-                                             Type::UIntTy, 0);
+                                             Type::UIntTy, (Type *)0);
   std::vector<Value*> Args (1);
   Args[0] = ConstantUInt::get (Type::UIntTy, BBNumber);
 


Index: llvm/lib/Transforms/Instrumentation/TraceValues.cpp
diff -u llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.74 llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.75
--- llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.74	Sat Apr 23 16:38:35 2005
+++ llvm/lib/Transforms/Instrumentation/TraceValues.cpp	Sat Oct 22 23:37:20 2005
@@ -130,17 +130,18 @@
 
   // uint (sbyte*)
   HashPtrFunc = M.getOrInsertFunction("HashPointerToSeqNum", Type::UIntTy, SBP,
-                                      0);
+                                      (Type *)0);
 
   // void (sbyte*)
   ReleasePtrFunc = M.getOrInsertFunction("ReleasePointerSeqNum",
-                                         Type::VoidTy, SBP, 0);
+                                         Type::VoidTy, SBP, (Type *)0);
   RecordPtrFunc  = M.getOrInsertFunction("RecordPointer",
-                                         Type::VoidTy, SBP, 0);
+                                         Type::VoidTy, SBP, (Type *)0);
 
-  PushOnEntryFunc = M.getOrInsertFunction("PushPointerSet", Type::VoidTy, 0);
+  PushOnEntryFunc = M.getOrInsertFunction("PushPointerSet", Type::VoidTy,
+                                          (Type *)0);
   ReleaseOnReturnFunc = M.getOrInsertFunction("ReleasePointersPopSet",
-                                              Type::VoidTy, 0);
+                                              Type::VoidTy, (Type *)0);
 }
 
 






More information about the llvm-commits mailing list