diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2022-07-04 19:20:19 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2023-02-08 19:02:26 +0000 |
commit | 81ad626541db97eb356e2c1d4a20eb2a26a766ab (patch) | |
tree | 311b6a8987c32b1e1dcbab65c54cfac3fdb56175 /contrib/llvm-project/llvm/lib/CodeGen/MIRParser/MIRParser.cpp | |
parent | 5fff09660e06a66bed6482da9c70df328e16bbb6 (diff) | |
parent | 145449b1e420787bb99721a429341fa6be3adfb6 (diff) |
Diffstat (limited to 'contrib/llvm-project/llvm/lib/CodeGen/MIRParser/MIRParser.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/CodeGen/MIRParser/MIRParser.cpp | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/MIRParser/MIRParser.cpp b/contrib/llvm-project/llvm/lib/CodeGen/MIRParser/MIRParser.cpp index f144639770bc..4944cb46c5b5 100644 --- a/contrib/llvm-project/llvm/lib/CodeGen/MIRParser/MIRParser.cpp +++ b/contrib/llvm-project/llvm/lib/CodeGen/MIRParser/MIRParser.cpp @@ -13,13 +13,10 @@ #include "llvm/CodeGen/MIRParser/MIRParser.h" #include "llvm/ADT/DenseMap.h" -#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" #include "llvm/AsmParser/Parser.h" #include "llvm/AsmParser/SlotMapping.h" -#include "llvm/CodeGen/GlobalISel/RegisterBank.h" -#include "llvm/CodeGen/GlobalISel/RegisterBankInfo.h" #include "llvm/CodeGen/MIRParser/MIParser.h" #include "llvm/CodeGen/MIRYamlMapping.h" #include "llvm/CodeGen/MachineConstantPool.h" @@ -29,7 +26,7 @@ #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/TargetFrameLowering.h" #include "llvm/IR/BasicBlock.h" -#include "llvm/IR/DebugInfo.h" +#include "llvm/IR/DebugInfoMetadata.h" #include "llvm/IR/DiagnosticInfo.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/LLVMContext.h" @@ -46,6 +43,8 @@ using namespace llvm; namespace llvm { +class MDNode; +class RegisterBank; /// This class implements the parsing of LLVM IR that's embedded inside a MIR /// file. @@ -459,6 +458,12 @@ MIRParserImpl::initializeMachineFunction(const yaml::MachineFunction &YamlMF, MF.setExposesReturnsTwice(YamlMF.ExposesReturnsTwice); MF.setHasWinCFI(YamlMF.HasWinCFI); + MF.setCallsEHReturn(YamlMF.CallsEHReturn); + MF.setCallsUnwindInit(YamlMF.CallsUnwindInit); + MF.setHasEHCatchret(YamlMF.HasEHCatchret); + MF.setHasEHScopes(YamlMF.HasEHScopes); + MF.setHasEHFunclets(YamlMF.HasEHFunclets); + if (YamlMF.Legalized) MF.getProperties().set(MachineFunctionProperties::Property::Legalized); if (YamlMF.RegBankSelected) @@ -638,7 +643,7 @@ bool MIRParserImpl::parseRegisterInfo(PerFunctionMIParsingState &PFS, // be saved for the caller). if (YamlMF.CalleeSavedRegisters) { SmallVector<MCPhysReg, 16> CalleeSavedRegisters; - for (const auto &RegSource : YamlMF.CalleeSavedRegisters.getValue()) { + for (const auto &RegSource : *YamlMF.CalleeSavedRegisters) { Register Reg; if (parseNamedRegisterReference(PFS, Reg, RegSource.Value, Error)) return error(Error, RegSource.SourceRange); @@ -809,7 +814,7 @@ bool MIRParserImpl::initializeFrameInfo(PerFunctionMIParsingState &PFS, Object.CalleeSavedRestored, ObjectIdx)) return true; if (Object.LocalOffset) - MFI.mapLocalFrameObject(ObjectIdx, Object.LocalOffset.getValue()); + MFI.mapLocalFrameObject(ObjectIdx, *Object.LocalOffset); if (parseStackObjectsDebugInfo(PFS, Object, ObjectIdx)) return true; } @@ -826,6 +831,15 @@ bool MIRParserImpl::initializeFrameInfo(PerFunctionMIParsingState &PFS, return error(Error, YamlMFI.StackProtector.SourceRange); MFI.setStackProtectorIndex(FI); } + + if (!YamlMFI.FunctionContext.Value.empty()) { + SMDiagnostic Error; + int FI; + if (parseStackObjectReference(PFS, FI, YamlMFI.FunctionContext.Value, Error)) + return error(Error, YamlMFI.FunctionContext.SourceRange); + MFI.setFunctionContextIndex(FI); + } + return false; } @@ -909,7 +923,7 @@ bool MIRParserImpl::initializeConstantPool(PerFunctionMIParsingState &PFS, return error(Error, YamlConstant.Value.SourceRange); const Align PrefTypeAlign = M.getDataLayout().getPrefTypeAlign(Value->getType()); - const Align Alignment = YamlConstant.Alignment.getValueOr(PrefTypeAlign); + const Align Alignment = YamlConstant.Alignment.value_or(PrefTypeAlign); unsigned Index = ConstantPool.getConstantPoolIndex(Value, Alignment); if (!ConstantPoolSlots.insert(std::make_pair(YamlConstant.ID.Value, Index)) .second) @@ -1023,7 +1037,7 @@ SMDiagnostic MIRParserImpl::diagFromBlockStringDiag(const SMDiagnostic &Error, MIRParser::MIRParser(std::unique_ptr<MIRParserImpl> Impl) : Impl(std::move(Impl)) {} -MIRParser::~MIRParser() {} +MIRParser::~MIRParser() = default; std::unique_ptr<Module> MIRParser::parseIRModule(DataLayoutCallbackTy DataLayoutCallback) { |