[flang-commits] [flang] [flang] RISCV64 support for BIND(C) derived types (PR #198335)
via flang-commits
flang-commits at lists.llvm.org
Wed May 20 01:53:44 PDT 2026
================
@@ -1389,10 +1389,18 @@ struct TargetSparcV9 : public GenericTarget<TargetSparcV9> {
//===----------------------------------------------------------------------===//
namespace {
+// RISCV64 calling convention specification:
+// https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-cc.adoc#procedure-calling-convention
struct TargetRISCV64 : public GenericTarget<TargetRISCV64> {
using GenericTarget::GenericTarget;
static constexpr int defaultWidth = 64;
+ static constexpr int defaultWidthBytes = defaultWidth / 8;
+ // TODO: Can't query ABI from inside TargetRewrite so assume the more common
+ // `lp64d` for now. Alternatively could check float-support from
+ // target-features, but that could be overridden by manually setting
+ // `-mabi=lp64`.
----------------
jeanPerier wrote:
Could the target-abi be added/threaded into fir::CodeGenSpecifics [here](https://github.com/llvm/llvm-project/blob/72fc97805fc3d940ff6f8a16f23787b690556ef3/flang/lib/Optimizer/CodeGen/TargetRewrite.cpp#L119C27-L119C43) to solve this?
Also, while this may not cover the cases where mabi is used, can't you already cover some cases using the target feature argument of fir::CodeGenSpecifics ctor?
https://github.com/llvm/llvm-project/pull/198335
More information about the flang-commits
mailing list