[llvm-commits] [llvm] r167020 - in /llvm/trunk: include/llvm/Attributes.h lib/AsmParser/LLLexer.cpp lib/AsmParser/LLParser.cpp lib/AsmParser/LLToken.h lib/Target/ARM/ARMISelLowering.cpp lib/Target/CppBackend/CPPBackend.cpp lib/VMCore/Attributes.cpp test/CodeGen/ARM/call-noret-forsize.ll test/CodeGen/ARM/call-noret-minsize.ll test/Feature/forceoptsize_attr.ll test/Feature/minsize_attr.ll

Quentin Colombet qcolombet at apple.com
Tue Oct 30 09:32:52 PDT 2012


Author: qcolombet
Date: Tue Oct 30 11:32:52 2012
New Revision: 167020

URL: http://llvm.org/viewvc/llvm-project?rev=167020&view=rev
Log:
Change ForceSizeOpt attribute into MinSize attribute

Added:
    llvm/trunk/test/CodeGen/ARM/call-noret-minsize.ll
      - copied, changed from r166951, llvm/trunk/test/CodeGen/ARM/call-noret-forsize.ll
    llvm/trunk/test/Feature/minsize_attr.ll
      - copied, changed from r166951, llvm/trunk/test/Feature/forceoptsize_attr.ll
Removed:
    llvm/trunk/test/CodeGen/ARM/call-noret-forsize.ll
    llvm/trunk/test/Feature/forceoptsize_attr.ll
Modified:
    llvm/trunk/include/llvm/Attributes.h
    llvm/trunk/lib/AsmParser/LLLexer.cpp
    llvm/trunk/lib/AsmParser/LLParser.cpp
    llvm/trunk/lib/AsmParser/LLToken.h
    llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
    llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp
    llvm/trunk/lib/VMCore/Attributes.cpp

Modified: llvm/trunk/include/llvm/Attributes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Attributes.h?rev=167020&r1=167019&r2=167020&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Attributes.h (original)
+++ llvm/trunk/include/llvm/Attributes.h Tue Oct 30 11:32:52 2012
@@ -58,9 +58,9 @@
                            ///< 0 means unaligned different from align 1
     AlwaysInline,          ///< inline=always
     ByVal,                 ///< Pass structure by value
-    ForceSizeOpt,          ///< Function must be optimized for size first
     InlineHint,            ///< Source said inlining was desirable
     InReg,                 ///< Force argument to be passed in register
+    MinSize,               ///< Function must be optimized for size first
     Naked,                 ///< Naked function
     Nest,                  ///< Nested function static chain
     NoAlias,               ///< Considered to not alias after call
@@ -154,7 +154,7 @@
       hasAttribute(Attributes::NonLazyBind) ||
       hasAttribute(Attributes::ReturnsTwice) ||
       hasAttribute(Attributes::AddressSafety) ||
-      hasAttribute(Attributes::ForceSizeOpt);
+      hasAttribute(Attributes::MinSize);
   }
 
   bool operator==(const Attributes &A) const {
@@ -266,7 +266,7 @@
       .removeAttribute(Attributes::NonLazyBind)
       .removeAttribute(Attributes::ReturnsTwice)
       .removeAttribute(Attributes::AddressSafety)
-      .removeAttribute(Attributes::ForceSizeOpt);
+      .removeAttribute(Attributes::MinSize);
   }
 
   uint64_t Raw() const { return Bits; }

Modified: llvm/trunk/lib/AsmParser/LLLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLLexer.cpp?rev=167020&r1=167019&r2=167020&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLLexer.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLLexer.cpp Tue Oct 30 11:32:52 2012
@@ -558,7 +558,7 @@
   KEYWORD(naked);
   KEYWORD(nonlazybind);
   KEYWORD(address_safety);
-  KEYWORD(forcesizeopt);
+  KEYWORD(minsize);
 
   KEYWORD(type);
   KEYWORD(opaque);

Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=167020&r1=167019&r2=167020&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Tue Oct 30 11:32:52 2012
@@ -953,7 +953,7 @@
     case lltok::kw_naked:           B.addAttribute(Attributes::Naked); break;
     case lltok::kw_nonlazybind:     B.addAttribute(Attributes::NonLazyBind); break;
     case lltok::kw_address_safety:  B.addAttribute(Attributes::AddressSafety); break;
-    case lltok::kw_forcesizeopt:    B.addAttribute(Attributes::ForceSizeOpt); break;
+    case lltok::kw_minsize:         B.addAttribute(Attributes::MinSize); break;
 
     case lltok::kw_alignstack: {
       unsigned Alignment;
@@ -1012,7 +1012,7 @@
     case lltok::kw_nonlazybind:
     case lltok::kw_returns_twice:
     case lltok::kw_address_safety:
-    case lltok::kw_forcesizeopt:
+    case lltok::kw_minsize:
       if (AttrKind != 2)
         HaveError |= Error(AttrLoc, "invalid use of function-only attribute");
       break;

Modified: llvm/trunk/lib/AsmParser/LLToken.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLToken.h?rev=167020&r1=167019&r2=167020&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLToken.h (original)
+++ llvm/trunk/lib/AsmParser/LLToken.h Tue Oct 30 11:32:52 2012
@@ -110,7 +110,7 @@
     kw_naked,
     kw_nonlazybind,
     kw_address_safety,
-    kw_forcesizeopt,
+    kw_minsize,
 
     kw_type,
     kw_opaque,

Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=167020&r1=167019&r2=167020&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Tue Oct 30 11:32:52 2012
@@ -1594,15 +1594,15 @@
 
   // FIXME: handle tail calls differently.
   unsigned CallOpc;
-  bool HasForceSizeAttr = MF.getFunction()->getFnAttributes().
-                          hasAttribute(Attributes::ForceSizeOpt);
+  bool HasMinSizeAttr = MF.getFunction()->getFnAttributes().
+    hasAttribute(Attributes::MinSize);
   if (Subtarget->isThumb()) {
     if ((!isDirect || isARMFunc) && !Subtarget->hasV5TOps())
       CallOpc = ARMISD::CALL_NOLINK;
     else if (doesNotRet && isDirect && !isARMFunc &&
              Subtarget->hasRAS() && !Subtarget->isThumb1Only() &&
 	     // Emit regular call when code size is the priority
-	     !HasForceSizeAttr)
+	     !HasMinSizeAttr)
       // "mov lr, pc; b _foo" to avoid confusing the RSP
       CallOpc = ARMISD::CALL_NOLINK;
     else
@@ -1612,7 +1612,7 @@
       CallOpc = ARMISD::CALL_NOLINK;
     } else if (doesNotRet && isDirect && Subtarget->hasRAS() &&
 	       // Emit regular call when code size is the priority
-	       !HasForceSizeAttr)
+	       !HasMinSizeAttr)
       // "mov lr, pc; b _foo" to avoid confusing the RSP
       CallOpc = ARMISD::CALL_NOLINK;
     else

Modified: llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp?rev=167020&r1=167019&r2=167020&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp (original)
+++ llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp Tue Oct 30 11:32:52 2012
@@ -507,6 +507,7 @@
       HANDLE_ATTR(ReturnsTwice);
       HANDLE_ATTR(UWTable);
       HANDLE_ATTR(NonLazyBind);
+      HANDLE_ATTR(MinSize);
 #undef HANDLE_ATTR
       if (attrs.hasAttribute(Attributes::StackAlignment))
         Out << "    B.addStackAlignmentAttr(" << attrs.getStackAlignment() << ")\n";

Modified: llvm/trunk/lib/VMCore/Attributes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Attributes.cpp?rev=167020&r1=167019&r2=167020&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Attributes.cpp (original)
+++ llvm/trunk/lib/VMCore/Attributes.cpp Tue Oct 30 11:32:52 2012
@@ -201,8 +201,8 @@
     Result += "nonlazybind ";
   if (hasAttribute(Attributes::AddressSafety))
     Result += "address_safety ";
-  if (hasAttribute(Attributes::ForceSizeOpt))
-    Result += "forcesizeopt ";
+  if (hasAttribute(Attributes::MinSize))
+    Result += "minsize ";
   if (hasAttribute(Attributes::StackAlignment)) {
     Result += "alignstack(";
     Result += utostr(getStackAlignment());
@@ -326,7 +326,7 @@
   case Attributes::UWTable:         return 1 << 30;
   case Attributes::NonLazyBind:     return 1U << 31;
   case Attributes::AddressSafety:   return 1ULL << 32;
-  case Attributes::ForceSizeOpt:    return 1ULL << 33;
+  case Attributes::MinSize:         return 1ULL << 33;
   }
   llvm_unreachable("Unsupported attribute type");
 }

Removed: llvm/trunk/test/CodeGen/ARM/call-noret-forsize.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/call-noret-forsize.ll?rev=167019&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/call-noret-forsize.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/call-noret-forsize.ll (removed)
@@ -1,34 +0,0 @@
-; RUN: llc < %s -mtriple=armv7-apple-ios -mcpu=cortex-a8   | FileCheck %s -check-prefix=ARM
-; RUN: llc < %s -mtriple=armv7-apple-ios -mcpu=swift       | FileCheck %s -check-prefix=SWIFT
-; RUN: llc < %s -mtriple=thumbv7-apple-ios -mcpu=cortex-a8 | FileCheck %s -check-prefix=T2
-; rdar://12348580
-
-define void @t1() noreturn forcesizeopt nounwind ssp {
-entry:
-; ARM: t1:
-; ARM: bl _bar
-
-; SWIFT: t1:
-; SWIFT: bl _bar
-
-; T2: t1:
-; T2: blx _bar
-  tail call void @bar() noreturn nounwind
-  unreachable
-}
-
-define void @t2() noreturn forcesizeopt nounwind ssp {
-entry:
-; ARM: t2:
-; ARM: bl _t1
-
-; SWIFT: t2:
-; SWIFT: bl _t1
-
-; T2: t2:
-; T2: bl _t1
-  tail call void @t1() noreturn nounwind
-  unreachable
-}
-
-declare void @bar() noreturn

Copied: llvm/trunk/test/CodeGen/ARM/call-noret-minsize.ll (from r166951, llvm/trunk/test/CodeGen/ARM/call-noret-forsize.ll)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/call-noret-minsize.ll?p2=llvm/trunk/test/CodeGen/ARM/call-noret-minsize.ll&p1=llvm/trunk/test/CodeGen/ARM/call-noret-forsize.ll&r1=166951&r2=167020&rev=167020&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/call-noret-forsize.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/call-noret-minsize.ll Tue Oct 30 11:32:52 2012
@@ -3,7 +3,7 @@
 ; RUN: llc < %s -mtriple=thumbv7-apple-ios -mcpu=cortex-a8 | FileCheck %s -check-prefix=T2
 ; rdar://12348580
 
-define void @t1() noreturn forcesizeopt nounwind ssp {
+define void @t1() noreturn minsize nounwind ssp {
 entry:
 ; ARM: t1:
 ; ARM: bl _bar
@@ -17,7 +17,7 @@
   unreachable
 }
 
-define void @t2() noreturn forcesizeopt nounwind ssp {
+define void @t2() noreturn minsize nounwind ssp {
 entry:
 ; ARM: t2:
 ; ARM: bl _t1

Removed: llvm/trunk/test/Feature/forceoptsize_attr.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Feature/forceoptsize_attr.ll?rev=167019&view=auto
==============================================================================
--- llvm/trunk/test/Feature/forceoptsize_attr.ll (original)
+++ llvm/trunk/test/Feature/forceoptsize_attr.ll (removed)
@@ -1,7 +0,0 @@
-; RUN: llvm-as < %s | llvm-dis | FileCheck %s
-
-define void @test1() forcesizeopt {
-; CHECK: define void @test1() forcesizeopt
-        ret void
-}
-

Copied: llvm/trunk/test/Feature/minsize_attr.ll (from r166951, llvm/trunk/test/Feature/forceoptsize_attr.ll)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Feature/minsize_attr.ll?p2=llvm/trunk/test/Feature/minsize_attr.ll&p1=llvm/trunk/test/Feature/forceoptsize_attr.ll&r1=166951&r2=167020&rev=167020&view=diff
==============================================================================
--- llvm/trunk/test/Feature/forceoptsize_attr.ll (original)
+++ llvm/trunk/test/Feature/minsize_attr.ll Tue Oct 30 11:32:52 2012
@@ -1,7 +1,7 @@
 ; RUN: llvm-as < %s | llvm-dis | FileCheck %s
 
-define void @test1() forcesizeopt {
-; CHECK: define void @test1() forcesizeopt
+define void @test1() minsize {
+; CHECK: define void @test1() minsize
         ret void
 }
 





More information about the llvm-commits mailing list