Change the syntax for parameter attributes:
1. The @ sign is no longer necessary.
2. We now support "function attributes" as parameter attribute 0.
3. Instead of locating the return type attributes after the type of a
   function result, they are now located after the function header's
   closing paranthesis and before any alignment or section options.
4. The way has been prepared for a new "noreturn" function attribute but
   there is no support for recognizing it in the lexer nor doing anything
   with it if it does get set.
5. The FunctionType::getParamAttrsText method now has support for
   returning multiple attributes. This required a change in its interface.

I'm unhappy that this change leads to 6 new shift/reduce conflicts, but
in each case bison's decision to choose the shift is correct so there
shouldn't be any damage from these conflicts.

llvm-svn: 32904
diff --git a/llvm/lib/VMCore/AsmWriter.cpp b/llvm/lib/VMCore/AsmWriter.cpp
index a46adab..f5b2484 100644
--- a/llvm/lib/VMCore/AsmWriter.cpp
+++ b/llvm/lib/VMCore/AsmWriter.cpp
@@ -271,10 +271,6 @@
   case Type::FunctionTyID: {
     const FunctionType *FTy = cast<FunctionType>(Ty);
     calcTypeName(FTy->getReturnType(), TypeStack, TypeNames, Result);
-    if (FTy->getParamAttrs(0)) {
-      Result += " ";
-      Result += FunctionType::getParamAttrsText(FTy->getParamAttrs(0));
-    }
     Result += " (";
     unsigned Idx = 1;
     for (FunctionType::param_iterator I = FTy->param_begin(),
@@ -293,6 +289,10 @@
       Result += "...";
     }
     Result += ")";
+    if (FTy->getParamAttrs(0)) {
+      Result += " ";
+      Result += FunctionType::getParamAttrsText(FTy->getParamAttrs(0));
+    }
     break;
   }
   case Type::StructTyID: {
@@ -698,8 +698,6 @@
 std::ostream &AssemblyWriter::printTypeAtLeastOneLevel(const Type *Ty) {
   if (const FunctionType *FTy = dyn_cast<FunctionType>(Ty)) {
     printType(FTy->getReturnType());
-    if (FTy->getParamAttrs(0))
-      Out << ' ' << FunctionType::getParamAttrsText(FTy->getParamAttrs(0));
     Out << " (";
     unsigned Idx = 1;
     for (FunctionType::param_iterator I = FTy->param_begin(),
@@ -717,6 +715,8 @@
       Out << "...";
     }
     Out << ')';
+    if (FTy->getParamAttrs(0))
+      Out << ' ' << FunctionType::getParamAttrsText(FTy->getParamAttrs(0));
   } else if (const StructType *STy = dyn_cast<StructType>(Ty)) {
     if (STy->isPacked())
       Out << '<';
@@ -969,8 +969,6 @@
 
   const FunctionType *FT = F->getFunctionType();
   printType(F->getReturnType()) << ' ';
-  if (FT->getParamAttrs(0))
-    Out << FunctionType::getParamAttrsText(FT->getParamAttrs(0)) << ' ';
   if (!F->getName().empty())
     Out << getLLVMName(F->getName());
   else
@@ -995,7 +993,8 @@
     Out << "...";  // Output varargs portion of signature!
   }
   Out << ')';
-
+  if (FT->getParamAttrs(0))
+    Out << ' ' << FunctionType::getParamAttrsText(FT->getParamAttrs(0));
   if (F->hasSection())
     Out << " section \"" << F->getSection() << '"';
   if (F->getAlignment())
@@ -1186,8 +1185,6 @@
         (!isa<PointerType>(RetTy) ||
          !isa<FunctionType>(cast<PointerType>(RetTy)->getElementType()))) {
       Out << ' '; printType(RetTy);
-      if (FTy->getParamAttrs(0) != FunctionType::NoAttributeSet)
-        Out << " " << FTy->getParamAttrsText(FTy->getParamAttrs(0));
       writeOperand(Operand, false);
     } else {
       writeOperand(Operand, true);
@@ -1201,6 +1198,8 @@
         Out << " " << FTy->getParamAttrsText(FTy->getParamAttrs(op));
     }
     Out << " )";
+    if (FTy->getParamAttrs(0) != FunctionType::NoAttributeSet)
+      Out << ' ' << FTy->getParamAttrsText(FTy->getParamAttrs(0));
   } else if (const InvokeInst *II = dyn_cast<InvokeInst>(&I)) {
     const PointerType  *PTy = cast<PointerType>(Operand->getType());
     const FunctionType *FTy = cast<FunctionType>(PTy->getElementType());
@@ -1225,8 +1224,6 @@
         (!isa<PointerType>(RetTy) ||
          !isa<FunctionType>(cast<PointerType>(RetTy)->getElementType()))) {
       Out << ' '; printType(RetTy);
-      if (FTy->getParamAttrs(0) != FunctionType::NoAttributeSet)
-        Out << " " << FTy->getParamAttrsText(FTy->getParamAttrs(0));
       writeOperand(Operand, false);
     } else {
       writeOperand(Operand, true);
@@ -1241,7 +1238,10 @@
         Out << " " << FTy->getParamAttrsText(FTy->getParamAttrs(op-2));
     }
 
-    Out << " )\n\t\t\tto";
+    Out << " )";
+    if (FTy->getParamAttrs(0) != FunctionType::NoAttributeSet)
+      Out << " " << FTy->getParamAttrsText(FTy->getParamAttrs(0));
+    Out << "\n\t\t\tto";
     writeOperand(II->getNormalDest(), true);
     Out << " unwind";
     writeOperand(II->getUnwindDest(), true);