aboutsummaryrefslogtreecommitdiff
path: root/backend/include/rcc/AsmParser/LLParser.h
diff options
context:
space:
mode:
authorRichard-Qin-X <richard.qin.001@gmail.com>2026-08-13 12:55:12 +0800
committerRichard-Qin-X <richard.qin.001@gmail.com>2026-08-13 12:55:12 +0800
commitfde3e045d4dcc5c404cb4216389e18b0e720b8e0 (patch)
treebdb3f421a87028594d122a6dcae7150c2e5589ca /backend/include/rcc/AsmParser/LLParser.h
parentaa7c85ca71859aab15bdf1e6dc1ea3a5aa5d1e28 (diff)
downloadrcc-project-fde3e045d4dcc5c404cb4216389e18b0e720b8e0.tar.gz
rcc-project-fde3e045d4dcc5c404cb4216389e18b0e720b8e0.tar.xz
[IR] Split LL parsing, assembly writing, and data layout
Diffstat (limited to 'backend/include/rcc/AsmParser/LLParser.h')
-rw-r--r--backend/include/rcc/AsmParser/LLParser.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/backend/include/rcc/AsmParser/LLParser.h b/backend/include/rcc/AsmParser/LLParser.h
new file mode 100644
index 0000000..e15a006
--- /dev/null
+++ b/backend/include/rcc/AsmParser/LLParser.h
@@ -0,0 +1,36 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#ifndef RCC_ASMPARSER_LLPARSER_H
+#define RCC_ASMPARSER_LLPARSER_H
+
+#include "rcc/IR/Constants.h"
+#include "rcc/Support/Error.h"
+
+#include <cstddef>
+#include <span>
+#include <string_view>
+
+namespace rcc {
+
+struct LLNamedTypeDefinition final {
+ std::string_view Name;
+ std::string_view Definition;
+ bool NumericName = false;
+};
+
+struct LLParserOptions final {
+ std::span<const LLNamedTypeDefinition> NamedTypes;
+ std::size_t MaximumDepth = 1024;
+ std::size_t MaximumNodes = std::size_t{1} << 24U;
+ std::size_t MaximumTokenLength = std::size_t{1} << 24U;
+};
+
+[[nodiscard]] Expected<GenericConstantData> parseLLVMConstant(std::string_view Text,
+ LLParserOptions Options = {});
+
+[[nodiscard]] Expected<GenericConstantType> parseLLVMType(std::string_view Text,
+ LLParserOptions Options = {});
+
+} // namespace rcc
+
+#endif // RCC_ASMPARSER_LLPARSER_H