[llvm-commits] [llvm] r73980 - in /llvm/trunk: include/llvm/System/Atomic.h include/llvm/Type.h lib/System/Atomic.cpp lib/VMCore/Mangler.cpp
Owen Anderson
resistor at mac.com
Tue Jun 23 11:30:27 PDT 2009
Author: resistor
Date: Tue Jun 23 13:30:27 2009
New Revision: 73980
URL: http://llvm.org/viewvc/llvm-project?rev=73980&view=rev
Log:
Atomic ops that do arithmetic use signed arithmetic.
Modified:
llvm/trunk/include/llvm/System/Atomic.h
llvm/trunk/include/llvm/Type.h
llvm/trunk/lib/System/Atomic.cpp
llvm/trunk/lib/VMCore/Mangler.cpp
Modified: llvm/trunk/include/llvm/System/Atomic.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Atomic.h?rev=73980&r1=73979&r2=73980&view=diff
==============================================================================
--- llvm/trunk/include/llvm/System/Atomic.h (original)
+++ llvm/trunk/include/llvm/System/Atomic.h Tue Jun 23 13:30:27 2009
@@ -23,11 +23,11 @@
uint32_t CompareAndSwap32(volatile uint32_t* ptr,
uint32_t new_value,
uint32_t old_value);
- uint32_t AtomicIncrement32(volatile uint32_t* ptr);
- uint32_t AtomicDecrement32(volatile uint32_t* ptr);
- uint32_t AtomicAdd32(volatile uint32_t* ptr, uint32_t val);
+ int32_t AtomicIncrement32(volatile int32_t* ptr);
+ int32_t AtomicDecrement32(volatile int32_t* ptr);
+ int32_t AtomicAdd32(volatile int32_t* ptr, int32_t val);
- uint64_t AtomicAdd64(volatile uint64_t* ptr, uint64_t val);
+ int64_t AtomicAdd64(volatile int64_t* ptr, int64_t val);
}
}
Modified: llvm/trunk/include/llvm/Type.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Type.h?rev=73980&r1=73979&r2=73980&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Type.h (original)
+++ llvm/trunk/include/llvm/Type.h Tue Jun 23 13:30:27 2009
@@ -103,7 +103,7 @@
/// has no AbstractTypeUsers, the type is deleted. This is only sensical for
/// derived types.
///
- mutable uint32_t RefCount;
+ mutable int32_t RefCount;
const Type *getForwardedTypeInternal() const;
@@ -347,7 +347,7 @@
// If this is the last PATypeHolder using this object, and there are no
// PATypeHandles using it, the type is dead, delete it now.
- uint32_t Count = sys::AtomicDecrement32(&RefCount);
+ int32_t Count = sys::AtomicDecrement32(&RefCount);
if (Count == 0 && AbstractTypeUsers.empty())
this->destroy();
}
Modified: llvm/trunk/lib/System/Atomic.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Atomic.cpp?rev=73980&r1=73979&r2=73980&view=diff
==============================================================================
--- llvm/trunk/lib/System/Atomic.cpp (original)
+++ llvm/trunk/lib/System/Atomic.cpp Tue Jun 23 13:30:27 2009
@@ -52,7 +52,7 @@
#endif
}
-uint32_t sys::AtomicIncrement32(volatile uint32_t* ptr) {
+int32_t sys::AtomicIncrement32(volatile int32_t* ptr) {
#if LLVM_MULTITHREADED==0
++(*ptr);
return *ptr;
@@ -65,7 +65,7 @@
#endif
}
-uint32_t sys::AtomicDecrement32(volatile uint32_t* ptr) {
+int32_t sys::AtomicDecrement32(volatile int32_t* ptr) {
#if LLVM_MULTITHREADED==0
--(*ptr);
return *ptr;
@@ -78,7 +78,7 @@
#endif
}
-uint32_t sys::AtomicAdd32(volatile uint32_t* ptr, uint32_t val) {
+int32_t sys::AtomicAdd32(volatile int32_t* ptr, int32_t val) {
#if LLVM_MULTITHREADED==0
*ptr += val;
return *ptr;
@@ -91,7 +91,7 @@
#endif
}
-uint64_t sys::AtomicAdd64(volatile uint64_t* ptr, uint64_t val) {
+int64_t sys::AtomicAdd64(volatile int64_t* ptr, int64_t val) {
#if LLVM_MULTITHREADED==0
*ptr += val;
return *ptr;
Modified: llvm/trunk/lib/VMCore/Mangler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Mangler.cpp?rev=73980&r1=73979&r2=73980&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Mangler.cpp (original)
+++ llvm/trunk/lib/VMCore/Mangler.cpp Tue Jun 23 13:30:27 2009
@@ -165,9 +165,9 @@
} else if (!GV->hasName()) {
// Must mangle the global into a unique ID.
unsigned TypeUniqueID = getTypeID(GV->getType());
- static uint32_t GlobalID = 0;
+ static int32_t GlobalID = 0;
- unsigned OldID = GlobalID;
+ int32_t OldID = GlobalID;
sys::AtomicIncrement32(&GlobalID);
Name = "__unnamed_" + utostr(TypeUniqueID) + "_" + utostr(OldID);
More information about the llvm-commits
mailing list