diff options
| author | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-08-13 13:10:47 +0800 |
|---|---|---|
| committer | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-08-13 13:10:47 +0800 |
| commit | 444db30751380e8fe459bfeae4c5bb2a93c596eb (patch) | |
| tree | 5c60a23678f836113e75fb2526d3ec7b28b42f55 /backend/utils/TableGen/TableGenBackends.h | |
| parent | fde3e045d4dcc5c404cb4216389e18b0e720b8e0 (diff) | |
| download | rcc-project-444db30751380e8fe459bfeae4c5bb2a93c596eb.tar.gz rcc-project-444db30751380e8fe459bfeae4c5bb2a93c596eb.tar.xz | |
[TableGen] Split the target description generator
Diffstat (limited to 'backend/utils/TableGen/TableGenBackends.h')
| -rw-r--r-- | backend/utils/TableGen/TableGenBackends.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/backend/utils/TableGen/TableGenBackends.h b/backend/utils/TableGen/TableGenBackends.h new file mode 100644 index 0000000..7835efb --- /dev/null +++ b/backend/utils/TableGen/TableGenBackends.h @@ -0,0 +1,50 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +// NOLINTNEXTLINE(llvm-header-guard) +#ifndef RCC_UTILS_TABLEGEN_TABLEGENBACKENDS_H +#define RCC_UTILS_TABLEGEN_TABLEGENBACKENDS_H + +#include "Common/CodeGenTarget.h" + +#include <optional> +#include <string> +#include <string_view> +#include <vector> + +namespace rcc::targetgen { + +struct GeneratedDescription final { + std::string RegisterHeader; + std::string InstructionHeader; + std::string TargetTables; +}; + +struct DescriptionGenerationResult final { + std::optional<GeneratedDescription> Output; + std::vector<TextDiagnostic> Diagnostics; + + [[nodiscard]] bool succeeded() const noexcept { + return Output.has_value() && Diagnostics.empty(); + } +}; + +[[nodiscard]] std::string emitRegisterHeader(const NormalizedTargetModel &Model, + std::string_view SourceName); +[[nodiscard]] std::string emitRegisterInfo(const NormalizedTargetModel &Model, + std::string_view SourceName); +[[nodiscard]] std::string emitRegisterBanks(const NormalizedTargetModel &Model); +[[nodiscard]] std::string emitInstructionHeader(const NormalizedTargetModel &Model, + std::string_view SourceName); +[[nodiscard]] std::string emitInstructionInfo(const NormalizedTargetModel &Model); +[[nodiscard]] std::string emitCallingConventions(const NormalizedTargetModel &Model); +[[nodiscard]] std::string emitCodeEmitter(const NormalizedTargetModel &Model); +[[nodiscard]] std::string emitAssemblyWriter(const NormalizedTargetModel &Model); +[[nodiscard]] std::string emitSubtarget(const NormalizedTargetModel &Model); +[[nodiscard]] std::string emitSearchableTables(const NormalizedTargetModel &Model); + +[[nodiscard]] DescriptionGenerationResult generateDescription(const std::string &SourceName, + std::string SourceText); + +} // namespace rcc::targetgen + +#endif // RCC_UTILS_TABLEGEN_TABLEGENBACKENDS_H |
