Introducing nocapture, a parameter attribute for pointers to indicate that the
[oota-llvm.git] / lib / VMCore / Attributes.cpp
index 92acc111be952f21ddcc3b2570c525492ceb7757..0a0d0a842d0dbc36aa39cbe3a301757092511687 100644 (file)
@@ -37,6 +37,8 @@ std::string Attribute::getAsString(Attributes Attrs) {
     Result += "inreg ";
   if (Attrs & Attribute::NoAlias)
     Result += "noalias ";
+  if (Attrs & Attribute::NoCapture)
+    Result += "nocapture ";
   if (Attrs & Attribute::StructRet)
     Result += "sret ";  
   if (Attrs & Attribute::ByVal)
@@ -59,10 +61,11 @@ std::string Attribute::getAsString(Attributes Attrs) {
     Result += "sspreq ";
   if (Attrs & Attribute::Alignment) {
     Result += "align ";
-    Result += utostr((Attrs & Attribute::Alignment) >> 16);
+    Result += utostr(1ull << ((Attrs & Attribute::Alignment)>>16));
     Result += " ";
   }
   // Trim the trailing space.
+  assert(!Result.empty() && "Unknown attribute!");
   Result.erase(Result.end()-1);
   return Result;
 }
@@ -76,7 +79,7 @@ Attributes Attribute::typeIncompatible(const Type *Ty) {
   
   if (!isa<PointerType>(Ty))
     // Attributes that only apply to pointers.
-    Incompatible |= ByVal | Nest | NoAlias | StructRet;
+    Incompatible |= ByVal | Nest | NoAlias | StructRet | NoCapture;
   
   return Incompatible;
 }