[PATCH] D95444: Allow GNU inline asm using target-specific dialect variant

Ulrich Weigand via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 26 07:09:11 PST 2021


uweigand created this revision.
uweigand added reviewers: hans, rnk, respindola, craig.topper.
Herald added subscribers: pengfei, hiraditya.
uweigand requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

LLVM has two notions of "assembler dialect" that are conceptually distinct, but are currently somewhat intermixed.

The first notion corresponds to platform-specific syntactical differences in assembler text, e.g. the distinction between AT&T and Intel-style assembler for x86 (and similar differences on other architectures).   The second notion corresponds to C/C++ source level differences in handling the inputs/outputs of *inline* assembler statements, specifically the difference between GNU inline asm and MS inline asm.

These are conceptually different, but the current inline assembler handling always enforces AT&T style assembler with GNU inline asm and Intel-style assembler with MS inline asm.  This is done even on non-Intel platforms, which may not even have AT&T vs. Intel assembler -- that's not an issue for MS inline asm, as this itself only exists on Intel, but it is a problem if a platform wants to use different assembler styles for *GNU* inline asm.  (Specifically, we want to do this on SystemZ to distinguish between GAS and HLASM style assembler text.)

This patch allows for more flexibility here by moving the "connection" between assembler styles and inline asm types into platform-specific code.  Specifically, in addition to the existing "MAI->getAssemblerDialect" which returns the default style to be used for assembler reading and writing (which is currently uses everywhere *except* for inline asm), this patch introduces a "MAI->getInlineAsmDialect" which returns the assembler style to be used for parsing inline asm.  The routine gets the inline asm type as type and therefore can return different styles for GNU and MS inline asm, which is then done in the X86 back-end.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95444

Files:
  llvm/include/llvm/MC/MCAsmInfo.h
  llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
  llvm/lib/Object/ModuleSymbolTable.cpp
  llvm/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp
  llvm/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95444.319289.patch
Type: text/x-patch
Size: 5927 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210126/74f8724f/attachment.bin>


More information about the llvm-commits mailing list