summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
diff options
context:
space:
mode:
authorJiangning Liu <jiangning.liu@arm.com>2014-05-15 23:45:42 +0000
committerJiangning Liu <jiangning.liu@arm.com>2014-05-15 23:45:42 +0000
commit932e1c392426b692d72c71a849ca94a0a20f9cb7 (patch)
treeb2d76447857d9f811be484b708122cee37c24ca2 /llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
parent962c9a2d54f8313cbe1050e08a41c4cf96a9ae0d (diff)
downloadbcm5719-llvm-932e1c392426b692d72c71a849ca94a0a20f9cb7.tar.gz
bcm5719-llvm-932e1c392426b692d72c71a849ca94a0a20f9cb7.zip
Implement global merge optimization for global variables.
This commit implements two command line switches -global-merge-on-external and -global-merge-aligned, and both of them are false by default, so this optimization is disabled by default for all targets. For ARM64, some back-end behaviors need to be tuned to get this optimization further enabled. llvm-svn: 208934
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 37a2c3220cb..0c4865f2f27 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -946,8 +946,11 @@ bool AsmPrinter::doFinalization(Module &M) {
EmitVisibility(Name, Alias.getVisibility());
// Emit the directives as assignments aka .set:
- OutStreamer.EmitAssignment(Name,
- MCSymbolRefExpr::Create(Target, OutContext));
+ const MCExpr *Expr = MCSymbolRefExpr::Create(Target, OutContext);
+ if (uint64_t Offset = Alias.calculateOffset(*TM.getDataLayout()))
+ Expr = MCBinaryExpr::CreateAdd(Expr,
+ MCConstantExpr::Create(Offset, OutContext), OutContext);
+ OutStreamer.EmitAssignment(Name, Expr);
}
}
OpenPOWER on IntegriCloud