@@ -158,9 +158,6 @@ class MIRParserImpl {
158158 MachineFunction &MF,
159159 const yaml::MachineFunction &YMF);
160160
161- bool parseCalledGlobals (PerFunctionMIParsingState &PFS, MachineFunction &MF,
162- const yaml::MachineFunction &YMF);
163-
164161private:
165162 bool parseMDNode (PerFunctionMIParsingState &PFS, MDNode *&Node,
166163 const yaml::StringValue &Source);
@@ -186,9 +183,6 @@ class MIRParserImpl {
186183
187184 void setupDebugValueTracking (MachineFunction &MF,
188185 PerFunctionMIParsingState &PFS, const yaml::MachineFunction &YamlMF);
189-
190- bool parseMachineInst (MachineFunction &MF, yaml::MachineInstrLoc MILoc,
191- MachineInstr const *&MI);
192186};
193187
194188} // end namespace llvm
@@ -463,34 +457,24 @@ bool MIRParserImpl::computeFunctionProperties(
463457 return false ;
464458}
465459
466- bool MIRParserImpl::parseMachineInst (MachineFunction &MF,
467- yaml::MachineInstrLoc MILoc,
468- MachineInstr const *&MI) {
469- if (MILoc.BlockNum >= MF.size ()) {
470- return error (Twine (MF.getName ()) +
471- Twine (" instruction block out of range." ) +
472- " Unable to reference bb:" + Twine (MILoc.BlockNum ));
473- }
474- auto BB = std::next (MF.begin (), MILoc.BlockNum );
475- if (MILoc.Offset >= BB->size ())
476- return error (
477- Twine (MF.getName ()) + Twine (" instruction offset out of range." ) +
478- " Unable to reference instruction at bb: " + Twine (MILoc.BlockNum ) +
479- " at offset:" + Twine (MILoc.Offset ));
480- MI = &*std::next (BB->instr_begin (), MILoc.Offset );
481- return false ;
482- }
483-
484460bool MIRParserImpl::initializeCallSiteInfo (
485461 PerFunctionMIParsingState &PFS, const yaml::MachineFunction &YamlMF) {
486462 MachineFunction &MF = PFS.MF ;
487463 SMDiagnostic Error;
488464 const TargetMachine &TM = MF.getTarget ();
489465 for (auto &YamlCSInfo : YamlMF.CallSitesInfo ) {
490- yaml::MachineInstrLoc MILoc = YamlCSInfo.CallLocation ;
491- const MachineInstr *CallI;
492- if (parseMachineInst (MF, MILoc, CallI))
493- return true ;
466+ yaml::CallSiteInfo::MachineInstrLoc MILoc = YamlCSInfo.CallLocation ;
467+ if (MILoc.BlockNum >= MF.size ())
468+ return error (Twine (MF.getName ()) +
469+ Twine (" call instruction block out of range." ) +
470+ " Unable to reference bb:" + Twine (MILoc.BlockNum ));
471+ auto CallB = std::next (MF.begin (), MILoc.BlockNum );
472+ if (MILoc.Offset >= CallB->size ())
473+ return error (Twine (MF.getName ()) +
474+ Twine (" call instruction offset out of range." ) +
475+ " Unable to reference instruction at bb: " +
476+ Twine (MILoc.BlockNum ) + " at offset:" + Twine (MILoc.Offset ));
477+ auto CallI = std::next (CallB->instr_begin (), MILoc.Offset );
494478 if (!CallI->isCall (MachineInstr::IgnoreBundle))
495479 return error (Twine (MF.getName ()) +
496480 Twine (" call site info should reference call "
@@ -657,9 +641,6 @@ MIRParserImpl::initializeMachineFunction(const yaml::MachineFunction &YamlMF,
657641 if (initializeCallSiteInfo (PFS, YamlMF))
658642 return true ;
659643
660- if (parseCalledGlobals (PFS, MF, YamlMF))
661- return true ;
662-
663644 setupDebugValueTracking (MF, PFS, YamlMF);
664645
665646 MF.getSubtarget ().mirFileLoaded (MF);
@@ -1130,37 +1111,6 @@ bool MIRParserImpl::parseMachineMetadataNodes(
11301111 return false ;
11311112}
11321113
1133- bool MIRParserImpl::parseCalledGlobals (PerFunctionMIParsingState &PFS,
1134- MachineFunction &MF,
1135- const yaml::MachineFunction &YMF) {
1136- Function &F = MF.getFunction ();
1137- for (const auto &YamlCG : YMF.CalledGlobals ) {
1138- yaml::MachineInstrLoc MILoc = YamlCG.CallSite ;
1139- const MachineInstr *CallI;
1140- if (parseMachineInst (MF, MILoc, CallI))
1141- return true ;
1142- if (!CallI->isCall (MachineInstr::IgnoreBundle))
1143- return error (Twine (MF.getName ()) +
1144- Twine (" called global should reference call "
1145- " instruction. Instruction at bb:" ) +
1146- Twine (MILoc.BlockNum ) + " at offset:" + Twine (MILoc.Offset ) +
1147- " is not a call instruction" );
1148-
1149- auto Callee =
1150- F.getParent ()->getValueSymbolTable ().lookup (YamlCG.Callee .Value );
1151- if (!Callee)
1152- return error (YamlCG.Callee .SourceRange .Start ,
1153- " use of undefined global '" + YamlCG.Callee .Value + " '" );
1154- if (!isa<GlobalValue>(Callee))
1155- return error (YamlCG.Callee .SourceRange .Start ,
1156- " use of non-global value '" + YamlCG.Callee .Value + " '" );
1157-
1158- MF.addCalledGlobal (CallI, {cast<GlobalValue>(Callee), YamlCG.Flags });
1159- }
1160-
1161- return false ;
1162- }
1163-
11641114SMDiagnostic MIRParserImpl::diagFromMIStringDiag (const SMDiagnostic &Error,
11651115 SMRange SourceRange) {
11661116 assert (SourceRange.isValid () && " Invalid source range" );
0 commit comments