This is an archive of the discontinued LLVM Phabricator instance.

[clang] Added Swift support for RISCV
Needs ReviewPublic

Authored by colemancda on Nov 2 2022, 6:43 PM.

Details

Reviewers
None
Group Reviewers
Restricted Project
Summary

Adds support for compiling Swift targeting the RISCV ABI

Diff Detail

Event Timeline

colemancda created this revision.Nov 2 2022, 6:43 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 2 2022, 6:43 PM
colemancda requested review of this revision.Nov 2 2022, 6:43 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptNov 2 2022, 6:43 PM
colemancda added a reviewer: Restricted Project.Nov 7 2022, 9:39 AM
asb added a comment.Nov 8 2022, 2:32 AM

First of all, thanks for the contribution.

I've not looked at all into the Swift calling convention requirements, but at a minimum this patch is going to need test coverage. I also think RV32 should be handled somehow - either by adding equivalent support, or at least erroring if that's not possible.

colemancda retitled this revision from [clang] Added Swift support for RISCV64 to [clang] Added Swift support for RISCV.Nov 8 2022, 2:36 AM
colemancda edited the summary of this revision. (Show Details)

RV32 is enabled as well. I'll add unit tests.

asb added a comment.Nov 8 2022, 2:53 AM

RV32 is enabled as well. I'll add unit tests.

Great, thanks. Is it really the case that shouldPassIndirectlyForSwift has the same result regardless of native word size?

RV32 is enabled as well. I'll add unit tests.

Great, thanks. Is it really the case that shouldPassIndirectlyForSwift has the same result regardless of native word size?

Yes, if you check other implementations like Arm and AArch64, the implementation is the same.
Where is a good place to start for the unit test development for this ABI?

jrtc27 added inline comments.Feb 10 2023, 8:50 PM
clang/lib/CodeGen/TargetInfo.cpp
10557

Huh? This is unused.

10601

The argument's called maxAllRegisters?

craig.topper added inline comments.
clang/lib/CodeGen/TargetInfo.cpp
10555

SwiftABIInfo doesn't inherit from ABIInfo and hasn't since August last year. D130394