summaryrefslogtreecommitdiff
path: root/include/llvm
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-06-23 20:17:22 +0000
committerOwen Anderson <resistor@mac.com>2009-06-23 20:17:22 +0000
commit6f2c64d70aad5328a843a6f6a6547ada69ead33b (patch)
tree4daa65427ce630a0a020fb9ca1d426187ab98aa3 /include/llvm
parentdcee6847555373c6f352370042486ef904a3d55b (diff)
downloadllvm-6f2c64d70aad5328a843a6f6a6547ada69ead33b.tar.gz
llvm-6f2c64d70aad5328a843a6f6a6547ada69ead33b.tar.bz2
llvm-6f2c64d70aad5328a843a6f6a6547ada69ead33b.tar.xz
Revert my last series of commits related to Timer and 64-bit atomics. Not all the targets
we care about are capable of supporting it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73993 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/Support/Timer.h20
-rw-r--r--include/llvm/System/Atomic.h15
-rw-r--r--include/llvm/Type.h8
3 files changed, 21 insertions, 22 deletions
diff --git a/include/llvm/Support/Timer.h b/include/llvm/Support/Timer.h
index f34fc95410..584199f440 100644
--- a/include/llvm/Support/Timer.h
+++ b/include/llvm/Support/Timer.h
@@ -34,12 +34,12 @@ class TimerGroup;
/// if they are never started.
///
class Timer {
- int64_t Elapsed; // Wall clock time elapsed in seconds
- int64_t UserTime; // User time elapsed
- int64_t SystemTime; // System time elapsed
- int64_t MemUsed; // Memory allocated (in bytes)
- int64_t PeakMem; // Peak memory used
- int64_t PeakMemBase; // Temporary for peak calculation...
+ double Elapsed; // Wall clock time elapsed in seconds
+ double UserTime; // User time elapsed
+ double SystemTime; // System time elapsed
+ ssize_t MemUsed; // Memory allocated (in bytes)
+ size_t PeakMem; // Peak memory used
+ size_t PeakMemBase; // Temporary for peak calculation...
std::string Name; // The name of this time variable
bool Started; // Has this time variable ever been started?
TimerGroup *TG; // The TimerGroup this Timer is in.
@@ -49,10 +49,10 @@ public:
Timer(const Timer &T);
~Timer();
- int64_t getProcessTime() const { return UserTime+SystemTime; }
- int64_t getWallTime() const { return Elapsed; }
- int64_t getMemUsed() const { return MemUsed; }
- int64_t getPeakMem() const { return PeakMem; }
+ double getProcessTime() const { return UserTime+SystemTime; }
+ double getWallTime() const { return Elapsed; }
+ ssize_t getMemUsed() const { return MemUsed; }
+ size_t getPeakMem() const { return PeakMem; }
std::string getName() const { return Name; }
const Timer &operator=(const Timer &T) {
diff --git a/include/llvm/System/Atomic.h b/include/llvm/System/Atomic.h
index c0612f9976..c4049d40da 100644
--- a/include/llvm/System/Atomic.h
+++ b/include/llvm/System/Atomic.h
@@ -20,14 +20,13 @@ namespace llvm {
namespace sys {
void MemoryFence();
- uint32_t CompareAndSwap32(volatile uint32_t* ptr,
- uint32_t new_value,
- uint32_t old_value);
- int32_t AtomicIncrement32(volatile int32_t* ptr);
- int32_t AtomicDecrement32(volatile int32_t* ptr);
- int32_t AtomicAdd32(volatile int32_t* ptr, int32_t val);
-
- int64_t AtomicAdd64(volatile int64_t* ptr, int64_t val);
+ typedef uint32_t cas_flag;
+ cas_flag CompareAndSwap(volatile cas_flag* ptr,
+ cas_flag new_value,
+ cas_flag old_value);
+ cas_flag AtomicIncrement(volatile cas_flag* ptr);
+ cas_flag AtomicDecrement(volatile cas_flag* ptr);
+ cas_flag AtomicAdd(volatile cas_flag* ptr, cas_flag val);
}
}
diff --git a/include/llvm/Type.h b/include/llvm/Type.h
index 97d5043dc4..d439233d8c 100644
--- a/include/llvm/Type.h
+++ b/include/llvm/Type.h
@@ -103,7 +103,7 @@ private:
/// has no AbstractTypeUsers, the type is deleted. This is only sensical for
/// derived types.
///
- mutable int32_t RefCount;
+ mutable sys::cas_flag RefCount;
const Type *getForwardedTypeInternal() const;
@@ -338,7 +338,7 @@ public:
void addRef() const {
assert(isAbstract() && "Cannot add a reference to a non-abstract type!");
- sys::AtomicIncrement32(&RefCount);
+ sys::AtomicIncrement(&RefCount);
}
void dropRef() const {
@@ -347,8 +347,8 @@ public:
// If this is the last PATypeHolder using this object, and there are no
// PATypeHandles using it, the type is dead, delete it now.
- int32_t Count = sys::AtomicDecrement32(&RefCount);
- if (Count == 0 && AbstractTypeUsers.empty())
+ sys::cas_flag OldCount = sys::AtomicDecrement(&RefCount);
+ if (OldCount == 0 && AbstractTypeUsers.empty())
this->destroy();
}