[PATCH] D102894: [SystemZ] Emit .gnu_attribute for an externally visible vector abi.

Jonas Paulsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 27 19:31:20 PDT 2021


jonpa updated this revision to Diff 348431.
jonpa added a comment.

Patch updated - in progress.

> This is probably not even necessary, since even a pointer to a vector would still trigger the emission of the gnu_attribute...
> Yes, indeed. The alignment of 128-bit vector types is different between the two ABIs, which means that any use of such types, even via pointers or as struct elements, will trigger ABI diff\

erences.

Aha... I removed the function attribute emission from clang and now do all the work in SystemZAsmPrinter instead. Added a check for actually passed arguments to a vararg function.

> For an example of how to handle such things, you might look at emitLocalEntry in the PowerPC target. You'll need a virtual function in TargetStreamer.h that can be called by the AsmPrinter.cpp code. Then there need to be two implementations of the virtual function, one for emitting assembler text, and one when directly emitting object files. Finally, you'll need to handle reading the directive in assembler code in the AsmParser.

I did an attempt at this except for the parser part, which seems to work. The bytes in SystemZTargetELFStreamer are simply copied from GCC output - I have no idea about the actual layout/meaing of that, except for the last two bytes...

> This isn't really Z specific, so it should probably be implemented somewhere in common code, if it isn't already ...

Actually not sure what should go into common code... ARM defines ARMTargetStreamer with some attribute emission methods, but none for .gnu_attr that I can see.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102894/new/

https://reviews.llvm.org/D102894

Files:
  llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.cpp
  llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
  llvm/lib/Target/SystemZ/SystemZAsmPrinter.h
  llvm/lib/Target/SystemZ/SystemZTargetStreamer.h
  llvm/test/CodeGen/SystemZ/vec-abi-gnuattr-00.ll
  llvm/test/CodeGen/SystemZ/vec-abi-gnuattr-01.ll
  llvm/test/CodeGen/SystemZ/vec-abi-gnuattr-02.ll
  llvm/test/CodeGen/SystemZ/vec-abi-gnuattr-03.ll
  llvm/test/CodeGen/SystemZ/vec-abi-gnuattr-04.ll
  llvm/test/CodeGen/SystemZ/vec-abi-gnuattr-05.ll
  llvm/test/CodeGen/SystemZ/vec-abi-gnuattr-06.ll
  llvm/test/CodeGen/SystemZ/vec-abi-gnuattr-07.ll
  llvm/test/CodeGen/SystemZ/vec-abi-gnuattr-08.ll
  llvm/test/CodeGen/SystemZ/vec-abi-gnuattr-09.ll
  llvm/test/CodeGen/SystemZ/vec-abi-gnuattr-10.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102894.348431.patch
Type: text/x-patch
Size: 13701 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210528/d97eb655/attachment.bin>


More information about the llvm-commits mailing list