diff options
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 |
