hanchenye-llvm-project/llvm/lib/MC
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
..
MCDisassembler Missed removing one of the assert()'s from the LLVMCreateDisasmCPU() library 2013-05-23 00:32:34 +00:00
MCParser Fix two typo 2013-05-14 23:36:24 +00:00
CMakeLists.txt Remove MCTargetAsmLexer and its derived classes now that edis, 2012-12-20 14:43:30 +00:00
ELFObjectWriter.cpp Remove MCELFObjectTargetWriter::adjustFixupOffset hack 2013-05-15 15:07:42 +00:00
LLVMBuild.txt
MCAsmBackend.cpp MachO: direct-to-object attribute for data-in-code markers. 2012-10-01 22:20:54 +00:00
MCAsmInfo.cpp Remove unused DwarfSectionOffsetDirective string 2013-04-22 22:49:11 +00:00
MCAsmInfoCOFF.cpp Remove unused DwarfSectionOffsetDirective string 2013-04-22 22:49:11 +00:00
MCAsmInfoDarwin.cpp Fix alignment of .comm and .lcomm on mingw32. 2012-09-07 21:08:01 +00:00
MCAsmStreamer.cpp Add support for subsections to the ELF assembler. Fixes PR8717. 2013-04-17 21:18:16 +00:00
MCAssembler.cpp Add support for subsections to the ELF assembler. Fixes PR8717. 2013-04-17 21:18:16 +00:00
MCAtom.cpp
MCCodeEmitter.cpp
MCCodeGenInfo.cpp
MCContext.cpp Debug Info: use SmallVector instead of std::vector in MCDwarfDirsCUMap and MCDwarfFilesCUMap 2013-03-12 20:17:00 +00:00
MCDisassembler.cpp
MCDwarf.cpp Remove the MachineMove class. 2013-05-13 01:16:13 +00:00
MCELF.cpp ELF symbol table field st_other support, 2013-02-19 21:57:35 +00:00
MCELFObjectTargetWriter.cpp Cleanup relocation sorting for ELF. 2013-05-15 18:22:01 +00:00
MCELFStreamer.cpp Add support for subsections to the ELF assembler. Fixes PR8717. 2013-04-17 21:18:16 +00:00
MCExpr.cpp [PowerPC] Clean up generation of ha16() / lo16() markers 2013-05-23 22:26:41 +00:00
MCInst.cpp Release build: guard dump functions with 2012-09-12 05:06:18 +00:00
MCInstPrinter.cpp Try to unbreak the build on hosts that don't transitively pull in a definition for int64_t. 2012-12-05 18:31:11 +00:00
MCInstrAnalysis.cpp
MCLabel.cpp Release build: guard dump functions with 2012-09-12 05:06:18 +00:00
MCMachOStreamer.cpp Add support for subsections to the ELF assembler. Fixes PR8717. 2013-04-17 21:18:16 +00:00
MCMachObjectTargetWriter.cpp
MCModule.cpp
MCNullStreamer.cpp Add support for subsections to the ELF assembler. Fixes PR8717. 2013-04-17 21:18:16 +00:00
MCObjectFileInfo.cpp [SystemZ] Update non-pic DWARF encodings 2013-05-06 17:28:30 +00:00
MCObjectStreamer.cpp Add support for subsections to the ELF assembler. Fixes PR8717. 2013-04-17 21:18:16 +00:00
MCObjectWriter.cpp Move [SU]LEB128 encoding to a utility header. 2012-08-08 23:56:06 +00:00
MCPureStreamer.cpp Add support for subsections to the ELF assembler. Fixes PR8717. 2013-04-17 21:18:16 +00:00
MCRegisterInfo.cpp Add MCRI::getNumSubRegIndices() and start checking SubRegIndex ranges. 2012-09-11 16:34:02 +00:00
MCSection.cpp Use the new script to sort the includes of every file under lib. 2012-12-03 16:50:05 +00:00
MCSectionCOFF.cpp Add support for subsections to the ELF assembler. Fixes PR8717. 2013-04-17 21:18:16 +00:00
MCSectionELF.cpp Add support for subsections to the ELF assembler. Fixes PR8717. 2013-04-17 21:18:16 +00:00
MCSectionMachO.cpp Add support for subsections to the ELF assembler. Fixes PR8717. 2013-04-17 21:18:16 +00:00
MCStreamer.cpp MCStreamer: Also clear vector of W64UnwindInfos on reset(). 2013-05-07 21:14:15 +00:00
MCSubtargetInfo.cpp Use the new script to sort the includes of every file under lib. 2012-12-03 16:50:05 +00:00
MCSymbol.cpp Fix Doxygen issues: 2012-09-14 14:57:36 +00:00
MCValue.cpp Release build: guard dump functions with 2012-09-12 05:06:18 +00:00
MCWin64EH.cpp Use the new script to sort the includes of every file under lib. 2012-12-03 16:50:05 +00:00
MachObjectWriter.cpp [MC/Mach-O] Load commands are supposed to 8-byte aligned on 64-bit. 2013-01-22 03:42:49 +00:00
Makefile
SubtargetFeature.cpp Symbol hygiene: Make sure declarations and definitions match, make helper functions static. 2012-10-20 12:53:26 +00:00
WinCOFFObjectWriter.cpp COFF: Fix weak external aliases. 2013-04-22 18:48:56 +00:00
WinCOFFStreamer.cpp Give the MCStreamer class hierarchy LLVM RTTI facilities for use with 2013-01-31 23:29:57 +00:00