aboutsummaryrefslogtreecommitdiff
path: root/backend/include/rcc/AsmParser/LLParser.h
diff options
context:
space:
mode:
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