[llvm] r239459 - Replace magic number 19 with the constant GlobalValueSubClassDataBits.

Yaron Keren yaron.keren at gmail.com
Tue Jun 9 23:00:59 PDT 2015


Author: yrnkrn
Date: Wed Jun 10 01:00:59 2015
New Revision: 239459

URL: http://llvm.org/viewvc/llvm-project?rev=239459&view=rev
Log:
Replace magic number 19 with the constant GlobalValueSubClassDataBits.


Modified:
    llvm/trunk/include/llvm/IR/GlobalValue.h

Modified: llvm/trunk/include/llvm/IR/GlobalValue.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/GlobalValue.h?rev=239459&r1=239458&r2=239459&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/GlobalValue.h (original)
+++ llvm/trunk/include/llvm/IR/GlobalValue.h Wed Jun 10 01:00:59 2015
@@ -83,11 +83,12 @@ protected:
 
   unsigned ThreadLocal : 3; // Is this symbol "Thread Local", if so, what is
                             // the desired model?
+  static const unsigned GlobalValueSubClassDataBits = 19;
 
 private:
   // Give subclasses access to what otherwise would be wasted padding.
   // (19 + 3 + 2 + 1 + 2 + 5) == 32.
-  unsigned SubClassData : 19;
+  unsigned SubClassData : GlobalValueSubClassDataBits;
 
 protected:
   /// \brief The intrinsic ID for this subclass (which must be a Function).
@@ -98,12 +99,11 @@ protected:
   /// This is stored here to save space in Function on 64-bit hosts.
   Intrinsic::ID IntID;
 
-  static const unsigned GlobalValueSubClassDataBits = 19;
   unsigned getGlobalValueSubClassData() const {
     return SubClassData;
   }
   void setGlobalValueSubClassData(unsigned V) {
-    assert(V < (1 << 19) && "It will not fit");
+    assert(V < (1 << GlobalValueSubClassDataBits) && "It will not fit");
     SubClassData = V;
   }
 





More information about the llvm-commits mailing list