summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2016-03-15 01:43:05 +0000
committerLang Hames <lhames@gmail.com>2016-03-15 01:43:05 +0000
commit1b640e05ba57e805ed00831771b75cd2e617f656 (patch)
treefcc141a61034a512698448e79a382c32963b7ec1 /llvm/lib/CodeGen/AsmPrinter
parentcdbac995518f20653bc89cc992592ee510ac0873 (diff)
downloadbcm5719-llvm-1b640e05ba57e805ed00831771b75cd2e617f656.tar.gz
bcm5719-llvm-1b640e05ba57e805ed00831771b75cd2e617f656.zip
[MachO] Add MachO alt-entry directive support.
This patch adds support for the MachO .alt_entry assembly directive, and uses it for global aliases with non-zero GEP offsets. The alt_entry flag indicates that a symbol should be layed out immediately after the preceding symbol. Conceptually it introduces an alternate entry point for a function or data structure. E.g.: safe_foo: // check preconditions for foo .alt_entry fast_foo fast_foo: // body of foo, can assume preconditions. The .alt_entry flag is also implicitly set on assembly aliases of the form: a = b + C where C is a non-zero constant, since these have the same effect as an alt_entry symbol: they introduce a label that cannot be moved relative to the preceding one. Setting the alt_entry flag on aliases of this form fixes http://llvm.org/PR25381. llvm-svn: 263521
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 28d793155ce..67153d1d20f 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -1165,8 +1165,13 @@ bool AsmPrinter::doFinalization(Module &M) {
EmitVisibility(Name, Alias.getVisibility());
+ const MCExpr *Expr = lowerConstant(Alias.getAliasee());
+
+ if (MAI->hasAltEntry() && isa<MCBinaryExpr>(Expr))
+ OutStreamer->EmitSymbolAttribute(Name, MCSA_AltEntry);
+
// Emit the directives as assignments aka .set:
- OutStreamer->EmitAssignment(Name, lowerConstant(Alias.getAliasee()));
+ OutStreamer->EmitAssignment(Name, Expr);
// If the aliasee does not correspond to a symbol in the output, i.e. the
// alias is not of an object or the aliased object is private, then set the
OpenPOWER on IntegriCloud