class MIRParserImpl

Declaration

class MIRParserImpl { /* full declaration omitted */ };

Description

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

Declared at: llvm/lib/CodeGen/MIRParser/MIRParser.cpp:51

Member Variables

private llvm::SourceMgr SM
private llvm::LLVMContext& Context
private yaml::Input In
private llvm::StringRef Filename
private llvm::SlotMapping IRSlots
private std::unique_ptr<PerTargetMIParsingState> Target
private bool NoLLVMIR = false
True when the MIR file doesn't have LLVM IR. Dummy IR functions are created and inserted into the given module when this is true.
private bool NoMIRDocuments = false
True when a well formed MIR file does not contain any MIR/machine function parts.
private std::function<void(Function&)> ProcessIRFunction

Method Overview

  • public MIRParserImpl(std::unique_ptr<MemoryBuffer> Contents, llvm::StringRef Filename, llvm::LLVMContext & Context, std::function<void (Function &)> ProcessIRFunction)
  • private void computeFunctionProperties(llvm::MachineFunction & MF)
  • public llvm::Function * createDummyFunction(llvm::StringRef Name, llvm::Module & M)
  • private llvm::SMDiagnostic diagFromBlockStringDiag(const llvm::SMDiagnostic & Error, llvm::SMRange SourceRange)
  • private llvm::SMDiagnostic diagFromMIStringDiag(const llvm::SMDiagnostic & Error, llvm::SMRange SourceRange)
  • public bool error(llvm::SMLoc Loc, const llvm::Twine & Message)
  • public bool error(const llvm::Twine & Message)
  • public bool error(const llvm::SMDiagnostic & Error, llvm::SMRange SourceRange)
  • public bool initializeCallSiteInfo(llvm::PerFunctionMIParsingState & PFS, const yaml::MachineFunction & YamlMF)
  • public bool initializeConstantPool(llvm::PerFunctionMIParsingState & PFS, llvm::MachineConstantPool & ConstantPool, const yaml::MachineFunction & YamlMF)
  • public bool initializeFrameInfo(llvm::PerFunctionMIParsingState & PFS, const yaml::MachineFunction & YamlMF)
  • public bool initializeJumpTableInfo(llvm::PerFunctionMIParsingState & PFS, const yaml::MachineJumpTable & YamlJTI)
  • public bool initializeMachineFunction(const yaml::MachineFunction & YamlMF, llvm::MachineFunction & MF)
  • public bool parseCalleeSavedRegister(llvm::PerFunctionMIParsingState & PFS, std::vector<CalleeSavedInfo> & CSIInfo, const yaml::StringValue & RegisterSource, bool IsRestored, int FrameIdx)
  • public std::unique_ptr<Module> parseIRModule(llvm::DataLayoutCallbackTy DataLayoutCallback)
  • private bool parseMBBReference(llvm::PerFunctionMIParsingState & PFS, llvm::MachineBasicBlock *& MBB, const yaml::StringValue & Source)
  • private bool parseMDNode(llvm::PerFunctionMIParsingState & PFS, llvm::MDNode *& Node, const yaml::StringValue & Source)
  • public bool parseMachineFunction(llvm::Module & M, llvm::MachineModuleInfo & MMI)
  • public bool parseMachineFunctions(llvm::Module & M, llvm::MachineModuleInfo & MMI)
  • private bool parseMachineMetadata(llvm::PerFunctionMIParsingState & PFS, const yaml::StringValue & Source)
  • public bool parseMachineMetadataNodes(llvm::PerFunctionMIParsingState & PFS, llvm::MachineFunction & MF, const yaml::MachineFunction & YMF)
  • public bool parseRegisterInfo(llvm::PerFunctionMIParsingState & PFS, const yaml::MachineFunction & YamlMF)
  • public template <typename T>bool parseStackObjectsDebugInfo(llvm::PerFunctionMIParsingState & PFS, const T & Object, int FrameIdx)
  • public void reportDiagnostic(const llvm::SMDiagnostic & Diag)
  • private void setupDebugValueTracking(llvm::MachineFunction & MF, llvm::PerFunctionMIParsingState & PFS, const yaml::MachineFunction & YamlMF)
  • public bool setupRegisterInfo(const llvm::PerFunctionMIParsingState & PFS, const yaml::MachineFunction & YamlMF)

Methods

MIRParserImpl(
    std::unique_ptr<MemoryBuffer> Contents,
    llvm::StringRef Filename,
    llvm::LLVMContext& Context,
    std::function<void(Function&)>
        ProcessIRFunction)

Declared at: llvm/lib/CodeGen/MIRParser/MIRParser.cpp:69

Parameters

std::unique_ptr<MemoryBuffer> Contents
llvm::StringRef Filename
llvm::LLVMContext& Context
std::function<void(Function&)> ProcessIRFunction

void computeFunctionProperties(
    llvm::MachineFunction& MF)

Declared at: llvm/lib/CodeGen/MIRParser/MIRParser.cpp:169

Parameters

llvm::MachineFunction& MF

llvm::Function* createDummyFunction(
    llvm::StringRef Name,
    llvm::Module& M)

Description

Create an empty function with the given name.

Declared at: llvm/lib/CodeGen/MIRParser/MIRParser.cpp:99

Parameters

llvm::StringRef Name
llvm::Module& M

llvm::SMDiagnostic diagFromBlockStringDiag(
    const llvm::SMDiagnostic& Error,
    llvm::SMRange SourceRange)

Description

Return a MIR diagnostic converted from a diagnostic located in a YAML block scalar string.

Declared at: llvm/lib/CodeGen/MIRParser/MIRParser.cpp:166

Parameters

const llvm::SMDiagnostic& Error
llvm::SMRange SourceRange

llvm::SMDiagnostic diagFromMIStringDiag(
    const llvm::SMDiagnostic& Error,
    llvm::SMRange SourceRange)

Description

Return a MIR diagnostic converted from an MI string diagnostic.

Declared at: llvm/lib/CodeGen/MIRParser/MIRParser.cpp:161

Parameters

const llvm::SMDiagnostic& Error
llvm::SMRange SourceRange

bool error(llvm::SMLoc Loc,
           const llvm::Twine& Message)

Description

Report an error with the given message at the given location. Always returns true.

Declared at: llvm/lib/CodeGen/MIRParser/MIRParser.cpp:83

Parameters

llvm::SMLoc Loc
const llvm::Twine& Message

bool error(const llvm::Twine& Message)

Description

Report an error with the given message at unknown location. Always returns true.

Declared at: llvm/lib/CodeGen/MIRParser/MIRParser.cpp:78

Parameters

const llvm::Twine& Message

bool error(const llvm::SMDiagnostic& Error,
           llvm::SMRange SourceRange)

Description

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.

Declared at: llvm/lib/CodeGen/MIRParser/MIRParser.cpp:89

Parameters

const llvm::SMDiagnostic& Error
llvm::SMRange SourceRange

bool initializeCallSiteInfo(
    llvm::PerFunctionMIParsingState& PFS,
    const yaml::MachineFunction& YamlMF)

Declared at: llvm/lib/CodeGen/MIRParser/MIRParser.cpp:125

Parameters

llvm::PerFunctionMIParsingState& PFS
const yaml::MachineFunction& YamlMF

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

Declared at: llvm/lib/CodeGen/MIRParser/MIRParser.cpp:138

Parameters

llvm::PerFunctionMIParsingState& PFS
llvm::MachineConstantPool& ConstantPool
const yaml::MachineFunction& YamlMF

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

Declared at: llvm/lib/CodeGen/MIRParser/MIRParser.cpp:122

Parameters

llvm::PerFunctionMIParsingState& PFS
const yaml::MachineFunction& YamlMF

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

Declared at: llvm/lib/CodeGen/MIRParser/MIRParser.cpp:142

Parameters

llvm::PerFunctionMIParsingState& PFS
const yaml::MachineJumpTable& YamlJTI

bool initializeMachineFunction(
    const yaml::MachineFunction& YamlMF,
    llvm::MachineFunction& MF)

Description

Initialize the machine function to the state that's described in the MIR file. Return true if error occurred.

Declared at: llvm/lib/CodeGen/MIRParser/MIRParser.cpp:113

Parameters

const yaml::MachineFunction& YamlMF
llvm::MachineFunction& MF

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

Declared at: llvm/lib/CodeGen/MIRParser/MIRParser.cpp:128

Parameters

llvm::PerFunctionMIParsingState& PFS
std::vector<CalleeSavedInfo>& CSIInfo
const yaml::StringValue& RegisterSource
bool IsRestored
int FrameIdx

std::unique_ptr<Module> parseIRModule(
    llvm::DataLayoutCallbackTy DataLayoutCallback)

Description

Try to parse the optional LLVM module and the machine functions in the MIR file. Return null if an error occurred.

Declared at: llvm/lib/CodeGen/MIRParser/MIRParser.cpp:96

Parameters

llvm::DataLayoutCallbackTy DataLayoutCallback

bool parseMBBReference(
    llvm::PerFunctionMIParsingState& PFS,
    llvm::MachineBasicBlock*& MBB,
    const yaml::StringValue& Source)

Declared at: llvm/lib/CodeGen/MIRParser/MIRParser.cpp:153

Parameters

llvm::PerFunctionMIParsingState& PFS
llvm::MachineBasicBlock*& MBB
const yaml::StringValue& Source

bool parseMDNode(
    llvm::PerFunctionMIParsingState& PFS,
    llvm::MDNode*& Node,
    const yaml::StringValue& Source)

Declared at: llvm/lib/CodeGen/MIRParser/MIRParser.cpp:150

Parameters

llvm::PerFunctionMIParsingState& PFS
llvm::MDNode*& Node
const yaml::StringValue& Source

bool parseMachineFunction(
    llvm::Module& M,
    llvm::MachineModuleInfo& MMI)

Description

Parse the machine function in the current YAML document. Return true if an error occurred.

Declared at: llvm/lib/CodeGen/MIRParser/MIRParser.cpp:107

Parameters

llvm::Module& M
llvm::MachineModuleInfo& MMI

bool parseMachineFunctions(
    llvm::Module& M,
    llvm::MachineModuleInfo& MMI)

Declared at: llvm/lib/CodeGen/MIRParser/MIRParser.cpp:101

Parameters

llvm::Module& M
llvm::MachineModuleInfo& MMI

bool parseMachineMetadata(
    llvm::PerFunctionMIParsingState& PFS,
    const yaml::StringValue& Source)

Declared at: llvm/lib/CodeGen/MIRParser/MIRParser.cpp:157

Parameters

llvm::PerFunctionMIParsingState& PFS
const yaml::StringValue& Source

bool parseMachineMetadataNodes(
    llvm::PerFunctionMIParsingState& PFS,
    llvm::MachineFunction& MF,
    const yaml::MachineFunction& YMF)

Declared at: llvm/lib/CodeGen/MIRParser/MIRParser.cpp:145

Parameters

llvm::PerFunctionMIParsingState& PFS
llvm::MachineFunction& MF
const yaml::MachineFunction& YMF

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

Declared at: llvm/lib/CodeGen/MIRParser/MIRParser.cpp:116

Parameters

llvm::PerFunctionMIParsingState& PFS
const yaml::MachineFunction& YamlMF

template <typename T>
bool parseStackObjectsDebugInfo(
    llvm::PerFunctionMIParsingState& PFS,
    const T& Object,
    int FrameIdx)

Declared at: llvm/lib/CodeGen/MIRParser/MIRParser.cpp:134

Templates

T

Parameters

llvm::PerFunctionMIParsingState& PFS
const T& Object
int FrameIdx

void reportDiagnostic(
    const llvm::SMDiagnostic& Diag)

Declared at: llvm/lib/CodeGen/MIRParser/MIRParser.cpp:73

Parameters

const llvm::SMDiagnostic& Diag

void setupDebugValueTracking(
    llvm::MachineFunction& MF,
    llvm::PerFunctionMIParsingState& PFS,
    const yaml::MachineFunction& YamlMF)

Declared at: llvm/lib/CodeGen/MIRParser/MIRParser.cpp:171

Parameters

llvm::MachineFunction& MF
llvm::PerFunctionMIParsingState& PFS
const yaml::MachineFunction& YamlMF

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

Declared at: llvm/lib/CodeGen/MIRParser/MIRParser.cpp:119

Parameters

const llvm::PerFunctionMIParsingState& PFS
const yaml::MachineFunction& YamlMF