1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

TargetMachine: Indicate whether machine verifier passes.

This adds a callback to the LLVMTargetMachine that lets target indicate
that they do not pass the machine verifier checks in all cases yet.

This is intended to be a temporary measure while the targets are fixed
allowing us to enable the machine verifier by default with
EXPENSIVE_CHECKS enabled!

Differential Revision: https://reviews.llvm.org/D33696

llvm-svn: 304320
This commit is contained in:
Matthias Braun 2017-05-31 18:41:23 +00:00
parent 24ca2b4bfb
commit 6d04c8c1dc
13 changed files with 51 additions and 4 deletions

View File

@ -299,6 +299,12 @@ public:
bool addPassesToEmitMC(PassManagerBase &PM, MCContext *&Ctx,
raw_pwrite_stream &OS,
bool DisableVerify = true) override;
/// Returns true if the target is expected to pass all machine verifier
/// checks. This is a stopgap measure to fix targets one by one. We will
/// remove this at some point and always enable the verifier when
/// EXPENSIVE_CHECKS is enabled.
virtual bool isMachineVerifierClean() const { return true; }
};
} // end namespace llvm

View File

@ -430,7 +430,12 @@ void TargetPassConfig::addPrintPass(const std::string &Banner) {
}
void TargetPassConfig::addVerifyPass(const std::string &Banner) {
if (VerifyMachineCode)
bool Verify = VerifyMachineCode;
#ifdef EXPENSIVE_CHECKS
if (VerifyMachineCode == cl::BOU_UNSET)
Verify = TM->isMachineVerifierClean();
#endif
if (Verify)
PM->add(createMachineVerifierPass(Banner));
}

View File

@ -69,7 +69,6 @@ public:
return -1;
return 0;
}
};
//===----------------------------------------------------------------------===//
@ -89,6 +88,10 @@ public:
TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
const R600Subtarget *getSubtargetImpl(const Function &) const override;
bool isMachineVerifierClean() const override {
return false;
}
};
//===----------------------------------------------------------------------===//

View File

@ -60,6 +60,10 @@ public:
TargetLoweringObjectFile *getObjFileLowering() const override {
return TLOF.get();
}
bool isMachineVerifierClean() const override {
return false;
}
};
/// ARM/Thumb little endian target machine.

View File

@ -41,6 +41,10 @@ public:
TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
bool isMachineVerifierClean() const override {
return false;
}
private:
std::unique_ptr<TargetLoweringObjectFile> TLOF;
AVRSubtarget SubTarget;

View File

@ -49,6 +49,10 @@ public:
TargetLoweringObjectFile *getObjFileLowering() const override {
return TLOF.get();
}
bool isMachineVerifierClean() const override {
return false;
}
};
} // namespace llvm

View File

@ -66,6 +66,10 @@ public:
bool isLittleEndian() const { return isLittle; }
const MipsABIInfo &getABI() const { return ABI; }
bool isMachineVerifierClean() const override {
return false;
}
};
/// Mips32/64 big endian target machine.

View File

@ -65,6 +65,9 @@ public:
TargetIRAnalysis getTargetIRAnalysis() override;
bool isMachineVerifierClean() const override {
return false;
}
}; // NVPTXTargetMachine.
class NVPTXTargetMachine32 : public NVPTXTargetMachine {

View File

@ -55,6 +55,10 @@ public:
const Triple &TT = getTargetTriple();
return (TT.getArch() == Triple::ppc64 || TT.getArch() == Triple::ppc64le);
};
bool isMachineVerifierClean() const override {
return false;
}
};
/// PowerPC 32-bit target machine.

View File

@ -40,6 +40,10 @@ public:
TargetLoweringObjectFile *getObjFileLowering() const override {
return TLOF.get();
}
bool isMachineVerifierClean() const override {
return false;
}
};
/// Sparc 32-bit target machine

View File

@ -51,6 +51,8 @@ public:
}
bool targetSchedulesPostRAScheduling() const override { return true; };
bool isMachineVerifierClean() const override { return false; }
};
} // end namespace llvm

View File

@ -49,6 +49,10 @@ public:
TargetLoweringObjectFile *getObjFileLowering() const override {
return TLOF.get();
}
bool isMachineVerifierClean() const override {
return false;
}
};
} // end namespace llvm

View File

@ -7,8 +7,8 @@
# This test ensures that the command line accepts
# several run passes on the same command line and
# actually create the proper pipeline for it.
# PSEUDO_PEEPHOLE: -expand-isel-pseudos -peephole-opt
# PEEPHOLE_PSEUDO: -peephole-opt -expand-isel-pseudos
# PSEUDO_PEEPHOLE: -expand-isel-pseudos {{(-machineverifier )?}}-peephole-opt
# PEEPHOLE_PSEUDO: -peephole-opt {{(-machineverifier )?}}-expand-isel-pseudos
# Make sure there are no other passes happening after what we asked.
# CHECK-NEXT: --- |