#include "llvm/CodeGen/MIRParser/MIRParser.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/AsmParser/Parser.h"
#include "llvm/AsmParser/SlotMapping.h"
#include "llvm/CodeGen/MIRParser/MIParser.h"
#include "llvm/CodeGen/MIRYamlMapping.h"
#include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionAnalysis.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/TargetFrameLowering.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/ValueSymbolTable.h"
#include "llvm/Support/LineIterator.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/SMLoc.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/YAMLTraits.h"
#include "llvm/Target/TargetMachine.h"
#include <memory>
usingnamespacellvm;
namespace llvm {
class MDNode;
class RegisterBank;
class MIRParserImpl { … };
}
static void handleYAMLDiag(const SMDiagnostic &Diag, void *Context) { … }
MIRParserImpl::MIRParserImpl(std::unique_ptr<MemoryBuffer> Contents,
StringRef Filename, LLVMContext &Context,
std::function<void(Function &)> Callback)
: … { … }
bool MIRParserImpl::error(const Twine &Message) { … }
bool MIRParserImpl::error(SMLoc Loc, const Twine &Message) { … }
bool MIRParserImpl::error(const SMDiagnostic &Error, SMRange SourceRange) { … }
void MIRParserImpl::reportDiagnostic(const SMDiagnostic &Diag) { … }
std::unique_ptr<Module>
MIRParserImpl::parseIRModule(DataLayoutCallbackTy DataLayoutCallback) { … }
bool MIRParserImpl::parseMachineFunctions(Module &M, MachineModuleInfo &MMI,
ModuleAnalysisManager *MAM) { … }
Function *MIRParserImpl::createDummyFunction(StringRef Name, Module &M) { … }
bool MIRParserImpl::parseMachineFunction(Module &M, MachineModuleInfo &MMI,
ModuleAnalysisManager *MAM) { … }
static bool isSSA(const MachineFunction &MF) { … }
bool MIRParserImpl::computeFunctionProperties(
MachineFunction &MF, const yaml::MachineFunction &YamlMF) { … }
bool MIRParserImpl::initializeCallSiteInfo(
PerFunctionMIParsingState &PFS, const yaml::MachineFunction &YamlMF) { … }
void MIRParserImpl::setupDebugValueTracking(
MachineFunction &MF, PerFunctionMIParsingState &PFS,
const yaml::MachineFunction &YamlMF) { … }
bool
MIRParserImpl::initializeMachineFunction(const yaml::MachineFunction &YamlMF,
MachineFunction &MF) { … }
bool MIRParserImpl::parseRegisterInfo(PerFunctionMIParsingState &PFS,
const yaml::MachineFunction &YamlMF) { … }
bool MIRParserImpl::setupRegisterInfo(const PerFunctionMIParsingState &PFS,
const yaml::MachineFunction &YamlMF) { … }
bool MIRParserImpl::initializeFrameInfo(PerFunctionMIParsingState &PFS,
const yaml::MachineFunction &YamlMF) { … }
bool MIRParserImpl::parseCalleeSavedRegister(PerFunctionMIParsingState &PFS,
std::vector<CalleeSavedInfo> &CSIInfo,
const yaml::StringValue &RegisterSource, bool IsRestored, int FrameIdx) { … }
template <typename T>
static bool typecheckMDNode(T *&Result, MDNode *Node,
const yaml::StringValue &Source,
StringRef TypeString, MIRParserImpl &Parser) { … }
std::optional<MIRParserImpl::VarExprLoc> MIRParserImpl::parseVarExprLoc(
PerFunctionMIParsingState &PFS, const yaml::StringValue &VarStr,
const yaml::StringValue &ExprStr, const yaml::StringValue &LocStr) { … }
template <typename T>
bool MIRParserImpl::parseStackObjectsDebugInfo(PerFunctionMIParsingState &PFS,
const T &Object, int FrameIdx) { … }
bool MIRParserImpl::parseMDNode(PerFunctionMIParsingState &PFS,
MDNode *&Node, const yaml::StringValue &Source) { … }
bool MIRParserImpl::initializeConstantPool(PerFunctionMIParsingState &PFS,
MachineConstantPool &ConstantPool, const yaml::MachineFunction &YamlMF) { … }
bool MIRParserImpl::initializeJumpTableInfo(PerFunctionMIParsingState &PFS,
const yaml::MachineJumpTable &YamlJTI) { … }
bool MIRParserImpl::parseMBBReference(PerFunctionMIParsingState &PFS,
MachineBasicBlock *&MBB,
const yaml::StringValue &Source) { … }
bool MIRParserImpl::parseMachineMetadata(PerFunctionMIParsingState &PFS,
const yaml::StringValue &Source) { … }
bool MIRParserImpl::parseMachineMetadataNodes(
PerFunctionMIParsingState &PFS, MachineFunction &MF,
const yaml::MachineFunction &YMF) { … }
SMDiagnostic MIRParserImpl::diagFromMIStringDiag(const SMDiagnostic &Error,
SMRange SourceRange) { … }
SMDiagnostic MIRParserImpl::diagFromBlockStringDiag(const SMDiagnostic &Error,
SMRange SourceRange) { … }
MIRParser::MIRParser(std::unique_ptr<MIRParserImpl> Impl)
: … { … }
MIRParser::~MIRParser() = default;
std::unique_ptr<Module>
MIRParser::parseIRModule(DataLayoutCallbackTy DataLayoutCallback) { … }
bool MIRParser::parseMachineFunctions(Module &M, MachineModuleInfo &MMI) { … }
bool MIRParser::parseMachineFunctions(Module &M, ModuleAnalysisManager &MAM) { … }
std::unique_ptr<MIRParser> llvm::createMIRParserFromFile(
StringRef Filename, SMDiagnostic &Error, LLVMContext &Context,
std::function<void(Function &)> ProcessIRFunction) { … }
std::unique_ptr<MIRParser>
llvm::createMIRParser(std::unique_ptr<MemoryBuffer> Contents,
LLVMContext &Context,
std::function<void(Function &)> ProcessIRFunction) { … }