[flang-commits] [flang] [flang] RISCV64 (lp64/lp64d) support for BIND(C) derived types (PR #198335)

Philipp Rados via flang-commits flang-commits at lists.llvm.org
Tue Sep 22 04:21:16 PDT 2026


================
@@ -1425,6 +1428,316 @@ struct TargetRISCV64 : public GenericTarget<TargetRISCV64> {
     }
     return marshal;
   }
+
+  bool hasHardFloatABI(mlir::Location loc) const {
+    auto abi = getTargetABI();
+
+    if (abi == "lp64d")
+      return true;
+    if (abi == "lp64")
+      return false;
+    TODO(loc, "RISCV64 BIND(C) support for " + abi);
+  }
+
+  CodeGenSpecifics::Marshalling
+  passOnTheStack(unsigned short recAlign, mlir::Type ty, bool isResult) const {
+    CodeGenSpecifics::Marshalling marshal;
+    // The stack is always 8 byte aligned
+    unsigned short align = std::max(recAlign, static_cast<unsigned short>(8));
+    marshal.emplace_back(fir::ReferenceType::get(ty),
+                         AT{align, /*byval=*/!isResult, /*sret=*/isResult});
+    return marshal;
+  }
+
+  const llvm::SmallVector<mlir::Type>
----------------
prados-oc wrote:

Dropped const, thanks!

https://github.com/llvm/llvm-project/pull/198335


More information about the flang-commits mailing list