Initial implementation of 'fence' instruction, the new C++0x-style replacement for...
[oota-llvm.git] / include / llvm / Attributes.h
index 126c290b5a74f9ff22300dd9300120e5e9502013..cd3ee35d7497c0059b252d1a982b086201e23697 100644 (file)
@@ -60,11 +60,30 @@ const Attributes NoImplicitFloat = 1<<23; /// disable implicit floating point
 const Attributes Naked           = 1<<24; ///< Naked function
 const Attributes InlineHint      = 1<<25; ///< source said inlining was
                                           ///desirable
-const Attributes StackAlignment  = 31<<26; ///< Alignment of stack for
-                                           ///function (5 bits) stored as log2
-                                           ///of alignment with +1 bias
-                                           ///0 means unaligned (different from
-                                           ///alignstack(1))
+const Attributes StackAlignment  = 7<<26; ///< Alignment of stack for
+                                          ///function (3 bits) stored as log2
+                                          ///of alignment with +1 bias
+                                          ///0 means unaligned (different from
+                                          ///alignstack(1))
+const Attributes Hotpatch    = 1<<29;     ///< Function should have special
+                                          ///'hotpatch' sequence in prologue
+const Attributes UWTable     = 1<<30;     ///< Function must be in a unwind
+                                          ///table
+const Attributes NonLazyBind = 1U<<31;    ///< Function is called early and/or
+                                          ///  often, so lazy binding isn't
+                                          ///  worthwhile.
+
+/// Note that uwtable is about the ABI or the user mandating an entry in the
+/// unwind table. The nounwind attribute is about an exception passing by the
+/// function.
+/// In a theoretical system that uses tables for profiling and sjlj for
+/// exceptions, they would be fully independent. In a normal system that
+/// uses tables for both, the semantics are:
+/// nil                = Needs an entry because an exception might pass by.
+/// nounwind           = No need for an entry
+/// uwtable            = Needs an entry because the ABI says so and because
+///                      an exception might pass by.
+/// uwtable + nounwind = Needs an entry because the ABI says so.
 
 /// @brief Attributes that only apply to function parameters.
 const Attributes ParameterOnly = ByVal | Nest | StructRet | NoCapture;
@@ -73,7 +92,8 @@ const Attributes ParameterOnly = ByVal | Nest | StructRet | NoCapture;
 /// be used on return values or function parameters.
 const Attributes FunctionOnly = NoReturn | NoUnwind | ReadNone | ReadOnly |
   NoInline | AlwaysInline | OptimizeForSize | StackProtect | StackProtectReq |
-  NoRedZone | NoImplicitFloat | Naked | InlineHint | StackAlignment;
+  NoRedZone | NoImplicitFloat | Naked | InlineHint | StackAlignment |
+  Hotpatch | UWTable | NonLazyBind;
 
 /// @brief Parameter attributes that do not apply to vararg call arguments.
 const Attributes VarArgsIncompatible = StructRet;
@@ -87,7 +107,7 @@ const Attributes MutuallyIncompatible[4] = {
 };
 
 /// @brief Which attributes cannot be applied to a type.
-Attributes typeIncompatible(const Type *Ty);
+Attributes typeIncompatible(Type *Ty);
 
 /// This turns an int alignment (a power of 2, normally) into the
 /// form used internally in Attributes.
@@ -118,7 +138,7 @@ inline Attributes constructStackAlignmentFromInt(unsigned i) {
     return 0;
 
   assert(isPowerOf2_32(i) && "Alignment must be a power of two.");
-  assert(i <= 0x40000000 && "Alignment too large.");
+  assert(i <= 0x100 && "Alignment too large.");
   return (Log2_32(i)+1) << 26;
 }
 
@@ -223,7 +243,7 @@ public:
   /// paramHasAttr - Return true if the specified parameter index has the
   /// specified attribute set.
   bool paramHasAttr(unsigned Idx, Attributes Attr) const {
-    return getAttributes(Idx) & Attr;
+    return (getAttributes(Idx) & Attr) != 0;
   }
 
   /// getParamAlignment - Return the alignment for the specified function