[all-commits] [llvm/llvm-project] 4ca2ca: [PowerPC] Add clang -msvr4-struct-return for 32-bi...

Justin Hibbits via All-commits all-commits at lists.llvm.org
Tue Apr 21 18:19:57 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 4ca2cad947d09ba0402f5b85d165aa7fcfbd9e3e
      https://github.com/llvm/llvm-project/commit/4ca2cad947d09ba0402f5b85d165aa7fcfbd9e3e
  Author: Justin Hibbits <jrh29 at alumni.cwru.edu>
  Date:   2020-04-21 (Tue, 21 Apr 2020)

  Changed paths:
    M clang/docs/ClangCommandLineReference.rst
    M clang/include/clang/Driver/Options.td
    M clang/lib/CodeGen/TargetInfo.cpp
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/lib/Frontend/CompilerInvocation.cpp
    A clang/test/CodeGen/ppc32-struct-return.c
    A clang/test/Driver/ppc-unsupported.c

  Log Message:
  -----------
  [PowerPC] Add clang -msvr4-struct-return for 32-bit ELF

Summary:

Change the default ABI to be compatible with GCC.  For 32-bit ELF
targets other than Linux, Clang now returns small structs in registers
r3/r4.  This affects FreeBSD, NetBSD, OpenBSD.  There is no change for
32-bit Linux, where Clang continues to return all structs in memory.

Add clang options -maix-struct-return (to return structs in memory) and
-msvr4-struct-return (to return structs in registers) to be compatible
with gcc.  These options are only for PPC32; reject them on PPC64 and
other targets.  The options are like -fpcc-struct-return and
-freg-struct-return for X86_32, and use similar code.

To actually return a struct in registers, coerce it to an integer of the
same size.  LLVM may optimize the code to remove unnecessary accesses to
memory, and will return i32 in r3 or i64 in r3:r4.

Fixes PR#40736

Patch by George Koehler!

Reviewed By: jhibbits, nemanjai
Differential Revision: https://reviews.llvm.org/D73290




More information about the All-commits mailing list