// SPDX-License-Identifier: GPL-3.0-or-later #ifndef RCC_CODEGEN_COMMANDFLAGS_H #define RCC_CODEGEN_COMMANDFLAGS_H #include "rcc/Support/Error.h" #include #include #include #include #include #include #include namespace rcc { 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 CodeGenFileType : std::uint8_t { AssemblyFile, ObjectFile, Null, }; enum class GlobalISelAbortMode : std::uint8_t { Disable, Enable, DisableWithDiagnostic, }; struct CodeGenCommandFlags final { std::optional Triple; std::optional CPU; std::optional TuneCPU; std::optional ABI; std::vector FeatureOverrides; std::optional Relocation; std::optional Code; std::optional Optimization; CodeGenFileType FileType = CodeGenFileType::AssemblyFile; bool FileTypeWasSpecified = false; }; [[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(CodeGenFileType 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 parseCodeGenFileType(std::string_view Value); [[nodiscard]] Expected parseGlobalISelAbortMode(std::string_view Value); [[nodiscard]] Expected parseCodeGenCommandFlag(std::span Arguments, std::size_t &Index, CodeGenCommandFlags &Flags); } // namespace rcc #endif // RCC_CODEGEN_COMMANDFLAGS_H