This is an archive of the discontinued LLVM Phabricator instance.

[MLIR][RISCV] Emit target-abi info for RISC-V
AbandonedPublic

Authored by sunshaoce on Feb 18 2023, 7:29 AM.

Diff Detail

Event Timeline

sunshaoce created this revision.Feb 18 2023, 7:29 AM
Herald added a project: Restricted Project. · View Herald Transcript
sunshaoce requested review of this revision.Feb 18 2023, 7:29 AM

Could we have a test?

I'm missing context here but do we want to restrict the ABIs to only those two? We are using ilp32, for example, and there are others (e.g., ilp32f, lp64, lp64f etc.).

sunshaoce updated this revision to Diff 499509.Feb 22 2023, 7:46 AM

Address @ftynse's comment

I'm missing context here but do we want to restrict the ABIs to only those two? We are using ilp32, for example, and there are others (e.g., ilp32f, lp64, lp64f etc.).

Thanks! I'm working on this.

sunshaoce retitled this revision from [WIP][mlir] Emit target-abi info for RISC-V to [MLIR][RISCV] Emit target-abi info for RISC-V.Feb 22 2023, 11:26 PM
sunshaoce edited the summary of this revision. (Show Details)
kito-cheng added inline comments.Feb 22 2023, 11:44 PM
mlir/lib/Target/LLVMIR/DebugTranslation.cpp
58
sunshaoce added inline comments.Feb 23 2023, 4:32 AM
mlir/lib/Target/LLVMIR/DebugTranslation.cpp
58

I noticed that flang is experiencing linking errors due to the lack of code similar to clang D72755, such as llvm.module.flags like !{i32 1, !"target-abi", !"lp64"}.

kito-cheng added inline comments.Feb 23 2023, 4:47 AM
mlir/lib/Target/LLVMIR/DebugTranslation.cpp
58

I mean it should be ilp32/lp64 instead of ILP32/LP64?

61

f instead of F.

64

d instead of D.

sunshaoce updated this revision to Diff 499818.Feb 23 2023, 5:35 AM
sunshaoce marked 4 inline comments as done.

Address @kito-cheng's comment

jrtc27 added inline comments.Mar 11 2023, 11:25 PM
mlir/lib/Target/LLVMIR/DebugTranslation.cpp
60

You can have hard floats without using a hard float calling convention; the ABI is distinct from the ISA choice (other than the obvious dependencies on registers existing if you want to use them). Defaulting to using a hard-float calling convention is fine (and IIRC the psABI even recommends that) but it must be possible to have, say, ilp32 rv32if. In the Clang world this is configured with -mabi.

sunshaoce abandoned this revision.Mar 12 2023, 9:17 AM

@jrtc27 Thanks for your comment. I found the solution.

mlir/lib/Target/LLVMIR/DebugTranslation.cpp
60

You can have hard floats without using a hard float calling convention; the ABI is distinct from the ISA choice (other than the obvious dependencies on registers existing if you want to use them). Defaulting to using a hard-float calling convention is fine (and IIRC the psABI even recommends that) but it must be possible to have, say, ilp32 rv32if. In the Clang world this is configured with -mabi.