From 3971df5203146649a34dc50d217c0cc072d39be9 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Tue, 25 Jan 2011 19:09:56 +0000 Subject: [PATCH] Move unnamed_addr after the function arguments on Sabre's request. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124209 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AsmParser/LLParser.cpp | 8 ++++---- lib/VMCore/AsmWriter.cpp | 4 ++-- test/Assembler/unnamed-addr.ll | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index 04e2e601e2b..8ef46344175 100644 --- a/lib/AsmParser/LLParser.cpp +++ b/lib/AsmParser/LLParser.cpp @@ -2670,8 +2670,6 @@ bool LLParser::ParseFunctionHeader(Function *&Fn, bool isDefine) { unsigned Linkage; unsigned Visibility, RetAttrs; - bool UnnamedAddr; - LocTy UnnamedAddrLoc; CallingConv::ID CC; PATypeHolder RetType(Type::getVoidTy(Context)); LocTy RetTypeLoc = Lex.getLoc(); @@ -2679,8 +2677,6 @@ bool LLParser::ParseFunctionHeader(Function *&Fn, bool isDefine) { ParseOptionalVisibility(Visibility) || ParseOptionalCallingConv(CC) || ParseOptionalAttrs(RetAttrs, 1) || - ParseOptionalToken(lltok::kw_unnamed_addr, UnnamedAddr, - &UnnamedAddrLoc) || ParseType(RetType, RetTypeLoc, true /*void allowed*/)) return true; @@ -2742,8 +2738,12 @@ bool LLParser::ParseFunctionHeader(Function *&Fn, bool isDefine) { std::string Section; unsigned Alignment; std::string GC; + bool UnnamedAddr; + LocTy UnnamedAddrLoc; if (ParseArgumentList(ArgList, isVarArg, false) || + ParseOptionalToken(lltok::kw_unnamed_addr, UnnamedAddr, + &UnnamedAddrLoc) || ParseOptionalAttrs(FuncAttrs, 2) || (EatIfPresent(lltok::kw_section) && ParseStringConstant(Section)) || diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index 3fefbbcafb9..1a11d9c7980 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -1590,8 +1590,6 @@ void AssemblyWriter::printFunction(const Function *F) { Attributes RetAttrs = Attrs.getRetAttributes(); if (RetAttrs != Attribute::None) Out << Attribute::getAsString(Attrs.getRetAttributes()) << ' '; - if (F->hasUnnamedAddr()) - Out << "unnamed_addr "; TypePrinter.print(F->getReturnType(), Out); Out << ' '; WriteAsOperandInternal(Out, F, &TypePrinter, &Machine, F->getParent()); @@ -1631,6 +1629,8 @@ void AssemblyWriter::printFunction(const Function *F) { Out << "..."; // Output varargs portion of signature! } Out << ')'; + if (F->hasUnnamedAddr()) + Out << " unnamed_addr"; Attributes FnAttrs = Attrs.getFnAttributes(); if (FnAttrs != Attribute::None) Out << ' ' << Attribute::getAsString(Attrs.getFnAttributes()); diff --git a/test/Assembler/unnamed-addr.ll b/test/Assembler/unnamed-addr.ll index a4828c3c45c..3c94ca21308 100644 --- a/test/Assembler/unnamed-addr.ll +++ b/test/Assembler/unnamed-addr.ll @@ -5,7 +5,7 @@ @bar.d = internal unnamed_addr constant %struct.foobar zeroinitializer, align 4 @foo.d = internal constant %struct.foobar zeroinitializer, align 4 -define unnamed_addr i32 @main() nounwind ssp { +define i32 @main() unnamed_addr nounwind ssp { entry: %call2 = tail call i32 @zed(%struct.foobar* @foo.d, %struct.foobar* @bar.d) nounwind ret i32 0 @@ -15,4 +15,4 @@ declare i32 @zed(%struct.foobar*, %struct.foobar*) ; CHECK: @bar.d = internal unnamed_addr constant %struct.foobar zeroinitializer, align 4 ; CHECK: @foo.d = internal constant %struct.foobar zeroinitializer, align 4 -; CHECK: define unnamed_addr i32 @main() nounwind ssp { +; CHECK: define i32 @main() unnamed_addr nounwind ssp { -- 2.34.1