summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorPaul Robinson <paul_robinson@playstation.sony.com>2015-08-11 21:36:45 +0000
committerPaul Robinson <paul_robinson@playstation.sony.com>2015-08-11 21:36:45 +0000
commit78046b49a9397db7899a7879e0a88d26f0199025 (patch)
tree2e38da1bae46828d95b66b19c344dae5c403bb11 /llvm/lib/CodeGen
parent45be450070170249ac44043e705d4587a9c53205 (diff)
downloadbcm5719-llvm-78046b49a9397db7899a7879e0a88d26f0199025.tar.gz
bcm5719-llvm-78046b49a9397db7899a7879e0a88d26f0199025.zip
Make DW_AT_[MIPS_]linkage_name optional, and off by default for SCE.
Mangled "linkage" names can be huge, and if the debugger (or other tools) have no use for them, the size savings can be very impressive (on the order of 40%). Add one test for controlling behavior, and modify a number of tests to either stop using linkage names, or make llc emit them (so these tests will still run when the default triple is for PS4). Differential Revision: http://reviews.llvm.org/D11374 llvm-svn: 244678
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp14
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h6
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp2
3 files changed, 21 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index e09a90fbd0b..4a673d49ced 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -116,6 +116,14 @@ DwarfPubSections("generate-dwarf-pub-sections", cl::Hidden,
clEnumVal(Disable, "Disabled"), clEnumValEnd),
cl::init(Default));
+static cl::opt<DefaultOnOff>
+DwarfLinkageNames("dwarf-linkage-names", cl::Hidden,
+ cl::desc("Emit DWARF linkage-name attributes."),
+ cl::values(clEnumVal(Default, "Default for platform"),
+ clEnumVal(Enable, "Enabled"),
+ clEnumVal(Disable, "Disabled"), clEnumValEnd),
+ cl::init(Default));
+
static const char *const DWARFGroupName = "DWARF Emission";
static const char *const DbgTimerName = "DWARF Debug Writer";
@@ -250,6 +258,12 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M)
else
HasDwarfPubSections = DwarfPubSections == Enable;
+ // SCE does not use linkage names.
+ if (DwarfLinkageNames == Default)
+ UseLinkageNames = !tuneForSCE();
+ else
+ UseLinkageNames = DwarfLinkageNames == Enable;
+
unsigned DwarfVersionNumber = Asm->TM.Options.MCOptions.DwarfVersion;
DwarfVersion = DwarfVersionNumber ? DwarfVersionNumber
: MMI->getModule()->getDwarfVersion();
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
index d17589cba9e..977f3406441 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
@@ -333,6 +333,9 @@ class DwarfDebug : public AsmPrinterHandler {
/// Whether to use the GNU TLS opcode (instead of the standard opcode).
bool UseGNUTLSOpcode;
+ /// Whether to emit DW_AT_[MIPS_]linkage_name.
+ bool UseLinkageNames;
+
/// Version of dwarf we're emitting.
unsigned DwarfVersion;
@@ -588,6 +591,9 @@ public:
SymSize[Sym] = Size;
}
+ /// Returns whether to emit DW_AT_[MIPS_]linkage_name.
+ bool useLinkageNames() const { return UseLinkageNames; }
+
/// Returns whether to use DW_OP_GNU_push_tls_address, instead of the
/// standard DW_OP_form_tls_address opcode
bool useGNUTLSOpcode() const { return UseGNUTLSOpcode; }
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
index 72b9fe7fd8f..d5ed0cd0945 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -667,7 +667,7 @@ void DwarfUnit::addConstantValue(DIE &Die, const APInt &Val, bool Unsigned) {
}
void DwarfUnit::addLinkageName(DIE &Die, StringRef LinkageName) {
- if (!LinkageName.empty())
+ if (!LinkageName.empty() && DD->useLinkageNames())
addString(Die,
DD->getDwarfVersion() >= 4 ? dwarf::DW_AT_linkage_name
: dwarf::DW_AT_MIPS_linkage_name,
OpenPOWER on IntegriCloud