Move MaximumAlignment to be a member of the Value class.
authorDan Gohman <gohman@apple.com>
Fri, 30 Jul 2010 21:07:05 +0000 (21:07 +0000)
committerDan Gohman <gohman@apple.com>
Fri, 30 Jul 2010 21:07:05 +0000 (21:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109891 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Value.h
lib/AsmParser/LLParser.cpp
lib/Transforms/InstCombine/InstCombineCalls.cpp

index 0f4c522d3737e93043362fd88fb0ad2386457013..633063523fcd0ec6a158910f15e872e80a305012 100644 (file)
@@ -307,6 +307,10 @@ public:
     return const_cast<Value*>(this)->DoPHITranslation(CurBB, PredBB);
   }
   
+  /// MaximumAlignment - This is the greatest alignment value supported by
+  /// load, store, and alloca instructions, and global values.
+  static const unsigned MaximumAlignment = 1u << 29;
+  
 protected:
   unsigned short getSubclassDataFromValue() const { return SubclassData; }
   void setValueSubclassData(unsigned short D) { SubclassData = D; }
@@ -401,10 +405,6 @@ public:
   enum { NumLowBitsAvailable = 2 };
 };
 
-/// MaximumAlignment - This is the greatest alignment value supported by
-/// load, store, and alloca instructions, and global values.
-static const unsigned MaximumAlignment = 1u << 29;
-
 } // End llvm namespace
 
 #endif
index e581a694586f44b124f0e686c9e4f28a147c996c..c55a16520f91e20cf9db7f4ff5fd3f6243874ffc 100644 (file)
@@ -1154,7 +1154,7 @@ bool LLParser::ParseOptionalAlignment(unsigned &Alignment) {
   if (ParseUInt32(Alignment)) return true;
   if (!isPowerOf2_32(Alignment))
     return Error(AlignLoc, "alignment is not a power of two");
-  if (Alignment > MaximumAlignment)
+  if (Alignment > Value::MaximumAlignment)
     return Error(AlignLoc, "huge alignments are not supported yet");
   return false;
 }
index fdb2dd693d96cffcd5618e319dfe833a461f9390..27ca345b06774270908274254c985725950cd9e3 100644 (file)
@@ -109,9 +109,10 @@ unsigned InstCombiner::GetOrEnforceKnownAlignment(Value *V,
   TrailZ = std::min(TrailZ, unsigned(sizeof(unsigned) * CHAR_BIT - 1));
 
   unsigned Align = 1u << std::min(BitWidth - 1, TrailZ);
+  unsigned MaxAlign = Value::MaximumAlignment;
 
   // LLVM doesn't support alignments larger than this currently.
-  Align = std::min(Align, MaximumAlignment);
+  Align = std::min(Align, MaxAlign);
 
   if (PrefAlign > Align)
     Align = EnforceKnownAlignment(V, Align, PrefAlign);