//===- RISCV.cpp ----------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "ABIInfoImpl.h" #include "TargetInfo.h" usingnamespaceclang; usingnamespaceclang::CodeGen; //===----------------------------------------------------------------------===// // RISC-V ABI Implementation //===----------------------------------------------------------------------===// namespace { class RISCVABIInfo : public DefaultABIInfo { … }; } // end anonymous namespace void RISCVABIInfo::computeInfo(CGFunctionInfo &FI) const { … } // Returns true if the struct is a potential candidate for the floating point // calling convention. If this function returns true, the caller is // responsible for checking that if there is only a single field then that // field is a float. bool RISCVABIInfo::detectFPCCEligibleStructHelper(QualType Ty, CharUnits CurOff, llvm::Type *&Field1Ty, CharUnits &Field1Off, llvm::Type *&Field2Ty, CharUnits &Field2Off) const { … } // Determine if a struct is eligible for passing according to the floating // point calling convention (i.e., when flattened it contains a single fp // value, fp+fp, or int+fp of appropriate size). If so, NeededArgFPRs and // NeededArgGPRs are incremented appropriately. bool RISCVABIInfo::detectFPCCEligibleStruct(QualType Ty, llvm::Type *&Field1Ty, CharUnits &Field1Off, llvm::Type *&Field2Ty, CharUnits &Field2Off, int &NeededArgGPRs, int &NeededArgFPRs) const { … } // Call getCoerceAndExpand for the two-element flattened struct described by // Field1Ty, Field1Off, Field2Ty, Field2Off. This method will create an // appropriate coerceToType and unpaddedCoerceToType. ABIArgInfo RISCVABIInfo::coerceAndExpandFPCCEligibleStruct( llvm::Type *Field1Ty, CharUnits Field1Off, llvm::Type *Field2Ty, CharUnits Field2Off) const { … } // Fixed-length RVV vectors are represented as scalable vectors in function // args/return and must be coerced from fixed vectors. ABIArgInfo RISCVABIInfo::coerceVLSVector(QualType Ty) const { … } ABIArgInfo RISCVABIInfo::classifyArgumentType(QualType Ty, bool IsFixed, int &ArgGPRsLeft, int &ArgFPRsLeft) const { … } ABIArgInfo RISCVABIInfo::classifyReturnType(QualType RetTy) const { … } RValue RISCVABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, QualType Ty, AggValueSlot Slot) const { … } ABIArgInfo RISCVABIInfo::extendType(QualType Ty) const { … } namespace { class RISCVTargetCodeGenInfo : public TargetCodeGenInfo { … }; } // namespace std::unique_ptr<TargetCodeGenInfo> CodeGen::createRISCVTargetCodeGenInfo(CodeGenModule &CGM, unsigned XLen, unsigned FLen, bool EABI) { … }