|
LLVM
3.7.0
|
This class implements the parsing of LLVM IR that's embedded inside a MIR file. More...
Public Member Functions | |
| MIRParserImpl (std::unique_ptr< MemoryBuffer > Contents, StringRef Filename, LLVMContext &Context) | |
| void | reportDiagnostic (const SMDiagnostic &Diag) |
| bool | error (const Twine &Message) |
| Report an error with the given message at unknown location. More... | |
| bool | error (SMLoc Loc, const Twine &Message) |
| Report an error with the given message at the given location. More... | |
| bool | error (const SMDiagnostic &Error, SMRange SourceRange) |
| Report a given error with the location translated from the location in an embedded string literal to a location in the MIR file. More... | |
| std::unique_ptr< Module > | parse () |
| Try to parse the optional LLVM module and the machine functions in the MIR file. More... | |
| bool | parseMachineFunction (yaml::Input &In, Module &M, bool NoLLVMIR) |
| Parse the machine function in the current YAML document. More... | |
| bool | initializeMachineFunction (MachineFunction &MF) |
| Initialize the machine function to the state that's described in the MIR file. More... | |
| bool | initializeMachineBasicBlock (MachineFunction &MF, MachineBasicBlock &MBB, const yaml::MachineBasicBlock &YamlMBB, const PerFunctionMIParsingState &PFS) |
| Initialize the machine basic block using it's YAML representation. More... | |
| bool | initializeRegisterInfo (const MachineFunction &MF, MachineRegisterInfo &RegInfo, const yaml::MachineFunction &YamlMF, DenseMap< unsigned, unsigned > &VirtualRegisterSlots) |
| bool | initializeFrameInfo (MachineFrameInfo &MFI, const yaml::MachineFunction &YamlMF) |
This class implements the parsing of LLVM IR that's embedded inside a MIR file.
Definition at line 46 of file MIRParser.cpp.
| MIRParserImpl::MIRParserImpl | ( | std::unique_ptr< MemoryBuffer > | Contents, |
| StringRef | Filename, | ||
| LLVMContext & | Context | ||
| ) |
Definition at line 137 of file MIRParser.cpp.
References llvm::SourceMgr::AddNewSourceBuffer().
Report an error with the given message at unknown location.
Always returns true.
Definition at line 143 of file MIRParser.cpp.
References llvm::LLVMContext::diagnose(), llvm::SourceMgr::DK_Error, llvm::DS_Error, and llvm::Twine::str().
Referenced by initializeMachineBasicBlock(), initializeMachineFunction(), initializeRegisterInfo(), and parseMachineFunction().
Report an error with the given message at the given location.
Always returns true.
Definition at line 149 of file MIRParser.cpp.
References llvm::LLVMContext::diagnose(), llvm::SourceMgr::DK_Error, llvm::DS_Error, and llvm::SourceMgr::GetMessage().
| bool MIRParserImpl::error | ( | const SMDiagnostic & | Error, |
| SMRange | SourceRange | ||
| ) |
Report a given error with the location translated from the location in an embedded string literal to a location in the MIR file.
Always returns true.
Definition at line 155 of file MIRParser.cpp.
References llvm::SourceMgr::DK_Error, llvm::SMDiagnostic::getKind(), and reportDiagnostic().
| bool MIRParserImpl::initializeFrameInfo | ( | MachineFrameInfo & | MFI, |
| const yaml::MachineFunction & | YamlMF | ||
| ) |
Definition at line 369 of file MIRParser.cpp.
References llvm::yaml::MachineFrameInfo::AdjustsStack, llvm::MachineFrameInfo::CreateFixedObject(), llvm::MachineFrameInfo::CreateFixedSpillStackObject(), llvm::MachineFrameInfo::CreateStackObject(), llvm::MachineFrameInfo::CreateVariableSizedObject(), llvm::MachineFrameInfo::ensureMaxAlignment(), llvm::yaml::MachineFunction::FixedStackObjects, llvm::yaml::MachineFunction::FrameInfo, llvm::yaml::MachineFrameInfo::HasCalls, llvm::yaml::MachineFrameInfo::HasMustTailInVarArgFunc, llvm::yaml::MachineFrameInfo::HasOpaqueSPAdjustment, llvm::yaml::MachineFrameInfo::HasPatchPoint, llvm::yaml::MachineFrameInfo::HasStackMap, llvm::yaml::MachineFrameInfo::HasVAStart, llvm::yaml::MachineFrameInfo::IsFrameAddressTaken, llvm::yaml::MachineFrameInfo::IsReturnAddressTaken, llvm::yaml::MachineFrameInfo::MaxAlignment, llvm::yaml::MachineFrameInfo::MaxCallFrameSize, llvm::yaml::MachineFrameInfo::OffsetAdjustment, llvm::MachineFrameInfo::setAdjustsStack(), llvm::MachineFrameInfo::setFrameAddressIsTaken(), llvm::MachineFrameInfo::setHasCalls(), llvm::MachineFrameInfo::setHasMustTailInVarArgFunc(), llvm::MachineFrameInfo::setHasOpaqueSPAdjustment(), llvm::MachineFrameInfo::setHasPatchPoint(), llvm::MachineFrameInfo::setHasStackMap(), llvm::MachineFrameInfo::setHasVAStart(), llvm::MachineFrameInfo::setMaxCallFrameSize(), llvm::MachineFrameInfo::setObjectAlignment(), llvm::MachineFrameInfo::setObjectOffset(), llvm::MachineFrameInfo::setOffsetAdjustment(), llvm::MachineFrameInfo::setReturnAddressIsTaken(), llvm::MachineFrameInfo::setStackSize(), llvm::yaml::MachineStackObject::SpillSlot, llvm::yaml::FixedMachineStackObject::SpillSlot, llvm::yaml::MachineFunction::StackObjects, llvm::yaml::MachineFrameInfo::StackSize, and llvm::yaml::MachineStackObject::VariableSized.
Referenced by initializeMachineFunction().
| bool MIRParserImpl::initializeMachineBasicBlock | ( | MachineFunction & | MF, |
| MachineBasicBlock & | MBB, | ||
| const yaml::MachineBasicBlock & | YamlMBB, | ||
| const PerFunctionMIParsingState & | PFS | ||
| ) |
Initialize the machine basic block using it's YAML representation.
Return true if an error occurred.
Definition at line 306 of file MIRParser.cpp.
References llvm::MachineBasicBlock::addLiveIn(), llvm::yaml::MachineBasicBlock::AddressTaken, llvm::MachineBasicBlock::addSuccessor(), llvm::yaml::MachineBasicBlock::Alignment, llvm::MachineBasicBlock::end(), llvm::lltok::Error, error(), llvm::MachineBasicBlock::insert(), llvm::yaml::MachineBasicBlock::Instructions, llvm::yaml::MachineBasicBlock::IsLandingPad, llvm::yaml::MachineBasicBlock::LiveIns, llvm::AArch64CC::MI, llvm::parseMachineInstr(), llvm::parseMBBReference(), llvm::parseNamedRegisterReference(), llvm::MachineBasicBlock::setAlignment(), llvm::MachineBasicBlock::setHasAddressTaken(), llvm::MachineBasicBlock::setIsLandingPad(), and llvm::yaml::MachineBasicBlock::Successors.
Referenced by initializeMachineFunction().
| bool MIRParserImpl::initializeMachineFunction | ( | MachineFunction & | MF | ) |
Initialize the machine function to the state that's described in the MIR file.
Return true if error occurred.
Definition at line 252 of file MIRParser.cpp.
References llvm::yaml::MachineFunction::Alignment, llvm::yaml::MachineFunction::BasicBlocks, llvm::MachineFunction::CreateMachineBasicBlock(), llvm::MachineFunction::end(), error(), llvm::yaml::MachineFunction::ExposesReturnsTwice, llvm::MachineFunction::getBlockNumbered(), llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getFunction(), llvm::MachineFunction::getName(), llvm::MachineFunction::getRegInfo(), llvm::Function::getValueSymbolTable(), llvm::yaml::MachineFunction::HasInlineAsm, I, initializeFrameInfo(), initializeMachineBasicBlock(), initializeRegisterInfo(), llvm::MachineFunction::insert(), llvm::ValueSymbolTable::lookup(), llvm::PerFunctionMIParsingState::MBBSlots, llvm::MachineFunction::setAlignment(), llvm::MachineFunction::setExposesReturnsTwice(), llvm::MachineFunction::setHasInlineAsm(), llvm::yaml::StringValue::SourceRange, llvm::SMRange::Start, llvm::yaml::StringValue::Value, and llvm::PerFunctionMIParsingState::VirtualRegisterSlots.
| bool MIRParserImpl::initializeRegisterInfo | ( | const MachineFunction & | MF, |
| MachineRegisterInfo & | RegInfo, | ||
| const yaml::MachineFunction & | YamlMF, | ||
| DenseMap< unsigned, unsigned > & | VirtualRegisterSlots | ||
| ) |
Definition at line 342 of file MIRParser.cpp.
References llvm::MachineRegisterInfo::createVirtualRegister(), llvm::MachineRegisterInfo::enableSubRegLiveness(), error(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::insert(), llvm::MachineRegisterInfo::invalidateLiveness(), llvm::MachineRegisterInfo::isSSA(), llvm::yaml::MachineFunction::IsSSA, llvm::MachineRegisterInfo::leaveSSA(), llvm::MachineRegisterInfo::tracksLiveness(), llvm::yaml::MachineFunction::TracksRegLiveness, llvm::yaml::MachineFunction::TracksSubRegLiveness, and llvm::yaml::MachineFunction::VirtualRegisters.
Referenced by initializeMachineFunction().
| std::unique_ptr< Module > MIRParserImpl::parse | ( | ) |
Try to parse the optional LLVM module and the machine functions in the MIR file.
Return null if an error occurred.
Definition at line 181 of file MIRParser.cpp.
References llvm::lltok::Error, llvm::SourceMgr::getMainFileID(), llvm::SourceMgr::getMemoryBuffer(), handleYAMLDiag(), llvm::tgtok::In, llvm::parseAssembly(), parseMachineFunction(), and reportDiagnostic().
| bool MIRParserImpl::parseMachineFunction | ( | yaml::Input & | In, |
| Module & | M, | ||
| bool | NoLLVMIR | ||
| ) |
Parse the machine function in the current YAML document.
| NoLLVMIR | - set to true when the MIR file doesn't have LLVM IR. A dummy IR function is created and inserted into the given module when this parameter is true. |
Return true if an error occurred.
Definition at line 225 of file MIRParser.cpp.
References error(), llvm::yaml::Input::error(), llvm::Module::getFunction(), and llvm::yaml::yamlize().
Referenced by parse().
| void MIRParserImpl::reportDiagnostic | ( | const SMDiagnostic & | Diag | ) |
Definition at line 161 of file MIRParser.cpp.
References llvm::LLVMContext::diagnose(), llvm::SourceMgr::DK_Error, llvm::SourceMgr::DK_Note, llvm::SourceMgr::DK_Warning, llvm::DS_Error, llvm::DS_Note, llvm::DS_Warning, llvm::SMDiagnostic::getKind(), and Kind.
1.8.6