Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/CodeGen/MIRParser/MIRParser.cpp
Show First 20 Lines • Show All 155 Lines • ▼ Show 20 Lines | SMDiagnostic diagFromMIStringDiag(const SMDiagnostic &Error, | ||||
SMRange SourceRange); | SMRange SourceRange); | ||||
/// Return a MIR diagnostic converted from a diagnostic located in a YAML | /// Return a MIR diagnostic converted from a diagnostic located in a YAML | ||||
/// block scalar string. | /// block scalar string. | ||||
SMDiagnostic diagFromBlockStringDiag(const SMDiagnostic &Error, | SMDiagnostic diagFromBlockStringDiag(const SMDiagnostic &Error, | ||||
SMRange SourceRange); | SMRange SourceRange); | ||||
void computeFunctionProperties(MachineFunction &MF); | void computeFunctionProperties(MachineFunction &MF); | ||||
void setupDebugValueTracking(MachineFunction &MF, | |||||
PerFunctionMIParsingState &PFS, const yaml::MachineFunction &YamlMF); | |||||
}; | }; | ||||
} // end namespace llvm | } // end namespace llvm | ||||
static void handleYAMLDiag(const SMDiagnostic &Diag, void *Context) { | static void handleYAMLDiag(const SMDiagnostic &Diag, void *Context) { | ||||
reinterpret_cast<MIRParserImpl *>(Context)->reportDiagnostic(Diag); | reinterpret_cast<MIRParserImpl *>(Context)->reportDiagnostic(Diag); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 225 Lines • ▼ Show 20 Lines | if (TM.Options.EmitCallSiteInfo) | ||||
MF.addCallArgsForwardingRegs(&*CallI, std::move(CSInfo)); | MF.addCallArgsForwardingRegs(&*CallI, std::move(CSInfo)); | ||||
} | } | ||||
if (YamlMF.CallSitesInfo.size() && !TM.Options.EmitCallSiteInfo) | if (YamlMF.CallSitesInfo.size() && !TM.Options.EmitCallSiteInfo) | ||||
return error(Twine("Call site info provided but not used")); | return error(Twine("Call site info provided but not used")); | ||||
return false; | return false; | ||||
} | } | ||||
void MIRParserImpl::setupDebugValueTracking(MachineFunction &MF, | |||||
PerFunctionMIParsingState &PFS, const yaml::MachineFunction &YamlMF) { | |||||
// For now, we only compute the value of the "next instruction number" | |||||
// field. | |||||
unsigned MaxInstrNum = 0; | |||||
for (auto &MBB : MF) | |||||
for (auto &MI : MBB) | |||||
MaxInstrNum = std::max((unsigned)MI.peekDebugInstrNum(), MaxInstrNum); | |||||
MF.setDebugInstrNumberingCount(MaxInstrNum); | |||||
} | |||||
bool | bool | ||||
MIRParserImpl::initializeMachineFunction(const yaml::MachineFunction &YamlMF, | MIRParserImpl::initializeMachineFunction(const yaml::MachineFunction &YamlMF, | ||||
MachineFunction &MF) { | MachineFunction &MF) { | ||||
// TODO: Recreate the machine function. | // TODO: Recreate the machine function. | ||||
if (Target) { | if (Target) { | ||||
// Avoid clearing state if we're using the same subtarget again. | // Avoid clearing state if we're using the same subtarget again. | ||||
Target->setTarget(MF.getSubtarget()); | Target->setTarget(MF.getSubtarget()); | ||||
} else { | } else { | ||||
▲ Show 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | MIRParserImpl::initializeMachineFunction(const yaml::MachineFunction &YamlMF, | ||||
MachineRegisterInfo &MRI = MF.getRegInfo(); | MachineRegisterInfo &MRI = MF.getRegInfo(); | ||||
MRI.freezeReservedRegs(MF); | MRI.freezeReservedRegs(MF); | ||||
computeFunctionProperties(MF); | computeFunctionProperties(MF); | ||||
if (initializeCallSiteInfo(PFS, YamlMF)) | if (initializeCallSiteInfo(PFS, YamlMF)) | ||||
return false; | return false; | ||||
setupDebugValueTracking(MF, PFS, YamlMF); | |||||
MF.getSubtarget().mirFileLoaded(MF); | MF.getSubtarget().mirFileLoaded(MF); | ||||
MF.verify(); | MF.verify(); | ||||
return false; | return false; | ||||
} | } | ||||
bool MIRParserImpl::parseRegisterInfo(PerFunctionMIParsingState &PFS, | bool MIRParserImpl::parseRegisterInfo(PerFunctionMIParsingState &PFS, | ||||
const yaml::MachineFunction &YamlMF) { | const yaml::MachineFunction &YamlMF) { | ||||
▲ Show 20 Lines • Show All 469 Lines • Show Last 20 Lines |