From e16de95dce32f077361577377d5c52fc4ad78339 Mon Sep 17 00:00:00 2001 From: Richard-Qin-X Date: Fri, 7 Aug 2026 02:15:09 +0800 Subject: [RISCV] Add generated RV64GC register description Add an RCC-owned build-time target description generator and the initial RV64GC register model. Keep ABI aliases separate from canonical MIR register spelling. --- .../Description/TargetDescriptionGenerator.h | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 backend/lib/Target/Description/TargetDescriptionGenerator.h (limited to 'backend/lib/Target/Description/TargetDescriptionGenerator.h') diff --git a/backend/lib/Target/Description/TargetDescriptionGenerator.h b/backend/lib/Target/Description/TargetDescriptionGenerator.h new file mode 100644 index 0000000..54cbf3c --- /dev/null +++ b/backend/lib/Target/Description/TargetDescriptionGenerator.h @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#ifndef RCC_TARGET_DESCRIPTION_TARGETDESCRIPTIONGENERATOR_H +#define RCC_TARGET_DESCRIPTION_TARGETDESCRIPTIONGENERATOR_H + +#include "rcc/Support/TextDiagnostic.h" + +#include +#include +#include +#include + +namespace rcc::targetgen { + +struct GeneratedDescription final { + std::string RegisterHeader; + std::string TargetTables; +}; + +struct DescriptionGenerationResult final { + std::optional Output; + std::vector Diagnostics; + + [[nodiscard]] bool succeeded() const noexcept { + return Output.has_value() && Diagnostics.empty(); + } +}; + +[[nodiscard]] DescriptionGenerationResult generateDescription(std::string SourceName, + std::string SourceText); + +} // namespace rcc::targetgen + +#endif // RCC_TARGET_DESCRIPTION_TARGETDESCRIPTIONGENERATOR_H -- cgit v1.2.3