[llvm-branch-commits] [cfe-branch] r122478 - in /cfe/branches/Apple/whitney: include/clang/AST/ASTContext.h include/clang/AST/Type.h lib/AST/ASTContext.cpp

Daniel Dunbar daniel at zuster.org
Wed Dec 22 21:40:16 PST 2010


Author: ddunbar
Date: Wed Dec 22 23:40:16 2010
New Revision: 122478

URL: http://llvm.org/viewvc/llvm-project?rev=122478&view=rev
Log:
Merge r121474:
--
Author: Douglas Gregor <dgregor at apple.com>
Date:   Fri Dec 10 08:57:38 2010 +0000

    Move the "volatile" bit into QualType's "fast" qualifier set,
    increasing the required type alignment from 8 to 16. This provides a
    2.5% speedup for -fsyntax-only on a token-cached Cocoa.h, while only
    increasing memory consumption in the ASTContext by 0.8%.

Modified:
    cfe/branches/Apple/whitney/include/clang/AST/ASTContext.h
    cfe/branches/Apple/whitney/include/clang/AST/Type.h
    cfe/branches/Apple/whitney/lib/AST/ASTContext.cpp

Modified: cfe/branches/Apple/whitney/include/clang/AST/ASTContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/include/clang/AST/ASTContext.h?rev=122478&r1=122477&r2=122478&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/include/clang/AST/ASTContext.h (original)
+++ cfe/branches/Apple/whitney/include/clang/AST/ASTContext.h Wed Dec 22 23:40:16 2010
@@ -466,7 +466,9 @@
   /// getVolatileType - Returns the uniqued reference to the type for a
   /// 'volatile' qualified type.  The resulting type has a union of the
   /// qualifiers from T and 'volatile'.
-  QualType getVolatileType(QualType T);
+  QualType getVolatileType(QualType T) {
+    return T.withFastQualifiers(Qualifiers::Volatile);
+  }
 
   /// getConstType - Returns the uniqued reference to the type for a
   /// 'const' qualified type.  The resulting type has a union of the

Modified: cfe/branches/Apple/whitney/include/clang/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/include/clang/AST/Type.h?rev=122478&r1=122477&r2=122478&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/include/clang/AST/Type.h (original)
+++ cfe/branches/Apple/whitney/include/clang/AST/Type.h Wed Dec 22 23:40:16 2010
@@ -35,7 +35,7 @@
 using llvm::dyn_cast_or_null;
 namespace clang {
   enum {
-    TypeAlignmentInBits = 3,
+    TypeAlignmentInBits = 4,
     TypeAlignment = 1 << TypeAlignmentInBits
   };
   class Type;
@@ -129,7 +129,7 @@
     MaxAddressSpace = 0xffffffu,
 
     /// The width of the "fast" qualifier mask.
-    FastWidth = 2,
+    FastWidth = 3,
 
     /// The fast qualifier mask.
     FastMask = (1 << FastWidth) - 1
@@ -380,8 +380,6 @@
 
   Qualifiers getQualifiers() const { return Quals; }
 
-  bool hasVolatile() const { return Quals.hasVolatile(); }
-
   bool hasObjCGCAttr() const { return Quals.hasObjCGCAttr(); }
   Qualifiers::GC getObjCGCAttr() const { return Quals.getObjCGCAttr(); }
 
@@ -511,7 +509,7 @@
   /// "volatile" qualifier set, without looking through typedefs that may have
   /// added "volatile" at a different level.
   bool isLocalVolatileQualified() const {
-    return (hasLocalNonFastQualifiers() && getExtQualsUnsafe()->hasVolatile());
+    return (getLocalFastQualifiers() & Qualifiers::Volatile);
   }
 
   /// \brief Determine whether this type is volatile-qualified.
@@ -552,10 +550,7 @@
   /// local to this particular QualType instance, not including any qualifiers
   /// acquired through typedefs or other sugar.
   unsigned getLocalCVRQualifiers() const {
-    unsigned CVR = getLocalFastQualifiers();
-    if (isLocalVolatileQualified())
-      CVR |= Qualifiers::Volatile;
-    return CVR;
+    return getLocalFastQualifiers();
   }
 
   /// \brief Retrieve the set of CVR (const-volatile-restrict) qualifiers 

Modified: cfe/branches/Apple/whitney/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/AST/ASTContext.cpp?rev=122478&r1=122477&r2=122478&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/AST/ASTContext.cpp (original)
+++ cfe/branches/Apple/whitney/lib/AST/ASTContext.cpp Wed Dec 22 23:40:16 2010
@@ -1085,17 +1085,6 @@
   return T;
 }
 
-QualType ASTContext::getVolatileType(QualType T) {
-  QualType CanT = getCanonicalType(T);
-  if (CanT.isVolatileQualified()) return T;
-
-  QualifierCollector Quals;
-  const Type *TypeNode = Quals.strip(T);
-  Quals.addVolatile();
-
-  return getExtQualType(TypeNode, Quals);
-}
-
 QualType ASTContext::getAddrSpaceQualType(QualType T, unsigned AddressSpace) {
   QualType CanT = getCanonicalType(T);
   if (CanT.getAddressSpace() == AddressSpace)





More information about the llvm-branch-commits mailing list