diff options
author | Nadav Rotem <nrotem@apple.com> | 2012-10-22 17:33:31 +0000 |
---|---|---|
committer | Nadav Rotem <nrotem@apple.com> | 2012-10-22 17:33:31 +0000 |
commit | e743942bc8f8b067e014b8cbd2a205a53c7c67f9 (patch) | |
tree | b19333deb9ae6ffccc5dad9fd0c62635361288ed /lib/VMCore | |
parent | 5f7d81022398f332b222552f5d980c4e3f1c542c (diff) | |
download | llvm-e743942bc8f8b067e014b8cbd2a205a53c7c67f9.tar.gz llvm-e743942bc8f8b067e014b8cbd2a205a53c7c67f9.tar.bz2 llvm-e743942bc8f8b067e014b8cbd2a205a53c7c67f9.tar.xz |
Add the "ForceSizeOpt" attribute.
Patch by Quentin Colombet <qcolombet@apple.com>
Original description:
"""
The attached patch is the first step to have a better control on Oz related optimizations.
The Oz optimization level focuses on code size, thus I propose to add an attribute called ForceSizeOpt.
"""
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166422 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r-- | lib/VMCore/Attributes.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/VMCore/Attributes.cpp b/lib/VMCore/Attributes.cpp index 4f55fb203b..642d4fcffb 100644 --- a/lib/VMCore/Attributes.cpp +++ b/lib/VMCore/Attributes.cpp @@ -127,7 +127,7 @@ uint64_t Attributes::encodeLLVMAttributesForBitcode(Attributes Attrs) { uint64_t EncodedAttrs = Attrs.Raw() & 0xffff; if (Attrs.hasAttribute(Attributes::Alignment)) EncodedAttrs |= Attrs.getAlignment() << 16; - EncodedAttrs |= (Attrs.Raw() & (0xfffULL << 21)) << 11; + EncodedAttrs |= (Attrs.Raw() & (0xffffULL << 21)) << 11; return EncodedAttrs; } @@ -145,7 +145,7 @@ Attributes Attributes::decodeLLVMAttributesForBitcode(LLVMContext &C, AttrBuilder B(EncodedAttrs & 0xffff); if (Alignment) B.addAlignmentAttr(Alignment); - B.addRawValue((EncodedAttrs & (0xfffULL << 32)) >> 11); + B.addRawValue((EncodedAttrs & (0xffffULL << 32)) >> 11); return Attributes::get(C, B); } @@ -201,6 +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::StackAlignment)) { Result += "alignstack("; Result += utostr(getStackAlignment()); @@ -324,6 +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; } llvm_unreachable("Unsupported attribute type"); } |