LLVM  6.0.0svn
Public Member Functions | List of all members
llvm::MIRParserImpl Class Reference

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< ModuleparseIRModule ()
 Try to parse the optional LLVM module and the machine functions in the MIR file. More...
 
bool parseMachineFunctions (Module &M, MachineModuleInfo &MMI)
 
bool parseMachineFunction (Module &M, MachineModuleInfo &MMI)
 Parse the machine function in the current YAML document. More...
 
bool initializeMachineFunction (const yaml::MachineFunction &YamlMF, 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, bool IsRestored, 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)
 

Detailed Description

This class implements the parsing of LLVM IR that's embedded inside a MIR file.

Definition at line 51 of file MIRParser.cpp.

Constructor & Destructor Documentation

◆ MIRParserImpl()

MIRParserImpl::MIRParserImpl ( std::unique_ptr< MemoryBuffer Contents,
StringRef  Filename,
LLVMContext Context 
)

Definition at line 176 of file MIRParser.cpp.

References llvm::yaml::IO::setContext().

Member Function Documentation

◆ error() [1/3]

bool MIRParserImpl::error ( const Twine Message)

◆ error() [2/3]

bool MIRParserImpl::error ( SMLoc  Loc,
const Twine Message 
)

Report an error with the given message at the given location.

Always returns true.

Definition at line 193 of file MIRParser.cpp.

References llvm::LLVMContext::diagnose(), llvm::SourceMgr::DK_Error, llvm::DS_Error, and llvm::SourceMgr::GetMessage().

◆ error() [3/3]

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 199 of file MIRParser.cpp.

References assert(), llvm::SourceMgr::DK_Error, llvm::SMDiagnostic::getKind(), and reportDiagnostic().

◆ initializeConstantPool()

bool MIRParserImpl::initializeConstantPool ( PerFunctionMIParsingState PFS,
MachineConstantPool ConstantPool,
const yaml::MachineFunction YamlMF 
)

◆ initializeFrameInfo()

bool MIRParserImpl::initializeFrameInfo ( PerFunctionMIParsingState PFS,
const yaml::MachineFunction YamlMF 
)

Definition at line 549 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(), 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::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::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().

◆ initializeJumpTableInfo()

bool MIRParserImpl::initializeJumpTableInfo ( PerFunctionMIParsingState PFS,
const yaml::MachineJumpTable YamlJTI 
)

Definition at line 749 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::lltok::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, 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, llvm::None, llvm::StringRef::npos, llvm::parseMBBReference(), llvm::MachineBasicBlock::push_back(), llvm::yaml::StringValue::SourceRange, llvm::SMRange::Start, and llvm::yaml::StringValue::Value.

Referenced by initializeMachineFunction().

◆ initializeMachineFunction()

bool MIRParserImpl::initializeMachineFunction ( const yaml::MachineFunction YamlMF,
MachineFunction MF 
)

◆ parseCalleeSavedRegister()

bool MIRParserImpl::parseCalleeSavedRegister ( PerFunctionMIParsingState PFS,
std::vector< CalleeSavedInfo > &  CSIInfo,
const yaml::StringValue RegisterSource,
bool  IsRestored,
int  FrameIdx 
)

◆ parseIRModule()

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 224 of file MIRParser.cpp.

References llvm::lltok::Error, llvm::yaml::Input::error(), llvm::yaml::Input::getCurrentNode(), llvm::yaml::Input::nextDocument(), llvm::parseAssembly(), reportDiagnostic(), and llvm::yaml::Input::setCurrentDocument().

◆ parseMachineFunction()

bool MIRParserImpl::parseMachineFunction ( Module M,
MachineModuleInfo MMI 
)

◆ parseMachineFunctions()

bool MIRParserImpl::parseMachineFunctions ( Module M,
MachineModuleInfo MMI 
)

◆ parseRegisterInfo()

bool MIRParserImpl::parseRegisterInfo ( PerFunctionMIParsingState PFS,
const yaml::MachineFunction YamlMF 
)

◆ parseStackObjectsDebugInfo()

bool MIRParserImpl::parseStackObjectsDebugInfo ( PerFunctionMIParsingState PFS,
const yaml::MachineStackObject Object,
int  FrameIdx 
)

◆ reportDiagnostic()

void MIRParserImpl::reportDiagnostic ( const SMDiagnostic Diag)

◆ setupRegisterInfo()

bool MIRParserImpl::setupRegisterInfo ( const PerFunctionMIParsingState PFS,
const yaml::MachineFunction YamlMF 
)

The documentation for this class was generated from the following file: