[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LowerAllocations.cpp LowerGC.cpp LowerInvoke.cpp
Jeff Cohen
jeffc at jolt-lang.org
Sat Oct 22 21:37:40 PDT 2005
Changes in directory llvm/lib/Transforms/Scalar:
LowerAllocations.cpp updated: 1.54 -> 1.55
LowerGC.cpp updated: 1.8 -> 1.9
LowerInvoke.cpp updated: 1.33 -> 1.34
---
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: (+8 -7)
LowerAllocations.cpp | 2 +-
LowerGC.cpp | 5 +++--
LowerInvoke.cpp | 8 ++++----
3 files changed, 8 insertions(+), 7 deletions(-)
Index: llvm/lib/Transforms/Scalar/LowerAllocations.cpp
diff -u llvm/lib/Transforms/Scalar/LowerAllocations.cpp:1.54 llvm/lib/Transforms/Scalar/LowerAllocations.cpp:1.55
--- llvm/lib/Transforms/Scalar/LowerAllocations.cpp:1.54 Fri May 6 01:48:21 2005
+++ llvm/lib/Transforms/Scalar/LowerAllocations.cpp Sat Oct 22 23:37:20 2005
@@ -83,7 +83,7 @@
MallocFunc = M.getOrInsertFunction("malloc", FT);
}
if (FreeFunc == 0)
- FreeFunc = M.getOrInsertFunction("free" , Type::VoidTy, SBPTy, 0);
+ FreeFunc = M.getOrInsertFunction("free" , Type::VoidTy, SBPTy, (Type *)0);
return true;
}
Index: llvm/lib/Transforms/Scalar/LowerGC.cpp
diff -u llvm/lib/Transforms/Scalar/LowerGC.cpp:1.8 llvm/lib/Transforms/Scalar/LowerGC.cpp:1.9
--- llvm/lib/Transforms/Scalar/LowerGC.cpp:1.8 Thu Apr 21 18:45:12 2005
+++ llvm/lib/Transforms/Scalar/LowerGC.cpp Sat Oct 22 23:37:20 2005
@@ -109,10 +109,11 @@
// If the program is using read/write barriers, find the implementations of
// them from the GC runtime library.
if (GCReadInt) // Make: sbyte* %llvm_gc_read(sbyte**)
- GCRead = M.getOrInsertFunction("llvm_gc_read", VoidPtr, VoidPtr, VoidPtrPtr, 0);
+ GCRead = M.getOrInsertFunction("llvm_gc_read", VoidPtr, VoidPtr, VoidPtrPtr,
+ (Type *)0);
if (GCWriteInt) // Make: void %llvm_gc_write(sbyte*, sbyte**)
GCWrite = M.getOrInsertFunction("llvm_gc_write", Type::VoidTy,
- VoidPtr, VoidPtr, VoidPtrPtr, 0);
+ VoidPtr, VoidPtr, VoidPtrPtr, (Type *)0);
// If the program has GC roots, get or create the global root list.
if (GCRootInt) {
Index: llvm/lib/Transforms/Scalar/LowerInvoke.cpp
diff -u llvm/lib/Transforms/Scalar/LowerInvoke.cpp:1.33 llvm/lib/Transforms/Scalar/LowerInvoke.cpp:1.34
--- llvm/lib/Transforms/Scalar/LowerInvoke.cpp:1.33 Fri Sep 30 22:57:14 2005
+++ llvm/lib/Transforms/Scalar/LowerInvoke.cpp Sat Oct 22 23:37:20 2005
@@ -124,14 +124,14 @@
Constant::getNullValue(PtrJBList),
"llvm.sjljeh.jblist", &M);
SetJmpFn = M.getOrInsertFunction("llvm.setjmp", Type::IntTy,
- PointerType::get(JmpBufTy), NULL);
+ PointerType::get(JmpBufTy), (Type *)0);
LongJmpFn = M.getOrInsertFunction("llvm.longjmp", Type::VoidTy,
PointerType::get(JmpBufTy),
- Type::IntTy, NULL);
+ Type::IntTy, (Type *)0);
}
// We need the 'write' and 'abort' functions for both models.
- AbortFn = M.getOrInsertFunction("abort", Type::VoidTy, NULL);
+ AbortFn = M.getOrInsertFunction("abort", Type::VoidTy, (Type *)0);
// Unfortunately, 'write' can end up being prototyped in several different
// ways. If the user defines a three (or more) operand function named 'write'
@@ -148,7 +148,7 @@
WriteFn = 0;
} else {
WriteFn = M.getOrInsertFunction("write", Type::VoidTy, Type::IntTy,
- VoidPtrTy, Type::IntTy, NULL);
+ VoidPtrTy, Type::IntTy, (Type *)0);
}
return true;
}
More information about the llvm-commits
mailing list