summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Colombet <qcolombet@apple.com>2012-10-30 16:32:52 +0000
committerQuentin Colombet <qcolombet@apple.com>2012-10-30 16:32:52 +0000
commit9a419f656e278b96e9dfe739cd63c7bff9a4e1fd (patch)
tree1a0b0791da616cf4941091deb4d7e941fe162b7e
parent446cf94cdbbc1f8e22452fc46664ac73d810c6a2 (diff)
downloadllvm-9a419f656e278b96e9dfe739cd63c7bff9a4e1fd.tar.gz
llvm-9a419f656e278b96e9dfe739cd63c7bff9a4e1fd.tar.bz2
llvm-9a419f656e278b96e9dfe739cd63c7bff9a4e1fd.tar.xz
Change ForceSizeOpt attribute into MinSize attribute
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167020 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Attributes.h6
-rw-r--r--lib/AsmParser/LLLexer.cpp2
-rw-r--r--lib/AsmParser/LLParser.cpp4
-rw-r--r--lib/AsmParser/LLToken.h2
-rw-r--r--lib/Target/ARM/ARMISelLowering.cpp8
-rw-r--r--lib/Target/CppBackend/CPPBackend.cpp1
-rw-r--r--lib/VMCore/Attributes.cpp6
-rw-r--r--test/CodeGen/ARM/call-noret-minsize.ll (renamed from test/CodeGen/ARM/call-noret-forsize.ll)4
-rw-r--r--test/Feature/forceoptsize_attr.ll7
-rw-r--r--test/Feature/minsize_attr.ll7
10 files changed, 24 insertions, 23 deletions
diff --git a/include/llvm/Attributes.h b/include/llvm/Attributes.h
index 5350e3ea2d..5ace200803 100644
--- a/include/llvm/Attributes.h
+++ b/include/llvm/Attributes.h
@@ -58,9 +58,9 @@ public:
///< 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 @@ public:
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 @@ public:
.removeAttribute(Attributes::NonLazyBind)
.removeAttribute(Attributes::ReturnsTwice)
.removeAttribute(Attributes::AddressSafety)
- .removeAttribute(Attributes::ForceSizeOpt);
+ .removeAttribute(Attributes::MinSize);
}
uint64_t Raw() const { return Bits; }
diff --git a/lib/AsmParser/LLLexer.cpp b/lib/AsmParser/LLLexer.cpp
index 91f973d8d3..a60e4aa41c 100644
--- a/lib/AsmParser/LLLexer.cpp
+++ b/lib/AsmParser/LLLexer.cpp
@@ -558,7 +558,7 @@ lltok::Kind LLLexer::LexIdentifier() {
KEYWORD(naked);
KEYWORD(nonlazybind);
KEYWORD(address_safety);
- KEYWORD(forcesizeopt);
+ KEYWORD(minsize);
KEYWORD(type);
KEYWORD(opaque);
diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp
index 75fc16cd95..ac803c5783 100644
--- a/lib/AsmParser/LLParser.cpp
+++ b/lib/AsmParser/LLParser.cpp
@@ -953,7 +953,7 @@ bool LLParser::ParseOptionalAttrs(AttrBuilder &B, unsigned AttrKind) {
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 @@ bool LLParser::ParseOptionalAttrs(AttrBuilder &B, unsigned AttrKind) {
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;
diff --git a/lib/AsmParser/LLToken.h b/lib/AsmParser/LLToken.h
index 6cffc52d17..036686d318 100644
--- a/lib/AsmParser/LLToken.h
+++ b/lib/AsmParser/LLToken.h
@@ -110,7 +110,7 @@ namespace lltok {
kw_naked,
kw_nonlazybind,
kw_address_safety,
- kw_forcesizeopt,
+ kw_minsize,
kw_type,
kw_opaque,
diff --git a/lib/Target/ARM/ARMISelLowering.cpp b/lib/Target/ARM/ARMISelLowering.cpp
index e4bc31c481..3b8d79be97 100644
--- a/lib/Target/ARM/ARMISelLowering.cpp
+++ b/lib/Target/ARM/ARMISelLowering.cpp
@@ -1594,15 +1594,15 @@ ARMTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
// 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 @@ ARMTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
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
diff --git a/lib/Target/CppBackend/CPPBackend.cpp b/lib/Target/CppBackend/CPPBackend.cpp
index dd00b7d48b..0f3efd8345 100644
--- a/lib/Target/CppBackend/CPPBackend.cpp
+++ b/lib/Target/CppBackend/CPPBackend.cpp
@@ -507,6 +507,7 @@ void CppWriter::printAttributes(const AttrListPtr &PAL,
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";
diff --git a/lib/VMCore/Attributes.cpp b/lib/VMCore/Attributes.cpp
index 642d4fcffb..5a552c34e1 100644
--- a/lib/VMCore/Attributes.cpp
+++ b/lib/VMCore/Attributes.cpp
@@ -201,8 +201,8 @@ std::string Attributes::getAsString() const {
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 @@ uint64_t AttributesImpl::getAttrMask(uint64_t Val) {
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");
}
diff --git a/test/CodeGen/ARM/call-noret-forsize.ll b/test/CodeGen/ARM/call-noret-minsize.ll
index 04643f5643..35490ac69b 100644
--- a/test/CodeGen/ARM/call-noret-forsize.ll
+++ b/test/CodeGen/ARM/call-noret-minsize.ll
@@ -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 @@ entry:
unreachable
}
-define void @t2() noreturn forcesizeopt nounwind ssp {
+define void @t2() noreturn minsize nounwind ssp {
entry:
; ARM: t2:
; ARM: bl _t1
diff --git a/test/Feature/forceoptsize_attr.ll b/test/Feature/forceoptsize_attr.ll
deleted file mode 100644
index 89f2a5fcd8..0000000000
--- a/test/Feature/forceoptsize_attr.ll
+++ /dev/null
@@ -1,7 +0,0 @@
-; RUN: llvm-as < %s | llvm-dis | FileCheck %s
-
-define void @test1() forcesizeopt {
-; CHECK: define void @test1() forcesizeopt
- ret void
-}
-
diff --git a/test/Feature/minsize_attr.ll b/test/Feature/minsize_attr.ll
new file mode 100644
index 0000000000..51b133c4bd
--- /dev/null
+++ b/test/Feature/minsize_attr.ll
@@ -0,0 +1,7 @@
+; RUN: llvm-as < %s | llvm-dis | FileCheck %s
+
+define void @test1() minsize {
+; CHECK: define void @test1() minsize
+ ret void
+}
+