[llvm-commits] [llvm] r91873 - /llvm/trunk/include/llvm/Type.h

Chris Lattner sabre at nondot.org
Mon Dec 21 17:17:43 PST 2009


Author: lattner
Date: Mon Dec 21 19:17:43 2009
New Revision: 91873

URL: http://llvm.org/viewvc/llvm-project?rev=91873&view=rev
Log:
types don't need atomic inc/dec, they are local to an llvmcontext.

Modified:
    llvm/trunk/include/llvm/Type.h

Modified: llvm/trunk/include/llvm/Type.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Type.h?rev=91873&r1=91872&r2=91873&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Type.h (original)
+++ llvm/trunk/include/llvm/Type.h Mon Dec 21 19:17:43 2009
@@ -7,14 +7,12 @@
 //
 //===----------------------------------------------------------------------===//
 
-
 #ifndef LLVM_TYPE_H
 #define LLVM_TYPE_H
 
 #include "llvm/AbstractTypeUser.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/System/DataTypes.h"
-#include "llvm/System/Atomic.h"
 #include "llvm/ADT/GraphTraits.h"
 #include <string>
 #include <vector>
@@ -104,7 +102,7 @@
   /// has no AbstractTypeUsers, the type is deleted.  This is only sensical for
   /// derived types.
   ///
-  mutable sys::cas_flag RefCount;
+  mutable unsigned RefCount;
 
   /// Context - This refers to the LLVMContext in which this type was uniqued.
   LLVMContext &Context;
@@ -401,7 +399,7 @@
 
   void addRef() const {
     assert(isAbstract() && "Cannot add a reference to a non-abstract type!");
-    sys::AtomicIncrement(&RefCount);
+    ++RefCount;
   }
 
   void dropRef() const {
@@ -410,8 +408,7 @@
 
     // If this is the last PATypeHolder using this object, and there are no
     // PATypeHandles using it, the type is dead, delete it now.
-    sys::cas_flag OldCount = sys::AtomicDecrement(&RefCount);
-    if (OldCount == 0 && AbstractTypeUsers.empty())
+    if (RefCount-- == 0 && AbstractTypeUsers.empty())
       this->destroy();
   }
   





More information about the llvm-commits mailing list