From 38626ed37c9ea78c76c12dae4806b750881fd910 Mon Sep 17 00:00:00 2001 From: Richard-Qin-X Date: Tue, 11 Aug 2026 20:26:56 +0800 Subject: [RISCV] Add LP64 calling-convention facts --- backend/lib/Target/RISCV/RISCVCodeGen.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'backend/lib/Target/RISCV/RISCVCodeGen.cpp') diff --git a/backend/lib/Target/RISCV/RISCVCodeGen.cpp b/backend/lib/Target/RISCV/RISCVCodeGen.cpp index bd4e20c..076e030 100644 --- a/backend/lib/Target/RISCV/RISCVCodeGen.cpp +++ b/backend/lib/Target/RISCV/RISCVCodeGen.cpp @@ -1470,7 +1470,8 @@ void eraseDeadArtifacts(std::span Candidates, [[nodiscard]] Expected lowerMultiplyLibcall(MachineInstr &Instruction, MachineFunction &Function, - const TargetDescription &Target) { + const TargetDescription &Target, + CallingConvention Convention) { const std::optional Type = resultType(Function, Instruction); const MachineOperand *DestinationOperand = Instruction.operandAt(0); const MachineOperand *LeftOperand = Instruction.operandAt(1); @@ -1506,7 +1507,7 @@ void eraseDeadArtifacts(std::span Candidates, }; CallLoweringRequest Request; - Request.Convention = callingConventionID(CallingConvention::LP64D); + Request.Convention = callingConventionID(Convention); Request.Callee = std::move(*Callee); Request.Arguments = {Value(*Left, 0), Value(*Right, 1)}; Request.Results = {Value(*Destination, 0)}; @@ -3620,7 +3621,9 @@ public: if (Action == LegalizationAction::Custom) return widenNarrowMultiply(Instruction, Function, Target); if (Action == LegalizationAction::Libcall) - return lowerMultiplyLibcall(Instruction, Function, Target); + return lowerMultiplyLibcall(Instruction, Function, Target, + Features.has(RISCVExtension::D) ? CallingConvention::LP64D + : CallingConvention::LP64); } if (Action == LegalizationAction::Custom && resultType(Function, Instruction) -- cgit v1.2.3