[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
Sun Nov 27 17:13:51 PST 2022


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

Patch reworked to do the visible vector ABI detection in the Clang FE instead, which is necessary after the move to opaque pointers.

- The recursive search of the type is basically moved to the frontend. A set has to be used to avoid revisiting the same type again which is catastrophic in compile time.

- Tried to ignore unused pointers, but it seems that with C++ isUsed() always returns false, which means the patch is acting conservatively with pointers by assuming they always expose the ABI.

- Did not find a possible way to check vararg arguments when passed via funtion pointer: The check in CodeGenFunction::EmitCall() with checkFunctionCallABI() does not work for calls via function pointer. I think that either a similar method could be called here as well for the case where only a function prototype is available (and not a declaration), or it could be checked in CodeGenFunction::getVarArgType(). As long as it's only needed for varargs I guess its easier to do it in getVarArgType() (which the patch now does), but on the other hand it might make sense to have the check done in one place regardless of declaration/funptr.

- Would like to avoid looking up with getModuleFlag() extensively (only based on reasoning, not any compile time measurements), so added a mutable internal flag in SystemZTargetCodeGenInfo as setTargetAttributes() is const. Not sure if that makes a difference...

- Tried to get some suggestions on the name of the new module flag on Discourse a while ago, but without any replies.

- In the last minute I noticed that three regression tests are failing. They all fail at the same point when SystemZTargetCodeGenInfo::setTargetAttributes() calls GetGVALinkageForFunction() on a function with the 'inline' keyword without a function body, which triggers an assertion. Not sure if this is a bug in GetGVALinkageForFunction() or if this is a call that should never be made.

  clang/test/CodeGen/PR2743-reference-missing-static.c
  clang/test/CodeGen/unique-internal-linkage-names.c
  clang/test/CoverageMapping/decl.c


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

https://reviews.llvm.org/D105067

Files:
  clang/lib/CodeGen/CGCall.cpp
  clang/lib/CodeGen/TargetInfo.cpp
  clang/lib/CodeGen/TargetInfo.h
  clang/test/CodeGen/SystemZ/vec-abi-gnuattr-00.c
  clang/test/CodeGen/SystemZ/vec-abi-gnuattr-01.c
  clang/test/CodeGen/SystemZ/vec-abi-gnuattr-02.c
  clang/test/CodeGen/SystemZ/vec-abi-gnuattr-03.c
  clang/test/CodeGen/SystemZ/vec-abi-gnuattr-04.c
  clang/test/CodeGen/SystemZ/vec-abi-gnuattr-05.c
  clang/test/CodeGen/SystemZ/vec-abi-gnuattr-06.c
  clang/test/CodeGen/SystemZ/vec-abi-gnuattr-07.c
  clang/test/CodeGen/SystemZ/vec-abi-gnuattr-08.c
  clang/test/CodeGen/SystemZ/vec-abi-gnuattr-09.c
  clang/test/CodeGen/SystemZ/vec-abi-gnuattr-10.c
  clang/test/CodeGen/SystemZ/vec-abi-gnuattr-11.c
  clang/test/CodeGen/SystemZ/vec-abi-gnuattr-12.c
  clang/test/CodeGen/SystemZ/vec-abi-gnuattr-13.c
  clang/test/CodeGen/SystemZ/vec-abi-gnuattr-14.c
  clang/test/CodeGen/SystemZ/vec-abi-gnuattr-15.c
  clang/test/CodeGen/SystemZ/vec-abi-gnuattr-16.c
  clang/test/CodeGen/SystemZ/vec-abi-gnuattr-17.c
  clang/test/CodeGen/SystemZ/vec-abi-gnuattr-18.c
  clang/test/CodeGen/SystemZ/vec-abi-gnuattr-19.c
  clang/test/CodeGen/SystemZ/vec-abi-gnuattr-20.cpp
  clang/test/CodeGen/SystemZ/vec-abi-gnuattr-21.c
  clang/test/CodeGen/SystemZ/vec-abi-gnuattr-22.c
  clang/test/CodeGen/SystemZ/vec-abi-gnuattr-23.c
  clang/test/CodeGen/SystemZ/vec-abi-gnuattr-24.c
  llvm/lib/Target/SystemZ/AsmParser/SystemZAsmParser.cpp
  llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
  llvm/lib/Target/SystemZ/SystemZAsmPrinter.h
  llvm/test/MC/SystemZ/gnu-attributes.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105067.478123.patch
Type: text/x-patch
Size: 28312 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221128/7ef74823/attachment-0001.bin>


More information about the llvm-commits mailing list