summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2013-08-19 19:00:35 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2013-08-19 19:00:35 +0000
commitaac65a313da54b05b4e821748b7dfb563ca447e4 (patch)
treea16db35319bf207d71b23115132b0db0ca56de7f /llvm/lib
parent349542b171d8f90e2b5385240b0ac567286b7190 (diff)
downloadbcm5719-llvm-aac65a313da54b05b4e821748b7dfb563ca447e4.tar.gz
bcm5719-llvm-aac65a313da54b05b4e821748b7dfb563ca447e4.zip
Introduce SpecialCaseList::isIn overload for GlobalAliases.
Differential Revision: http://llvm-reviews.chandlerc.com/D1437 llvm-svn: 188688
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Utils/SpecialCaseList.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/SpecialCaseList.cpp b/llvm/lib/Transforms/Utils/SpecialCaseList.cpp
index cf12bbfe3d7..2ef692c564c 100644
--- a/llvm/lib/Transforms/Utils/SpecialCaseList.cpp
+++ b/llvm/lib/Transforms/Utils/SpecialCaseList.cpp
@@ -174,7 +174,7 @@ bool SpecialCaseList::isIn(const Function& F, const StringRef Category) const {
inSectionCategory("fun", F.getName(), Category);
}
-static StringRef GetGVTypeString(const GlobalVariable &G) {
+static StringRef GetGlobalTypeString(const GlobalValue &G) {
// Types of GlobalVariables are always pointer types.
Type *GType = G.getType()->getElementType();
// For now we support blacklisting struct types only.
@@ -189,7 +189,19 @@ bool SpecialCaseList::isIn(const GlobalVariable &G,
const StringRef Category) const {
return isIn(*G.getParent(), Category) ||
inSectionCategory("global", G.getName(), Category) ||
- inSectionCategory("type", GetGVTypeString(G), Category);
+ inSectionCategory("type", GetGlobalTypeString(G), Category);
+}
+
+bool SpecialCaseList::isIn(const GlobalAlias &GA,
+ const StringRef Category) const {
+ if (isIn(*GA.getParent(), Category))
+ return true;
+
+ if (isa<FunctionType>(GA.getType()->getElementType()))
+ return inSectionCategory("fun", GA.getName(), Category);
+
+ return inSectionCategory("global", GA.getName(), Category) ||
+ inSectionCategory("type", GetGlobalTypeString(GA), Category);
}
bool SpecialCaseList::isIn(const Module &M, const StringRef Category) const {
OpenPOWER on IntegriCloud