diff options
author | Diego Novillo <dnovillo@google.com> | 2013-05-24 12:26:52 +0000 |
---|---|---|
committer | Diego Novillo <dnovillo@google.com> | 2013-05-24 12:26:52 +0000 |
commit | c63995394de60996ebfe52a47cf2e3a0716d7e3c (patch) | |
tree | a74f82a4691d823a2fc5ab2d87c5798f68174cf1 /llvm/lib/IR/Attributes.cpp | |
parent | 646ec67e252f7daa5fe1f5d7719f247c89293b0c (diff) | |
download | llvm-c63995394de60996ebfe52a47cf2e3a0716d7e3c.zip llvm-c63995394de60996ebfe52a47cf2e3a0716d7e3c.tar.gz llvm-c63995394de60996ebfe52a47cf2e3a0716d7e3c.tar.bz2 |
Add a new function attribute 'cold' to functions.
Other than recognizing the attribute, the patch does little else.
It changes the branch probability analyzer so that edges into
blocks postdominated by a cold function are given low weight.
Added analysis and code generation tests. Added documentation for the
new attribute.
llvm-svn: 182638
Diffstat (limited to 'llvm/lib/IR/Attributes.cpp')
-rw-r--r-- | llvm/lib/IR/Attributes.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp index 4fe6f9d..e48ebb1 100644 --- a/llvm/lib/IR/Attributes.cpp +++ b/llvm/lib/IR/Attributes.cpp @@ -217,6 +217,8 @@ std::string Attribute::getAsString(bool InAttrGrp) const { return "uwtable"; if (hasAttribute(Attribute::ZExt)) return "zeroext"; + if (hasAttribute(Attribute::Cold)) + return "cold"; // FIXME: These should be output like this: // @@ -396,6 +398,7 @@ uint64_t AttributeImpl::getAttrMask(Attribute::AttrKind Val) { case Attribute::SanitizeMemory: return 1ULL << 37; case Attribute::NoBuiltin: return 1ULL << 38; case Attribute::Returned: return 1ULL << 39; + case Attribute::Cold: return 1ULL << 40; } llvm_unreachable("Unsupported attribute type"); } |