diff options
Diffstat (limited to 'backend/lib/CodeGen/MIRParser')
| -rw-r--r-- | backend/lib/CodeGen/MIRParser/MIParser.cpp | 2 | ||||
| -rw-r--r-- | backend/lib/CodeGen/MIRParser/MIRParser.cpp | 17 |
2 files changed, 11 insertions, 8 deletions
diff --git a/backend/lib/CodeGen/MIRParser/MIParser.cpp b/backend/lib/CodeGen/MIRParser/MIParser.cpp index 183e6b3..0015b02 100644 --- a/backend/lib/CodeGen/MIRParser/MIParser.cpp +++ b/backend/lib/CodeGen/MIRParser/MIParser.cpp @@ -3,6 +3,7 @@ #include "rcc/CodeGen/MIRParser/MIParser.h" #include "MILexer.h" +#include "rcc/AsmParser/LLParser.h" #include "rcc/CodeGen/GenericOpcodes.h" #include "rcc/CodeGen/InlineAsm.h" #include "rcc/CodeGen/InstructionDescriptor.h" @@ -17,7 +18,6 @@ #include "rcc/CodeGen/TargetDescription.h" #include "rcc/CodeGen/TargetMIRTextInfo.h" #include "rcc/CodeGen/TargetRegisterInfo.h" -#include "rcc/MIR/LLVMConstantSyntax.h" #include <algorithm> #include <array> diff --git a/backend/lib/CodeGen/MIRParser/MIRParser.cpp b/backend/lib/CodeGen/MIRParser/MIRParser.cpp index e22f1bc..3b89491 100644 --- a/backend/lib/CodeGen/MIRParser/MIRParser.cpp +++ b/backend/lib/CodeGen/MIRParser/MIRParser.cpp @@ -18,7 +18,7 @@ #include "rcc/CodeGen/TargetDescription.h" #include "rcc/CodeGen/TargetMIRTextInfo.h" #include "rcc/CodeGen/TargetRegisterInfo.h" -#include "rcc/MIR/LLVMConstantSyntax.h" +#include "rcc/IR/DataLayout.h" #include <algorithm> #include <array> @@ -74,11 +74,8 @@ std::string_view MIRDocumentParser::effectiveDataLayout() const noexcept { return {}; } -LLVMConstantSyntaxOptions MIRDocumentParser::pointerLayoutOptions() const noexcept { - return { - .DataLayout = effectiveDataLayout(), - .NamedTypes = {}, - }; +Expected<DataLayout> MIRDocumentParser::dataLayout() const { + return DataLayout::parse(effectiveDataLayout()); } bool MIRDocumentParser::requireKind(const yaml::Node &Node, yaml::NodeKind Kind, @@ -160,7 +157,13 @@ MIRDocumentParseResult MIRDocumentParser::run() { } if (!effectiveDataLayout().empty()) { - auto PointerSize = llvmPointerSizeInBits(0, pointerLayoutOptions()); + auto Layout = dataLayout(); + if (!Layout) { + static_cast<void>( + importError(Stream->documents()[FirstContent].Range, Layout.error(), "mir-data-layout")); + return std::move(Result); + } + auto PointerSize = Layout->getPointerSizeInBits(); if (!PointerSize) { static_cast<void>(importError(Stream->documents()[FirstContent].Range, PointerSize.error(), "mir-data-layout")); |
