@@ -158,9 +158,6 @@ class MIRParserImpl {
158
158
MachineFunction &MF,
159
159
const yaml::MachineFunction &YMF);
160
160
161
- bool parseCalledGlobals (PerFunctionMIParsingState &PFS, MachineFunction &MF,
162
- const yaml::MachineFunction &YMF);
163
-
164
161
private:
165
162
bool parseMDNode (PerFunctionMIParsingState &PFS, MDNode *&Node,
166
163
const yaml::StringValue &Source);
@@ -186,9 +183,6 @@ class MIRParserImpl {
186
183
187
184
void setupDebugValueTracking (MachineFunction &MF,
188
185
PerFunctionMIParsingState &PFS, const yaml::MachineFunction &YamlMF);
189
-
190
- bool parseMachineInst (MachineFunction &MF, yaml::MachineInstrLoc MILoc,
191
- MachineInstr const *&MI);
192
186
};
193
187
194
188
} // end namespace llvm
@@ -463,34 +457,24 @@ bool MIRParserImpl::computeFunctionProperties(
463
457
return false ;
464
458
}
465
459
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
-
484
460
bool MIRParserImpl::initializeCallSiteInfo (
485
461
PerFunctionMIParsingState &PFS, const yaml::MachineFunction &YamlMF) {
486
462
MachineFunction &MF = PFS.MF ;
487
463
SMDiagnostic Error;
488
464
const TargetMachine &TM = MF.getTarget ();
489
465
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 );
494
478
if (!CallI->isCall (MachineInstr::IgnoreBundle))
495
479
return error (Twine (MF.getName ()) +
496
480
Twine (" call site info should reference call "
@@ -657,9 +641,6 @@ MIRParserImpl::initializeMachineFunction(const yaml::MachineFunction &YamlMF,
657
641
if (initializeCallSiteInfo (PFS, YamlMF))
658
642
return true ;
659
643
660
- if (parseCalledGlobals (PFS, MF, YamlMF))
661
- return true ;
662
-
663
644
setupDebugValueTracking (MF, PFS, YamlMF);
664
645
665
646
MF.getSubtarget ().mirFileLoaded (MF);
@@ -1130,37 +1111,6 @@ bool MIRParserImpl::parseMachineMetadataNodes(
1130
1111
return false ;
1131
1112
}
1132
1113
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
-
1164
1114
SMDiagnostic MIRParserImpl::diagFromMIStringDiag (const SMDiagnostic &Error,
1165
1115
SMRange SourceRange) {
1166
1116
assert (SourceRange.isValid () && " Invalid source range" );
0 commit comments