From 09e8ef3e0dae29be7aa21a6e22a118a3f545945f Mon Sep 17 00:00:00 2001 From: Richard-Qin-X Date: Wed, 12 Aug 2026 19:45:09 +0800 Subject: [Tooling] Complete the LLVM MIR command-line contract --- backend/include/rcc/Tooling/BackendInvocation.h | 33 +++---------------------- 1 file changed, 4 insertions(+), 29 deletions(-) (limited to 'backend/include/rcc/Tooling/BackendInvocation.h') diff --git a/backend/include/rcc/Tooling/BackendInvocation.h b/backend/include/rcc/Tooling/BackendInvocation.h index db1c5d2..d61f038 100644 --- a/backend/include/rcc/Tooling/BackendInvocation.h +++ b/backend/include/rcc/Tooling/BackendInvocation.h @@ -3,6 +3,7 @@ #ifndef RCC_TOOLING_BACKENDINVOCATION_H #define RCC_TOOLING_BACKENDINVOCATION_H +#include "rcc/CodeGen/CommandFlags.h" #include "rcc/Support/Error.h" #include @@ -25,26 +26,6 @@ inline constexpr std::string_view GenericOpcodeReferenceVersion = "rcc-generic-o inline constexpr std::string_view RV64GCTargetABILoweringVersion = "rcc-rv64gc-lp64d-v1"; inline constexpr std::string_view CompilerBuildFingerprint = "rcc-backend-0.1.0-stage17"; -enum class RelocationModel : std::uint8_t { - Static, - PositionIndependent, -}; - -enum class CodeModel : std::uint8_t { - Small, - Medium, - Large, -}; - -enum class OptimizationLevel : std::uint8_t { - O0, - O1, - O2, - O3, - Os, - Oz, -}; - enum class LayoutOwnership : std::uint8_t { NativeObject, CompilerFinalLayout, @@ -74,14 +55,14 @@ struct BackendInvocation final { std::vector Features; std::string ABI; std::string DataLayout; - RelocationModel Relocation = RelocationModel::PositionIndependent; - CodeModel Code = CodeModel::Small; + rcc::RelocationModel Relocation = rcc::RelocationModel::PositionIndependent; + rcc::CodeModel Code = rcc::CodeModel::Small; std::vector TargetOptions; LayoutOwnership Layout = LayoutOwnership::NativeObject; std::string AssemblerFlavor; std::string AssemblerVersion; std::vector AssemblerOptions; - OptimizationLevel Optimization = OptimizationLevel::O2; + rcc::OptimizationLevel Optimization = rcc::OptimizationLevel::O2; std::vector PassPipeline{"default"}; DeterminismOptions Determinism; std::optional ActionFuel; @@ -104,13 +85,7 @@ computeTargetDescriptionFingerprint(const TargetDescription &Target); const BackendInvocation &Invocation, std::string_view TargetFingerprint); -[[nodiscard]] std::string_view spelling(RelocationModel Value) noexcept; -[[nodiscard]] std::string_view spelling(CodeModel Value) noexcept; -[[nodiscard]] std::string_view spelling(OptimizationLevel Value) noexcept; [[nodiscard]] std::string_view spelling(LayoutOwnership Value) noexcept; -[[nodiscard]] Expected parseRelocationModel(std::string_view Value); -[[nodiscard]] Expected parseCodeModel(std::string_view Value); -[[nodiscard]] Expected parseOptimizationLevel(std::string_view Value); [[nodiscard]] Expected parseLayoutOwnership(std::string_view Value); } // namespace tooling -- cgit v1.2.3