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

Jonas Paulsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 9 02:02:04 PDT 2021


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

> we also need to handle functions that get a va_list as argument, as well as non-exported functions (you can pass va_list through to other routines).

Patch updated per review.

**Callee:**

- if va_arg with vector type is lowered in a global function, VecABI is visible. Needs to be checked in FE (SystemZABIInfo::EmitVAArg).
- FunctionType of global function is checked in SystemZAsmPrinter.

**Caller:**

Since we need to inspect all calls (not just to globally declared/defined functions), I thought we either need to do a scan over all functions/instructions in AsmPrinter, or we could check all calls during isel in LowerCall() (Doing it in the FE seems worse as no optimizations at all have taken place yet). I tried now to do it in LowerCall(), but as I did not find any way to set a flag at Module scope each new function has still calls checked until the function attribute is added. Scanning everything in AsmPrinter would stop at the first occurrence on the other hand...

I hope all calls of interest have the CLI.CB pointer (Instruction*) set. The one case I have seen where this is null is for an intrinsic (patch-point)...

It seems that gcc emits attribute if va_start is used, even if va_list is not used. I have simplified this a bit to assume that va_start is always present in a var-arg function.

It seems that gcc is conservative about the va_list being passed on to other functions: As soon as a vector vararg argument is passed, it seems the vector ABI becomes visible, even if calling a static function, and I did the same.

isVectorTypeBased() now moved into SystemZ namespace so that it can be used also in LowerCall().


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

https://reviews.llvm.org/D105067

Files:
  clang/lib/CodeGen/TargetInfo.cpp
  clang/test/CodeGen/SystemZ/systemz-abi-vector2.c
  llvm/lib/Target/SystemZ/AsmParser/SystemZAsmParser.cpp
  llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
  llvm/lib/Target/SystemZ/SystemZAsmPrinter.h
  llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
  llvm/lib/Target/SystemZ/SystemZMachineFunctionInfo.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
  llvm/test/CodeGen/SystemZ/vec-abi-gnuattr-11.ll
  llvm/test/CodeGen/SystemZ/vec-abi-gnuattr-12.ll
  llvm/test/CodeGen/SystemZ/vec-abi-gnuattr-13.ll
  llvm/test/CodeGen/SystemZ/vec-abi-gnuattr-14.ll
  llvm/test/CodeGen/SystemZ/vec-abi-gnuattr-15.ll
  llvm/test/CodeGen/SystemZ/vec-abi-gnuattr-16.ll
  llvm/test/MC/SystemZ/gnu-attributes.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105067.357434.patch
Type: text/x-patch
Size: 20466 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210709/87146378/attachment.bin>


More information about the llvm-commits mailing list