|
LLVM
4.0.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 | parseRegisterInfo (PerFunctionMIParsingState &PFS, const yaml::MachineFunction &YamlMF) |
| bool | setupRegisterInfo (const PerFunctionMIParsingState &PFS, const yaml::MachineFunction &YamlMF) |
| bool | initializeFrameInfo (PerFunctionMIParsingState &PFS, const yaml::MachineFunction &YamlMF) |
| bool | parseCalleeSavedRegister (PerFunctionMIParsingState &PFS, std::vector< CalleeSavedInfo > &CSIInfo, const yaml::StringValue &RegisterSource, int FrameIdx) |
| bool | parseStackObjectsDebugInfo (PerFunctionMIParsingState &PFS, const yaml::MachineStackObject &Object, int FrameIdx) |
| bool | initializeConstantPool (PerFunctionMIParsingState &PFS, MachineConstantPool &ConstantPool, const yaml::MachineFunction &YamlMF) |
| bool | initializeJumpTableInfo (PerFunctionMIParsingState &PFS, const yaml::MachineJumpTable &YamlJTI) |
This class implements the parsing of LLVM IR that's embedded inside a MIR file.
Definition at line 51 of file MIRParser.cpp.
| MIRParserImpl::MIRParserImpl | ( | std::unique_ptr< MemoryBuffer > | Contents, |
| StringRef | Filename, | ||
| LLVMContext & | Context | ||
| ) |
Definition at line 169 of file MIRParser.cpp.
References llvm::SourceMgr::AddNewSourceBuffer().
Report an error with the given message at unknown location.
Always returns true.
Definition at line 175 of file MIRParser.cpp.
References llvm::LLVMContext::diagnose(), llvm::SourceMgr::DK_Error, llvm::DS_Error, and llvm::Twine::str().
Referenced by initializeConstantPool(), initializeFrameInfo(), initializeJumpTableInfo(), initializeMachineFunction(), parseCalleeSavedRegister(), parseMachineFunction(), parseRegisterInfo(), setupRegisterInfo(), and typecheckMDNode().
Report an error with the given message at the given location.
Always returns true.
Definition at line 181 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 187 of file MIRParser.cpp.
References assert(), llvm::SourceMgr::DK_Error, llvm::SMDiagnostic::getKind(), and reportDiagnostic().
| bool MIRParserImpl::initializeConstantPool | ( | PerFunctionMIParsingState & | PFS, |
| MachineConstantPool & | ConstantPool, | ||
| const yaml::MachineFunction & | YamlMF | ||
| ) |
Definition at line 691 of file MIRParser.cpp.
References llvm::PerFunctionMIParsingState::ConstantPoolSlots, llvm::yaml::MachineFunction::Constants, llvm::lltok::Error, error(), llvm::MachineConstantPool::getConstantPoolIndex(), llvm::Module::getDataLayout(), llvm::MachineFunction::getFunction(), llvm::GlobalValue::getParent(), llvm::DataLayout::getPrefTypeAlignment(), llvm::Value::getType(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::insert(), llvm::PerFunctionMIParsingState::MF, and llvm::parseConstantValue().
Referenced by initializeMachineFunction().
| bool MIRParserImpl::initializeFrameInfo | ( | PerFunctionMIParsingState & | PFS, |
| const yaml::MachineFunction & | YamlMF | ||
| ) |
Definition at line 526 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::lltok::Error, error(), llvm::yaml::MachineFunction::FixedStackObjects, llvm::PerFunctionMIParsingState::FixedStackObjectSlots, llvm::yaml::MachineFunction::FrameInfo, llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getFunction(), llvm::Value::getName(), llvm::Function::getValueSymbolTable(), 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::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::insert(), llvm::yaml::MachineFrameInfo::IsFrameAddressTaken, llvm::yaml::MachineFrameInfo::IsReturnAddressTaken, llvm::ValueSymbolTable::lookup(), llvm::MachineFrameInfo::mapLocalFrameObject(), llvm::yaml::MachineFrameInfo::MaxAlignment, llvm::yaml::MachineFrameInfo::MaxCallFrameSize, llvm::PerFunctionMIParsingState::MF, llvm::yaml::MachineFrameInfo::OffsetAdjustment, parseCalleeSavedRegister(), llvm::parseStackObjectReference(), parseStackObjectsDebugInfo(), llvm::yaml::MachineFrameInfo::RestorePoint, llvm::yaml::MachineFrameInfo::SavePoint, llvm::MachineFrameInfo::setAdjustsStack(), llvm::MachineFrameInfo::setCalleeSavedInfo(), llvm::MachineFrameInfo::setCalleeSavedInfoValid(), 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::setRestorePoint(), llvm::MachineFrameInfo::setReturnAddressIsTaken(), llvm::MachineFrameInfo::setSavePoint(), llvm::MachineFrameInfo::setStackProtectorIndex(), llvm::MachineFrameInfo::setStackSize(), llvm::yaml::StringValue::SourceRange, llvm::yaml::MachineStackObject::SpillSlot, llvm::yaml::FixedMachineStackObject::SpillSlot, llvm::yaml::MachineFunction::StackObjects, llvm::PerFunctionMIParsingState::StackObjectSlots, llvm::yaml::MachineFrameInfo::StackProtector, llvm::yaml::MachineFrameInfo::StackSize, llvm::SMRange::Start, llvm::yaml::StringValue::Value, and llvm::yaml::MachineStackObject::VariableSized.
Referenced by initializeMachineFunction().
| bool MIRParserImpl::initializeJumpTableInfo | ( | PerFunctionMIParsingState & | PFS, |
| const yaml::MachineJumpTable & | YamlJTI | ||
| ) |
Definition at line 716 of file MIRParser.cpp.
References llvm::MachineJumpTableInfo::createJumpTableIndex(), llvm::yaml::MachineJumpTable::Entries, error(), llvm::MachineFunction::getOrCreateJumpTableInfo(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::insert(), llvm::PerFunctionMIParsingState::JumpTableSlots, llvm::yaml::MachineJumpTable::Kind, llvm::PerFunctionMIParsingState::MF, and llvm::MachineBasicBlock::push_back().
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 322 of file MIRParser.cpp.
References llvm::SourceMgr::AddNewSourceBuffer(), llvm::yaml::MachineFunction::Alignment, assert(), llvm::yaml::MachineFunction::Body, llvm::yaml::MachineFunction::Constants, llvm::MachineFunction::empty(), llvm::yaml::MachineJumpTable::Entries, llvm::lltok::Error, error(), llvm::yaml::MachineFunction::ExposesReturnsTwice, llvm::MachineFunction::getConstantPool(), llvm::MemoryBuffer::getMemBuffer(), llvm::MachineFunction::getName(), llvm::MachineFunction::getProperties(), initializeConstantPool(), initializeFrameInfo(), initializeJumpTableInfo(), llvm::yaml::MachineFunction::JumpTableInfo, llvm::MachineFunctionProperties::Legalized, llvm::yaml::MachineFunction::Legalized, llvm::parseMachineBasicBlockDefinitions(), llvm::parseMachineInstructions(), parseRegisterInfo(), llvm::MachineFunctionProperties::RegBankSelected, llvm::yaml::MachineFunction::RegBankSelected, reportDiagnostic(), llvm::MachineFunctionProperties::Selected, llvm::yaml::MachineFunction::Selected, llvm::MachineFunctionProperties::set(), llvm::MachineFunction::setAlignment(), llvm::MachineFunction::setExposesReturnsTwice(), setupRegisterInfo(), llvm::PerFunctionMIParsingState::SM, llvm::yaml::StringValue::SourceRange, llvm::yaml::StringValue::Value, llvm::yaml::BlockStringValue::Value, and llvm::MachineFunction::verify().
| 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 213 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::parseCalleeSavedRegister | ( | PerFunctionMIParsingState & | PFS, |
| std::vector< CalleeSavedInfo > & | CSIInfo, | ||
| const yaml::StringValue & | RegisterSource, | ||
| int | FrameIdx | ||
| ) |
Definition at line 630 of file MIRParser.cpp.
References llvm::lltok::Error, error(), llvm::parseNamedRegisterReference(), llvm::yaml::StringValue::SourceRange, and llvm::yaml::StringValue::Value.
Referenced by initializeFrameInfo().
| 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 257 of file MIRParser.cpp.
References error(), llvm::yaml::Input::error(), llvm::Module::getFunction(), and llvm::yaml::yamlize().
Referenced by parse().
| bool MIRParserImpl::parseRegisterInfo | ( | PerFunctionMIParsingState & | PFS, |
| const yaml::MachineFunction & | YamlMF | ||
| ) |
Definition at line 401 of file MIRParser.cpp.
References llvm::MachineRegisterInfo::addLiveIn(), assert(), llvm::yaml::MachineFunction::CalleeSavedRegisters, llvm::VRegInfo::D, llvm::StringRef::equals(), llvm::lltok::Error, error(), llvm::VRegInfo::Explicit, llvm::VRegInfo::GENERIC, llvm::MachineFunction::getRegInfo(), llvm::MachineRegisterInfo::getUsedPhysRegsMask(), llvm::PerFunctionMIParsingState::getVRegInfo(), llvm::MachineRegisterInfo::invalidateLiveness(), llvm::VRegInfo::Kind, llvm::yaml::MachineFunction::LiveIns, llvm::PerFunctionMIParsingState::MF, llvm::VRegInfo::NORMAL, llvm::parseNamedRegisterReference(), llvm::parseRegisterReference(), llvm::parseVirtualRegisterReference(), llvm::VRegInfo::PreferredReg, llvm::VRegInfo::RC, llvm::VRegInfo::REGBANK, llvm::VRegInfo::RegBank, llvm::MachineRegisterInfo::setUsedPhysRegMask(), llvm::BitVector::size(), llvm::MachineRegisterInfo::tracksLiveness(), llvm::yaml::MachineFunction::TracksRegLiveness, llvm::yaml::MachineFunction::VirtualRegisters, and llvm::VRegInfo::VReg.
Referenced by initializeMachineFunction().
| bool MIRParserImpl::parseStackObjectsDebugInfo | ( | PerFunctionMIParsingState & | PFS, |
| const yaml::MachineStackObject & | Object, | ||
| int | FrameIdx | ||
| ) |
Definition at line 658 of file MIRParser.cpp.
References assert(), llvm::yaml::MachineStackObject::DebugExpr, llvm::yaml::MachineStackObject::DebugLoc, llvm::yaml::MachineStackObject::DebugVar, llvm::PerFunctionMIParsingState::MF, llvm::MachineFunction::setVariableDbgInfo(), and typecheckMDNode().
Referenced by initializeFrameInfo().
| void MIRParserImpl::reportDiagnostic | ( | const SMDiagnostic & | Diag | ) |
Definition at line 193 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.
Referenced by error(), initializeMachineFunction(), and parse().
| bool MIRParserImpl::setupRegisterInfo | ( | const PerFunctionMIParsingState & | PFS, |
| const yaml::MachineFunction & | YamlMF | ||
| ) |
Definition at line 479 of file MIRParser.cpp.
References llvm::MachineRegisterInfo::addPhysRegsUsedFromRegMask(), llvm::yaml::MachineFunction::CalleeSavedRegisters, llvm::VRegInfo::D, llvm::lltok::Error, error(), llvm::MachineRegisterInfo::freezeReservedRegs(), llvm::VRegInfo::GENERIC, llvm::MachineFunction::getName(), llvm::MachineFunction::getRegInfo(), llvm::VRegInfo::Kind, llvm::PerFunctionMIParsingState::MF, MI, llvm::VRegInfo::NORMAL, P, llvm::VRegInfo::PreferredReg, llvm::VRegInfo::RC, llvm::VRegInfo::REGBANK, llvm::VRegInfo::RegBank, llvm::MachineRegisterInfo::setRegBank(), llvm::MachineRegisterInfo::setRegClass(), llvm::MachineRegisterInfo::setSimpleHint(), llvm::VRegInfo::UNKNOWN, llvm::VRegInfo::VReg, and llvm::PerFunctionMIParsingState::VRegInfos.
Referenced by initializeMachineFunction().
1.8.6