@@ -92,9 +92,15 @@ namespace {
92
92
struct MachineVerifier {
93
93
MachineVerifier (Pass *pass, const char *b) : PASS(pass), Banner(b) {}
94
94
95
+ MachineVerifier (const char *b, LiveVariables *LiveVars,
96
+ LiveIntervals *LiveInts, LiveStacks *LiveStks,
97
+ SlotIndexes *Indexes)
98
+ : Banner(b), LiveVars(LiveVars), LiveInts(LiveInts), LiveStks(LiveStks),
99
+ Indexes (Indexes) {}
100
+
95
101
unsigned verify (const MachineFunction &MF);
96
102
97
- Pass *const PASS;
103
+ Pass *const PASS = nullptr ;
98
104
const char *Banner;
99
105
const MachineFunction *MF = nullptr ;
100
106
const TargetMachine *TM = nullptr ;
@@ -355,6 +361,16 @@ bool MachineFunction::verify(Pass *p, const char *Banner, bool AbortOnErrors)
355
361
return FoundErrors == 0 ;
356
362
}
357
363
364
+ bool MachineFunction::verify (LiveIntervals *LiveInts, SlotIndexes *Indexes,
365
+ const char *Banner, bool AbortOnErrors) const {
366
+ MachineFunction &MF = const_cast <MachineFunction &>(*this );
367
+ unsigned FoundErrors =
368
+ MachineVerifier (Banner, nullptr , LiveInts, nullptr , Indexes).verify (MF);
369
+ if (AbortOnErrors && FoundErrors)
370
+ report_fatal_error (" Found " + Twine (FoundErrors) + " machine code errors." );
371
+ return FoundErrors == 0 ;
372
+ }
373
+
358
374
void MachineVerifier::verifySlotIndexes () const {
359
375
if (Indexes == nullptr )
360
376
return ;
@@ -404,10 +420,6 @@ unsigned MachineVerifier::verify(const MachineFunction &MF) {
404
420
isFunctionTracksDebugUserValues = MF.getProperties ().hasProperty (
405
421
MachineFunctionProperties::Property::TracksDebugUserValues);
406
422
407
- LiveVars = nullptr ;
408
- LiveInts = nullptr ;
409
- LiveStks = nullptr ;
410
- Indexes = nullptr ;
411
423
if (PASS) {
412
424
LiveInts = PASS->getAnalysisIfAvailable <LiveIntervals>();
413
425
// We don't want to verify LiveVariables if LiveIntervals is available.
0 commit comments