[MachO] Add MachO alt-entry directive support.
authorLang Hames <lhames@gmail.com>
Tue, 15 Mar 2016 01:43:05 +0000 (01:43 +0000)
committerLang Hames <lhames@gmail.com>
Tue, 15 Mar 2016 01:43:05 +0000 (01:43 +0000)
commit1b640e05ba57e805ed00831771b75cd2e617f656
treefcc141a61034a512698448e79a382c32963b7ec1
parentcdbac995518f20653bc89cc992592ee510ac0873
[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
17 files changed:
llvm/include/llvm/MC/MCAsmInfo.h
llvm/include/llvm/MC/MCDirectives.h
llvm/include/llvm/MC/MCSymbolMachO.h
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/lib/MC/MCAsmInfo.cpp
llvm/lib/MC/MCAsmInfoDarwin.cpp
llvm/lib/MC/MCAsmStreamer.cpp
llvm/lib/MC/MCELFStreamer.cpp
llvm/lib/MC/MCMachOStreamer.cpp
llvm/lib/MC/MCParser/AsmParser.cpp
llvm/lib/MC/MachObjectWriter.cpp
llvm/test/CodeGen/X86/alias-gep.ll [new file with mode: 0644]
llvm/test/MC/MachO/absolute.s
llvm/test/MC/MachO/altentry.s [new file with mode: 0644]
llvm/test/MC/MachO/variable-exprs.s
llvm/test/MC/MachO/x86_64-reloc-arithmetic.s
llvm/tools/llvm-readobj/MachODumper.cpp