[AsmPrinter] refactor to support %c w/ GlobalAddress'
authorNick Desaulniers <ndesaulniers@google.com>
Fri, 26 Apr 2019 18:45:04 +0000 (18:45 +0000)
committerNick Desaulniers <ndesaulniers@google.com>
Fri, 26 Apr 2019 18:45:04 +0000 (18:45 +0000)
commit7ab164c4a427b559a7a47fa62ef365862705f950
treec8aacfde9e16dcbd85708bf2424ce6f9c94b76aa
parent74967cb4e04c9899601b8c84901e99e797d49135
[AsmPrinter] refactor to support %c w/ GlobalAddress'

Summary:
Targets like ARM, MSP430, PPC, and SystemZ have complex behavior when
printing the address of a MachineOperand::MO_GlobalAddress. Move that
handling into a new overriden method in each base class. A virtual
method was added to the base class for handling the generic case.

Refactors a few subclasses to support the target independent %a, %c, and
%n.

The patch also contains small cleanups for AVRAsmPrinter and
SystemZAsmPrinter.

It seems that NVPTXTargetLowering is possibly missing some logic to
transform GlobalAddressSDNodes for
TargetLowering::LowerAsmOperandForConstraint to handle with "i" extended
inline assembly asm constraints.

Fixes:
- https://bugs.llvm.org/show_bug.cgi?id=41402
- https://github.com/ClangBuiltLinux/linux/issues/449

Reviewers: echristo, void

Reviewed By: void

Subscribers: void, craig.topper, jholewinski, dschuff, jyknight, dylanmckay, sdardis, nemanjai, javed.absar, sbc100, jgravelle-google, eraman, kristof.beyls, hiraditya, aheejin, kbarton, fedor.sergeev, jrtc27, atanasyan, jsji, llvm-commits, kees, tpimh, nathanchance, peter.smith, srhines

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D60887

llvm-svn: 359337
33 files changed:
llvm/include/llvm/CodeGen/AsmPrinter.h
llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/lib/Target/ARM/ARMAsmPrinter.cpp
llvm/lib/Target/ARM/ARMAsmPrinter.h
llvm/lib/Target/AVR/AVRAsmPrinter.cpp
llvm/lib/Target/BPF/BPFAsmPrinter.cpp
llvm/lib/Target/Hexagon/HexagonAsmPrinter.cpp
llvm/lib/Target/Lanai/LanaiAsmPrinter.cpp
llvm/lib/Target/MSP430/MSP430AsmPrinter.cpp
llvm/lib/Target/Mips/MipsAsmPrinter.cpp
llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
llvm/lib/Target/Sparc/SparcAsmPrinter.cpp
llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
llvm/lib/Target/X86/X86AsmPrinter.cpp
llvm/lib/Target/X86/X86AsmPrinter.h
llvm/lib/Target/XCore/XCoreAsmPrinter.cpp
llvm/test/CodeGen/AArch64/inlineasm-output-template.ll [new file with mode: 0644]
llvm/test/CodeGen/ARM/inlineasm-output-template.ll
llvm/test/CodeGen/BPF/inlineasm-output-template.ll [new file with mode: 0644]
llvm/test/CodeGen/Hexagon/inlineasm-output-template.ll
llvm/test/CodeGen/Lanai/inlineasm-output-template.ll [new file with mode: 0644]
llvm/test/CodeGen/MSP430/inlineasm-output-template.ll [new file with mode: 0644]
llvm/test/CodeGen/Mips/inlineasm-output-template.ll [new file with mode: 0644]
llvm/test/CodeGen/NVPTX/inlineasm-output-template.ll [new file with mode: 0644]
llvm/test/CodeGen/PowerPC/inlineasm-output-template.ll
llvm/test/CodeGen/SPARC/inlineasm-output-template.ll [new file with mode: 0644]
llvm/test/CodeGen/SystemZ/inlineasm-output-template.ll [new file with mode: 0644]
llvm/test/CodeGen/WebAssembly/inlineasm-output-template.ll [new file with mode: 0644]
llvm/test/CodeGen/X86/inline-asm-modifier-c.ll [new file with mode: 0644]
llvm/test/CodeGen/XCore/inlineasm-output-template.ll [new file with mode: 0644]