summaryrefslogtreecommitdiff
path: root/lib/VMCore/AsmWriter.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-01-05 17:06:19 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-01-05 17:06:19 +0000
commit2c261789d3f6826b42a010b8ff0115519ba31525 (patch)
treeb149c55e04bd0f8ddfc2833d3efa3ea79a30f152 /lib/VMCore/AsmWriter.cpp
parentbdcb9dfc3a20e12a40637431b342b0a0d3d26e1b (diff)
downloadllvm-2c261789d3f6826b42a010b8ff0115519ba31525.tar.gz
llvm-2c261789d3f6826b42a010b8ff0115519ba31525.tar.bz2
llvm-2c261789d3f6826b42a010b8ff0115519ba31525.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32904 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/AsmWriter.cpp')
-rw-r--r--lib/VMCore/AsmWriter.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index a46adabd1e..f5b2484429 100644
--- a/lib/VMCore/AsmWriter.cpp
+++ b/lib/VMCore/AsmWriter.cpp
@@ -271,10 +271,6 @@ static void calcTypeName(const Type *Ty,
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 @@ static void calcTypeName(const Type *Ty,
Result += "...";
}
Result += ")";
+ if (FTy->getParamAttrs(0)) {
+ Result += " ";
+ Result += FunctionType::getParamAttrsText(FTy->getParamAttrs(0));
+ }
break;
}
case Type::StructTyID: {
@@ -698,8 +698,6 @@ private:
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 @@ std::ostream &AssemblyWriter::printTypeAtLeastOneLevel(const Type *Ty) {
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 @@ void AssemblyWriter::printFunction(const Function *F) {
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 @@ void AssemblyWriter::printFunction(const Function *F) {
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 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
(!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 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
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 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
(!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 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
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);