// SPDX-License-Identifier: GPL-3.0-or-later #ifndef RCC_TARGET_RISCV_RISCVTARGET_H #define RCC_TARGET_RISCV_RISCVTARGET_H #include "rcc/CodeGen/TargetDescription.h" #include "rcc/Support/Error.h" #include "rcc/Target/RISCV/RISCVInstructions.h" #include "rcc/Target/RISCV/RISCVRegisters.h" #include #include #include #include namespace rcc::riscv { struct SchedulingClassInfo final { SchedulingClassID ID; std::string_view Name; std::uint32_t MicroOps = 0; std::uint32_t Latency = 0; }; struct EncodingCategoryInfo final { EncodingCategoryID ID; std::string_view Name; std::uint32_t SizeInBytes = 0; }; struct AssemblyFormatInfo final { AssemblyFormatID ID; std::string_view Name; }; struct AssemblyInstructionInfo final { Opcode InstructionOpcode; std::string_view Mnemonic; AssemblyFormatID Format; std::uint32_t Encoding = 0; }; struct CallingConventionInfo final { CallingConvention ID; std::string_view Name; RegisterClassID IntegerRegisterClass; RegisterClassID FloatingRegisterClass; std::span IntegerArgumentRegisters; std::span FloatingArgumentRegisters; std::span IntegerReturnRegisters; std::span FloatingReturnRegisters; std::string_view PreservedMaskName; std::uint32_t StackAlignmentBytes = 0; std::uint32_t StackArgumentAlignmentBytes = 0; std::uint32_t ShadowSpaceBytes = 0; bool SupportsVarArgs = false; bool SupportsTailCalls = false; }; [[nodiscard]] Expected physicalRegister(PhysicalRegisterID ID); [[nodiscard]] Expected createRegisterInfo(); [[nodiscard]] Expected createMIRTextInfo(); [[nodiscard]] Expected createTargetDescription(); [[nodiscard]] std::shared_ptr createCallPreservedMask(CallingConvention Convention); [[nodiscard]] std::span schedulingClasses() noexcept; [[nodiscard]] std::span encodingCategories() noexcept; [[nodiscard]] std::span assemblyFormats() noexcept; [[nodiscard]] std::span assemblyInstructions() noexcept; [[nodiscard]] const AssemblyInstructionInfo *assemblyInstruction(Opcode InstructionOpcode) noexcept; [[nodiscard]] std::span callingConventions() noexcept; [[nodiscard]] const CallingConventionInfo *callingConvention(CallingConvention ID) noexcept; } // namespace rcc::riscv #endif // RCC_TARGET_RISCV_RISCVTARGET_H