LLVM
8.0.1
|
This class implements the parsing of LLVM IR that's embedded inside a MIR file. More...
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 177 of file MIRParser.cpp.
Report an error with the given message at unknown location.
Always returns true.
Definition at line 188 of file MIRParser.cpp.
References llvm::LLVMContext::diagnose(), llvm::SourceMgr::DK_Error, llvm::DS_Error, and llvm::Twine::str().
Referenced by initializeConstantPool(), initializeFrameInfo(), initializeJumpTableInfo(), parseCalleeSavedRegister(), parseMachineFunction(), parseRegisterInfo(), and setupRegisterInfo().
Report an error with the given message at the given location.
Always returns true.
Definition at line 194 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 200 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 741 of file MIRParser.cpp.
References llvm::PerFunctionMIParsingState::ConstantPoolSlots, llvm::yaml::MachineFunction::Constants, llvm::Error, error(), llvm::MachineConstantPool::getConstantPoolIndex(), llvm::MachineFunction::getFunction(), llvm::GlobalValue::getParent(), 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 566 of file MIRParser.cpp.
References llvm::yaml::MachineFrameInfo::AdjustsStack, llvm::MachineFrameInfo::CreateFixedObject(), llvm::MachineFrameInfo::CreateFixedSpillStackObject(), llvm::MachineFrameInfo::CreateStackObject(), llvm::MachineFrameInfo::CreateVariableSizedObject(), llvm::yaml::MachineFrameInfo::CVBytesOfCalleeSavedRegisters, llvm::MachineFrameInfo::ensureMaxAlignment(), llvm::Error, error(), F(), 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::yaml::MachineFrameInfo::LocalFrameSize, llvm::ValueSymbolTable::lookup(), llvm::MachineFrameInfo::mapLocalFrameObject(), llvm::yaml::MachineFrameInfo::MaxAlignment, llvm::yaml::MachineFrameInfo::MaxCallFrameSize, llvm::PerFunctionMIParsingState::MF, Name, 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::setCVBytesOfCalleeSavedRegisters(), llvm::MachineFrameInfo::setFrameAddressIsTaken(), llvm::MachineFrameInfo::setHasCalls(), llvm::MachineFrameInfo::setHasMustTailInVarArgFunc(), llvm::MachineFrameInfo::setHasOpaqueSPAdjustment(), llvm::MachineFrameInfo::setHasPatchPoint(), llvm::MachineFrameInfo::setHasStackMap(), llvm::MachineFrameInfo::setHasVAStart(), llvm::MachineFrameInfo::setLocalFrameSize(), llvm::MachineFrameInfo::setMaxCallFrameSize(), llvm::MachineFrameInfo::setObjectAlignment(), llvm::MachineFrameInfo::setObjectOffset(), llvm::MachineFrameInfo::setOffsetAdjustment(), llvm::MachineFrameInfo::setRestorePoint(), llvm::MachineFrameInfo::setReturnAddressIsTaken(), llvm::MachineFrameInfo::setSavePoint(), llvm::MachineFrameInfo::setStackID(), 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 770 of file MIRParser.cpp.
References assert(), llvm::MachineJumpTableInfo::createJumpTableIndex(), llvm::StringRef::data(), E, llvm::StringMapImpl::empty(), llvm::SMRange::End, llvm::StringMap< ValueTy, AllocatorTy >::end(), llvm::yaml::MachineJumpTable::Entries, llvm::Error, error(), llvm::StringRef::find(), llvm::StringMap< ValueTy, AllocatorTy >::find(), llvm::SMDiagnostic::getColumnNo(), llvm::SMDiagnostic::getFixIts(), llvm::SMLoc::getFromPointer(), llvm::SMDiagnostic::getKind(), llvm::SourceMgr::getLineAndColumn(), llvm::SMDiagnostic::getLineContents(), llvm::SMDiagnostic::getLineNo(), llvm::SMDiagnostic::getLoc(), llvm::SourceMgr::getMainFileID(), llvm::SourceMgr::getMemoryBuffer(), llvm::SourceMgr::GetMessage(), llvm::SMDiagnostic::getMessage(), llvm::RegisterBankInfo::getNumRegBanks(), llvm::TargetRegisterInfo::getNumRegClasses(), llvm::MachineFunction::getOrCreateJumpTableInfo(), llvm::SMLoc::getPointer(), llvm::SMDiagnostic::getRanges(), llvm::RegisterBankInfo::getRegBank(), llvm::TargetSubtargetInfo::getRegBankInfo(), llvm::TargetRegisterInfo::getRegClass(), llvm::TargetRegisterInfo::getRegClassName(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::MachineFunction::getSubtarget(), I, Indent, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::insert(), llvm::StringMap< ValueTy, AllocatorTy >::insert(), llvm::SMRange::isValid(), llvm::PerFunctionMIParsingState::JumpTableSlots, llvm::yaml::MachineJumpTable::Kind, llvm::PerFunctionMIParsingState::MF, Name, llvm::None, llvm::StringRef::npos, llvm::parseMBBReference(), llvm::MachineBasicBlock::push_back(), llvm::yaml::StringValue::SourceRange, llvm::SMRange::Start, TRI, and llvm::yaml::StringValue::Value.
Referenced by initializeMachineFunction().
bool MIRParserImpl::initializeMachineFunction | ( | const yaml::MachineFunction & | YamlMF, |
MachineFunction & | MF | ||
) |
Initialize the machine function to the state that's described in the MIR file.
Return true if error occurred.
Definition at line 350 of file MIRParser.cpp.
References llvm::SourceMgr::AddNewSourceBuffer(), llvm::yaml::MachineFunction::Alignment, assert(), llvm::yaml::MachineFunction::Body, llvm::yaml::MachineFunction::Constants, llvm::yaml::MachineJumpTable::Entries, llvm::Error, llvm::yaml::MachineFunction::ExposesReturnsTwice, llvm::MachineFunctionProperties::FailedISel, llvm::yaml::MachineFunction::FailedISel, llvm::MachineFunction::getConstantPool(), llvm::MemoryBuffer::getMemBuffer(), llvm::MachineFunction::getProperties(), llvm::MachineFunction::getSubtarget(), llvm::yaml::MachineFunction::HasWinCFI, initializeConstantPool(), initializeFrameInfo(), initializeJumpTableInfo(), llvm::yaml::MachineFunction::JumpTableInfo, llvm::MachineFunctionProperties::Legalized, llvm::yaml::MachineFunction::Legalized, llvm::TargetSubtargetInfo::mirFileLoaded(), 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(), llvm::MachineFunction::setHasWinCFI(), setupRegisterInfo(), llvm::PerFunctionMIParsingState::SM, llvm::yaml::StringValue::SourceRange, llvm::yaml::StringValue::Value, llvm::yaml::BlockStringValue::Value, and llvm::MachineFunction::verify().
Referenced by parseMachineFunction().
bool MIRParserImpl::parseCalleeSavedRegister | ( | PerFunctionMIParsingState & | PFS, |
std::vector< CalleeSavedInfo > & | CSIInfo, | ||
const yaml::StringValue & | RegisterSource, | ||
bool | IsRestored, | ||
int | FrameIdx | ||
) |
Definition at line 678 of file MIRParser.cpp.
References llvm::Error, error(), llvm::parseNamedRegisterReference(), Reg, llvm::CalleeSavedInfo::setRestored(), llvm::yaml::StringValue::SourceRange, and llvm::yaml::StringValue::Value.
Referenced by initializeFrameInfo().
std::unique_ptr< Module > MIRParserImpl::parseIRModule | ( | ) |
Try to parse the optional LLVM module and the machine functions in the MIR file.
Return null if an error occurred.
Definition at line 225 of file MIRParser.cpp.
References llvm::Error, llvm::parseAssembly(), and reportDiagnostic().
bool MIRParserImpl::parseMachineFunction | ( | Module & | M, |
MachineModuleInfo & | MMI | ||
) |
Parse the machine function in the current YAML document.
Return true if an error occurred.
Definition at line 281 of file MIRParser.cpp.
References createDummyFunction(), error(), F(), llvm::Module::getFunction(), llvm::MachineModuleInfo::getMachineFunction(), llvm::MachineModuleInfo::getOrCreateMachineFunction(), initializeMachineFunction(), and llvm::yaml::MachineFunction::Name.
Referenced by parseMachineFunctions().
bool MIRParserImpl::parseMachineFunctions | ( | Module & | M, |
MachineModuleInfo & | MMI | ||
) |
Definition at line 257 of file MIRParser.cpp.
References parseMachineFunction().
bool MIRParserImpl::parseRegisterInfo | ( | PerFunctionMIParsingState & | PFS, |
const yaml::MachineFunction & | YamlMF | ||
) |
Definition at line 430 of file MIRParser.cpp.
References llvm::MachineRegisterInfo::addLiveIn(), assert(), llvm::yaml::MachineFunction::CalleeSavedRegisters, llvm::VRegInfo::D, llvm::StringRef::equals(), llvm::Error, error(), llvm::VRegInfo::Explicit, llvm::VRegInfo::GENERIC, llvm::MachineFunction::getRegInfo(), llvm::PerFunctionMIParsingState::getVRegInfo(), Info, 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::SmallVectorTemplateBase< T, bool >::push_back(), llvm::VRegInfo::RC, Reg, llvm::VRegInfo::REGBANK, llvm::VRegInfo::RegBank, llvm::MachineRegisterInfo::setCalleeSavedRegs(), llvm::MachineRegisterInfo::tracksLiveness(), llvm::yaml::MachineFunction::TracksRegLiveness, llvm::yaml::MachineFunction::VirtualRegisters, and llvm::VRegInfo::VReg.
Referenced by initializeMachineFunction().
bool MIRParserImpl::parseStackObjectsDebugInfo | ( | PerFunctionMIParsingState & | PFS, |
const T & | Object, | ||
int | FrameIdx | ||
) |
Definition at line 709 of file MIRParser.cpp.
References llvm::PerFunctionMIParsingState::MF, llvm::MachineFunction::setVariableDbgInfo(), and typecheckMDNode().
Referenced by initializeFrameInfo().
void MIRParserImpl::reportDiagnostic | ( | const SMDiagnostic & | Diag | ) |
Definition at line 206 of file MIRParser.cpp.
References llvm::LLVMContext::diagnose(), llvm::SourceMgr::DK_Error, llvm::SourceMgr::DK_Note, llvm::SourceMgr::DK_Remark, llvm::SourceMgr::DK_Warning, llvm::DS_Error, llvm::DS_Note, llvm::DS_Warning, llvm::SMDiagnostic::getKind(), Kind, and llvm_unreachable.
Referenced by error(), handleYAMLDiag(), initializeMachineFunction(), and parseIRModule().
bool MIRParserImpl::setupRegisterInfo | ( | const PerFunctionMIParsingState & | PFS, |
const yaml::MachineFunction & | YamlMF | ||
) |
Definition at line 511 of file MIRParser.cpp.
References llvm::MachineRegisterInfo::addPhysRegsUsedFromRegMask(), llvm::VRegInfo::D, E, llvm::Error, error(), llvm::MachineRegisterInfo::freezeReservedRegs(), llvm::VRegInfo::GENERIC, llvm::MachineFunction::getName(), llvm::MachineFunction::getRegInfo(), I, Info, llvm::VRegInfo::Kind, llvm::PerFunctionMIParsingState::MF, MI, MRI, Name, llvm::VRegInfo::NORMAL, P, llvm::VRegInfo::PreferredReg, llvm::VRegInfo::RC, Reg, llvm::VRegInfo::REGBANK, llvm::VRegInfo::RegBank, llvm::MachineRegisterInfo::setRegBank(), llvm::MachineRegisterInfo::setRegClass(), llvm::MachineRegisterInfo::setSimpleHint(), llvm::VRegInfo::UNKNOWN, llvm::VRegInfo::VReg, llvm::PerFunctionMIParsingState::VRegInfos, and llvm::PerFunctionMIParsingState::VRegInfosNamed.
Referenced by initializeMachineFunction().