[PATCH] D132285: [LoongArch] Implement ABI lowering

Lu Weining via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 20 01:54:30 PDT 2022


SixWeining created this revision.
SixWeining added reviewers: xen0n, MaskRay, xry111, wangleiat.
Herald added subscribers: luke957, mstorsjo, StephenFan, luismarques, s.egerton, PkmX, simoncook, arichardson.
Herald added a project: All.
SixWeining requested review of this revision.
Herald added subscribers: cfe-commits, pcwang-thead.
Herald added a project: clang.

Reuse most of RISCV's implementation with several exceptions:

On RISCV, integer scalars passed in registers have signext/zeroext
when promoted, but are anyext if passed on the stack. This is defined
in early RISCV ABI specification. But after this change [1], integers
should also be signext/zeroext if passed on the stack. So I think
RISCV's ABI lowering should be updated [2].

In LoongArch ABI spec, we can see that integer scalars narrower than
GRLEN bits are zero/sign-extended no matter passed in registers or on
the stack.

There is another difference worth mentioning is that `char` is signed
by default on LoongArch while it is unsigned on RISCV.

This patch also adds `_BitInt` type support to LoongArch and handle it
in LoongArchABIInfo::classifyArgumentType.

[1] https://github.com/riscv-non-isa/riscv-elf-psabi-doc/commit/cec39a064ee0e5b0129973fffab7e3ad1710498f
[2] https://github.com/llvm/llvm-project/issues/57261

Depends on D130255 <https://reviews.llvm.org/D130255>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D132285

Files:
  clang/lib/Basic/Targets/LoongArch.h
  clang/lib/CodeGen/TargetInfo.cpp
  clang/test/CodeGen/LoongArch/abi-lp64d.c
  clang/test/CodeGen/ext-int-cc.c
  clang/test/CodeGenCXX/LoongArch/abi-lp64d-struct-inherit.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132285.454180.patch
Type: text/x-patch
Size: 43420 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220820/28d0860e/attachment-0001.bin>


More information about the cfe-commits mailing list