llvm-project/llvm/lib/Target/PowerPC/MCTargetDesc
Ulrich Weigand 41789de165 [PowerPC] Clean up generation of ha16() / lo16() markers
When targeting the Darwin assembler, we need to generate markers ha16() and
lo16() to designate the high and low parts of a (symbolic) immediate.  This
is necessary not just for plain symbols, but also for certain symbolic
expression, typically along the lines of ha16(A - B).  The latter doesn't
work when simply using VariantKind flags on the symbol reference.
This is why the current back-end uses hacks (explicitly called out as such
via multiple FIXMEs) in the symbolLo/symbolHi print methods.

This patch uses target-defined MCExpr codes to represent the Darwin
ha16/lo16 constructs, following along the lines of the equivalent solution
used by the ARM back end to handle their :upper16: / :lower16: markers.
This allows us to get rid of special handling both in the symbolLo/symbolHi
print method and in the common code MCExpr::print routine.  Instead, the
ha16 / lo16 markers are printed simply in a custom print routine for the
target MCExpr types.  (As a result, the symbolLo/symbolHi print methods
can now replaced by a single printS16ImmOperand routine that also handles
symbolic operands.)

The patch also provides a EvaluateAsRelocatableImpl routine to handle
ha16/lo16 constructs.  This is not actually used at the moment by any
in-tree code, but is provided as it makes merging into David Fang's
out-of-tree Mach-O object writer simpler.

Since there is no longer any need to treat VK_PPC_GAS_HA16 and
VK_PPC_DARWIN_HA16 differently, they are merged into a single
VK_PPC_ADDR16_HA (and likewise for the _LO16 types).

llvm-svn: 182616
2013-05-23 22:26:41 +00:00
..
CMakeLists.txt [PowerPC] Clean up generation of ha16() / lo16() markers 2013-05-23 22:26:41 +00:00
LLVMBuild.txt LLVMBuild: Remove trailing newline, which irked me. 2011-12-12 19:48:00 +00:00
Makefile
PPCAsmBackend.cpp [PowerPC] Merge/rename PPC fixup types 2013-05-17 12:37:21 +00:00
PPCELFObjectWriter.cpp [PowerPC] Clean up generation of ha16() / lo16() markers 2013-05-23 22:26:41 +00:00
PPCFixupKinds.h [PowerPC] Merge/rename PPC fixup types 2013-05-17 12:37:21 +00:00
PPCMCAsmInfo.cpp Fix powerpc test failure - forgot to initialize stack slot size for PPCLinuxMCAsmInfo 2013-01-23 17:12:15 +00:00
PPCMCAsmInfo.h Emacs-tag and some comment fix for all ARM, CellSPU, Hexagon, MBlaze, MSP430, PPC, PTX, Sparc, X86, XCore. 2012-02-18 12:03:15 +00:00
PPCMCCodeEmitter.cpp [PowerPC] Fix hi/lo encoding in old-style code emitter 2013-05-17 14:14:12 +00:00
PPCMCExpr.cpp [PowerPC] Clean up generation of ha16() / lo16() markers 2013-05-23 22:26:41 +00:00
PPCMCExpr.h [PowerPC] Clean up generation of ha16() / lo16() markers 2013-05-23 22:26:41 +00:00
PPCMCTargetDesc.cpp Remove the MachineMove class. 2013-05-13 01:16:13 +00:00
PPCMCTargetDesc.h To avoid symbol clash, undefine PPC here. PPC may be predefined on some hosts. 2013-03-17 12:40:42 +00:00
PPCPredicates.cpp Move PPC getSwappedPredicate for reuse 2013-04-20 05:16:26 +00:00
PPCPredicates.h Move PPC getSwappedPredicate for reuse 2013-04-20 05:16:26 +00:00