Move more methods out-of-line. This is in preparation for changing the internal
authorBill Wendling <isanbard@gmail.com>
Sun, 7 Oct 2012 08:55:05 +0000 (08:55 +0000)
committerBill Wendling <isanbard@gmail.com>
Sun, 7 Oct 2012 08:55:05 +0000 (08:55 +0000)
contents of the Attributes class over to an AttributesImpl.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165373 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Attributes.h
lib/VMCore/Attributes.cpp

index a3d6849879f55eb152dcf8e3c9a956f6d61e197e..6f250285bb299ff10c8052b82a28fd6f977dce9f 100644 (file)
@@ -196,10 +196,7 @@ public:
   bool hasAttributes() const {
     return Bits != 0;
   }
-  bool hasAttributes(const Attributes &A) const {
-    return Bits & A.Bits;
-  }
-
+  bool hasAttributes(const Attributes &A) const;
   bool hasAddressSafetyAttr() const;
   bool hasAlignmentAttr() const;
   bool hasAlwaysInlineAttr() const;
@@ -236,9 +233,10 @@ public:
   /// value.
   unsigned getStackAlignment() const;
 
+  bool isEmptyOrSingleton() const;
+
   // This is a "safe bool() operator".
   operator const void *() const { return Bits ? this : 0; }
-  bool isEmptyOrSingleton() const { return (Bits & (Bits - 1)) == 0; }
   bool operator == (const Attributes &Attrs) const {
     return Bits == Attrs.Bits;
   }
@@ -246,24 +244,13 @@ public:
     return Bits != Attrs.Bits;
   }
 
-  Attributes operator | (const Attributes &Attrs) const {
-    return Attributes(Bits | Attrs.Bits);
-  }
-  Attributes operator & (const Attributes &Attrs) const {
-    return Attributes(Bits & Attrs.Bits);
-  }
-  Attributes operator ^ (const Attributes &Attrs) const {
-    return Attributes(Bits ^ Attrs.Bits);
-  }
-  Attributes &operator |= (const Attributes &Attrs) {
-    Bits |= Attrs.Bits;
-    return *this;
-  }
-  Attributes &operator &= (const Attributes &Attrs) {
-    Bits &= Attrs.Bits;
-    return *this;
-  }
-  Attributes operator ~ () const { return Attributes(~Bits); }
+  Attributes operator | (const Attributes &Attrs) const;
+  Attributes operator & (const Attributes &Attrs) const;
+  Attributes operator ^ (const Attributes &Attrs) const;
+  Attributes &operator |= (const Attributes &Attrs);
+  Attributes &operator &= (const Attributes &Attrs);
+  Attributes operator ~ () const;
+
   uint64_t Raw() const { return Bits; }
 
   /// constructAlignmentFromInt - This turns an int alignment (a power of 2,
@@ -307,11 +294,11 @@ public:
     // Store the alignment in the bitcode as a 16-bit raw value instead of a
     // 5-bit log2 encoded value. Shift the bits above the alignment up by 11
     // bits.
-    uint64_t EncodedAttrs = Attrs.Bits & 0xffff;
+    uint64_t EncodedAttrs = Attrs.Raw() & 0xffff;
     if (Attrs.hasAlignmentAttr())
       EncodedAttrs |= (1ULL << 16) <<
-        (((Attrs.Bits & Attribute::Alignment_i) - 1) >> 16);
-    EncodedAttrs |= (Attrs.Bits & (0xfffULL << 21)) << 11;
+        (((Attrs.Raw() & Attribute::Alignment_i) - 1) >> 16);
+    EncodedAttrs |= (Attrs.Raw() & (0xfffULL << 21)) << 11;
     return EncodedAttrs;
   }
 
index 12f0699c02a3e7b22a8011151a939099778172db..d1b693b4c682f1931d86b4d9d4432fd77be2f849 100644 (file)
@@ -28,6 +28,9 @@ using namespace llvm;
 // Attribute Function Definitions
 //===----------------------------------------------------------------------===//
 
+bool Attributes::hasAttributes(const Attributes &A) const {
+  return Bits & A.Bits;
+}
 bool Attributes::hasAddressSafetyAttr() const {
   return Bits & Attribute::AddressSafety_i;
 }
@@ -125,6 +128,31 @@ unsigned Attributes::getStackAlignment() const {
   return 1U << (((Bits & Attribute::StackAlignment_i) >> 26) - 1);
 }
 
+bool Attributes::isEmptyOrSingleton() const {
+  return (Bits & (Bits - 1)) == 0;
+}
+
+Attributes Attributes::operator | (const Attributes &Attrs) const {
+  return Attributes(Bits | Attrs.Bits);
+}
+Attributes Attributes::operator & (const Attributes &Attrs) const {
+  return Attributes(Bits & Attrs.Bits);
+}
+Attributes Attributes::operator ^ (const Attributes &Attrs) const {
+  return Attributes(Bits ^ Attrs.Bits);
+}
+Attributes &Attributes::operator |= (const Attributes &Attrs) {
+  Bits |= Attrs.Bits;
+  return *this;
+}
+Attributes &Attributes::operator &= (const Attributes &Attrs) {
+  Bits &= Attrs.Bits;
+  return *this;
+}
+Attributes Attributes::operator ~ () const {
+  return Attributes(~Bits);
+}
+
 Attributes Attributes::typeIncompatible(Type *Ty) {
   Attributes::Builder Incompatible;