Page MenuHomePhabricator

[RISCV][GlobalISel] Select add i32, i32
Needs RevisionPublic

Authored by StephenFan on Sun, Nov 22, 6:34 AM.

Details

Summary

Support the global instruction selection of add i32, i32.
This patch is minimal support. And this patch referenced ARM and AArch64's GlobalISel implementation.
I use the tablegen to generate the CCAssignFn. And the generated function just support the current requirement of
select add i32, i32. The reason for using the generated function is the globalisel infrastructure handleAssignments function
needs the CCAssignFn as one of the parameters. However, The RISCV backend handwriting the CC_RISCV function to deal
with calling conventions. But this function was not matched the CCAssignFn format. So I have to use the tablegen to generate the CCAssignFn.

Diff Detail

Unit TestsFailed

TimeTest
510 mslinux > AddressSanitizer-x86_64-linux.TestCases::strcmp.c
Script: -- : 'RUN: at line 1'; /mnt/disks/ssd0/agent/llvm-project/build/./bin/clang -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only -m64 /mnt/disks/ssd0/agent/llvm-project/compiler-rt/test/asan/TestCases/strcmp.c -o /mnt/disks/ssd0/agent/llvm-project/build/projects/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Output/strcmp.c.tmp
370 mslinux > HWAddressSanitizer-x86_64.TestCases::sizes.cpp
Script: -- : 'RUN: at line 3'; /mnt/disks/ssd0/agent/llvm-project/build/./bin/clang --driver-mode=g++ -m64 -gline-tables-only -fsanitize=hwaddress -fuse-ld=lld -mcmodel=large -mllvm -hwasan-globals -mllvm -hwasan-use-short-granules -mllvm -hwasan-instrument-landing-pads=0 -mllvm -hwasan-instrument-personality-functions /mnt/disks/ssd0/agent/llvm-project/compiler-rt/test/hwasan/TestCases/sizes.cpp -nostdlib++ -lstdc++ -o /mnt/disks/ssd0/agent/llvm-project/build/projects/compiler-rt/test/hwasan/X86_64/TestCases/Output/sizes.cpp.tmp

Event Timeline

StephenFan created this revision.Sun, Nov 22, 6:34 AM
StephenFan requested review of this revision.Sun, Nov 22, 6:34 AM
StephenFan edited the summary of this revision. (Show Details)Sun, Nov 22, 6:46 AM
jrtc27 requested changes to this revision.Sun, Nov 22, 7:23 AM
jrtc27 added inline comments.
llvm/lib/Target/RISCV/RISCVCallingConv.td
66–79

RISC-V calling conventions are implemented in C++ and that was a deliberate choice. Please do not duplicate what is already there (which is a huge nuisance for downstream forks like ours) and instead reuse the perfectly-good well-tested CC_RISCV that already exists. Also TableGen calling conventions are far too opaque to have any hope of actually convincing yourself they're correct in all the subtle edge-cases, whereas imperative code is clear and unambiguous.

This revision now requires changes to proceed.Sun, Nov 22, 7:23 AM

There's already a series of patches to add more GlobalISel support for RISCV. For example, https://reviews.llvm.org/D76445. The others can be found in the stack of patches attached to that one.

There's already a series of patches to add more GlobalISel support for RISCV. For example, https://reviews.llvm.org/D76445. The others can be found in the stack of patches attached to that one.

I noticed that these patches have been silent for several months, how can I promote this?

There's already a series of patches to add more GlobalISel support for RISCV. For example, https://reviews.llvm.org/D76445. The others can be found in the stack of patches attached to that one.

I noticed that these patches have been silent for several months, how can I promote this?

I've not been able to work on those patches for some time but if someone might commandeer them to rebase them and work on top of them I think that would be a good starting point and I would happily take a look at the changes. Otherwise I may get some time to update them myself within a month or two.

There's already a series of patches to add more GlobalISel support for RISCV. For example, https://reviews.llvm.org/D76445. The others can be found in the stack of patches attached to that one.

I noticed that these patches have been silent for several months, how can I promote this?

I've not been able to work on those patches for some time but if someone might commandeer them to rebase them and work on top of them I think that would be a good starting point and I would happily take a look at the changes. Otherwise I may get some time to update them myself within a month or two.

Thank you. I am very willing to work based on your patches. And I will start to do recently!