[all-commits] [llvm/llvm-project] 794457: [amdgpu] Pass variadic arguments without splitting...

Jon Chesterfield via All-commits all-commits at lists.llvm.org
Tue Jun 4 05:10:33 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 794457f6f99aac77f123fa2245e91a3b442c7926
      https://github.com/llvm/llvm-project/commit/794457f6f99aac77f123fa2245e91a3b442c7926
  Author: Jon Chesterfield <jonathanchesterfield at gmail.com>
  Date:   2024-06-04 (Tue, 04 Jun 2024)

  Changed paths:
    M clang/lib/CodeGen/Targets/AMDGPU.cpp
    A clang/test/CodeGen/amdgpu-variadic-call.c

  Log Message:
  -----------
  [amdgpu] Pass variadic arguments without splitting (#94083)

Pass variadic arguments without changing their type, unlike the fixed
ones.

Fixed arguments are modified to better fit into registers. This patch
leaves those unchanged.

Splitting struct types into individual fields and packing small structs
into integers works well for passing via registers. Variadic arguments
are currently unimplemented in the backend. They're likely to be
implemented as a pointer to stack memory in which case register-themed
optimisations are inapplicable.

Splitting the struct into fields makes it difficult to implement va_arg
robustly. The rules around padding and alignment to inverse the struct
splitting could be constructed, but at high complexity and no particular
advantage.

Passing types as-is means there is a 1:1 correspondence with the type
information va_arg has to work with and the parameter type at the call
site.

This is an ABI change, but as the only functions affected are variadic
ones which are presently a compilation error, not a functional break.
Factored out of the larger #93362 and can land independently.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list