forked from OSchip/llvm-project
Add a flag to addPassesToEmit* to disable the Verifier pass run
after LSR, so that clients can opt in. llvm-svn: 97357
This commit is contained in:
parent
62c6c72bab
commit
0d8a9af7b8
|
@ -190,7 +190,8 @@ public:
|
||||||
virtual bool addPassesToEmitFile(PassManagerBase &,
|
virtual bool addPassesToEmitFile(PassManagerBase &,
|
||||||
formatted_raw_ostream &,
|
formatted_raw_ostream &,
|
||||||
CodeGenFileType,
|
CodeGenFileType,
|
||||||
CodeGenOpt::Level) {
|
CodeGenOpt::Level,
|
||||||
|
bool DisableVerify = true) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,7 +203,8 @@ public:
|
||||||
///
|
///
|
||||||
virtual bool addPassesToEmitMachineCode(PassManagerBase &,
|
virtual bool addPassesToEmitMachineCode(PassManagerBase &,
|
||||||
JITCodeEmitter &,
|
JITCodeEmitter &,
|
||||||
CodeGenOpt::Level) {
|
CodeGenOpt::Level,
|
||||||
|
bool DisableVerify = true) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,7 +214,8 @@ public:
|
||||||
virtual bool WantsWholeFile() const { return false; }
|
virtual bool WantsWholeFile() const { return false; }
|
||||||
virtual bool addPassesToEmitWholeFile(PassManager &, formatted_raw_ostream &,
|
virtual bool addPassesToEmitWholeFile(PassManager &, formatted_raw_ostream &,
|
||||||
CodeGenFileType,
|
CodeGenFileType,
|
||||||
CodeGenOpt::Level) {
|
CodeGenOpt::Level,
|
||||||
|
bool DisableVerify = true) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -227,7 +230,8 @@ protected: // Can only create subclasses.
|
||||||
/// addCommonCodeGenPasses - Add standard LLVM codegen passes used for
|
/// addCommonCodeGenPasses - Add standard LLVM codegen passes used for
|
||||||
/// both emitting to assembly files or machine code output.
|
/// both emitting to assembly files or machine code output.
|
||||||
///
|
///
|
||||||
bool addCommonCodeGenPasses(PassManagerBase &, CodeGenOpt::Level);
|
bool addCommonCodeGenPasses(PassManagerBase &, CodeGenOpt::Level,
|
||||||
|
bool DisableVerify);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void setCodeModelForJIT();
|
virtual void setCodeModelForJIT();
|
||||||
|
@ -242,7 +246,8 @@ public:
|
||||||
virtual bool addPassesToEmitFile(PassManagerBase &PM,
|
virtual bool addPassesToEmitFile(PassManagerBase &PM,
|
||||||
formatted_raw_ostream &Out,
|
formatted_raw_ostream &Out,
|
||||||
CodeGenFileType FileType,
|
CodeGenFileType FileType,
|
||||||
CodeGenOpt::Level);
|
CodeGenOpt::Level,
|
||||||
|
bool DisableVerify = true);
|
||||||
|
|
||||||
/// addPassesToEmitMachineCode - Add passes to the specified pass manager to
|
/// addPassesToEmitMachineCode - Add passes to the specified pass manager to
|
||||||
/// get machine code emitted. This uses a JITCodeEmitter object to handle
|
/// get machine code emitted. This uses a JITCodeEmitter object to handle
|
||||||
|
@ -252,7 +257,8 @@ public:
|
||||||
///
|
///
|
||||||
virtual bool addPassesToEmitMachineCode(PassManagerBase &PM,
|
virtual bool addPassesToEmitMachineCode(PassManagerBase &PM,
|
||||||
JITCodeEmitter &MCE,
|
JITCodeEmitter &MCE,
|
||||||
CodeGenOpt::Level);
|
CodeGenOpt::Level,
|
||||||
|
bool DisableVerify = true);
|
||||||
|
|
||||||
/// Target-Independent Code Generator Pass Configuration Options.
|
/// Target-Independent Code Generator Pass Configuration Options.
|
||||||
|
|
||||||
|
|
|
@ -115,9 +115,10 @@ LLVMTargetMachine::setCodeModelForStatic() {
|
||||||
bool LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
|
bool LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
|
||||||
formatted_raw_ostream &Out,
|
formatted_raw_ostream &Out,
|
||||||
CodeGenFileType FileType,
|
CodeGenFileType FileType,
|
||||||
CodeGenOpt::Level OptLevel) {
|
CodeGenOpt::Level OptLevel,
|
||||||
|
bool DisableVerify) {
|
||||||
// Add common CodeGen passes.
|
// Add common CodeGen passes.
|
||||||
if (addCommonCodeGenPasses(PM, OptLevel))
|
if (addCommonCodeGenPasses(PM, OptLevel, DisableVerify))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
OwningPtr<MCContext> Context(new MCContext());
|
OwningPtr<MCContext> Context(new MCContext());
|
||||||
|
@ -193,12 +194,13 @@ bool LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
|
||||||
///
|
///
|
||||||
bool LLVMTargetMachine::addPassesToEmitMachineCode(PassManagerBase &PM,
|
bool LLVMTargetMachine::addPassesToEmitMachineCode(PassManagerBase &PM,
|
||||||
JITCodeEmitter &JCE,
|
JITCodeEmitter &JCE,
|
||||||
CodeGenOpt::Level OptLevel) {
|
CodeGenOpt::Level OptLevel,
|
||||||
|
bool DisableVerify) {
|
||||||
// Make sure the code model is set.
|
// Make sure the code model is set.
|
||||||
setCodeModelForJIT();
|
setCodeModelForJIT();
|
||||||
|
|
||||||
// Add common CodeGen passes.
|
// Add common CodeGen passes.
|
||||||
if (addCommonCodeGenPasses(PM, OptLevel))
|
if (addCommonCodeGenPasses(PM, OptLevel, DisableVerify))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
addCodeEmitter(PM, OptLevel, JCE);
|
addCodeEmitter(PM, OptLevel, JCE);
|
||||||
|
@ -221,9 +223,15 @@ static void printAndVerify(PassManagerBase &PM,
|
||||||
/// emitting to assembly files or machine code output.
|
/// emitting to assembly files or machine code output.
|
||||||
///
|
///
|
||||||
bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM,
|
bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM,
|
||||||
CodeGenOpt::Level OptLevel) {
|
CodeGenOpt::Level OptLevel,
|
||||||
|
bool DisableVerify) {
|
||||||
// Standard LLVM-Level Passes.
|
// Standard LLVM-Level Passes.
|
||||||
|
|
||||||
|
// Before running any passes, run the verifier to determine if the input
|
||||||
|
// coming from the front-end and/or optimizer is valid.
|
||||||
|
if (!DisableVerify)
|
||||||
|
PM.add(createVerifierPass());
|
||||||
|
|
||||||
// Optionally, tun split-GEPs and no-load GVN.
|
// Optionally, tun split-GEPs and no-load GVN.
|
||||||
if (EnableSplitGEPGVN) {
|
if (EnableSplitGEPGVN) {
|
||||||
PM.add(createGEPSplitterPass());
|
PM.add(createGEPSplitterPass());
|
||||||
|
@ -235,9 +243,6 @@ bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM,
|
||||||
PM.add(createLoopStrengthReducePass(getTargetLowering()));
|
PM.add(createLoopStrengthReducePass(getTargetLowering()));
|
||||||
if (PrintLSR)
|
if (PrintLSR)
|
||||||
PM.add(createPrintFunctionPass("\n\n*** Code after LSR ***\n", &dbgs()));
|
PM.add(createPrintFunctionPass("\n\n*** Code after LSR ***\n", &dbgs()));
|
||||||
#ifndef NDEBUG
|
|
||||||
PM.add(createVerifierPass());
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Turn exception handling constructs into something the code generators can
|
// Turn exception handling constructs into something the code generators can
|
||||||
|
@ -277,6 +282,11 @@ bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM,
|
||||||
"*** Final LLVM Code input to ISel ***\n",
|
"*** Final LLVM Code input to ISel ***\n",
|
||||||
&dbgs()));
|
&dbgs()));
|
||||||
|
|
||||||
|
// All passes which modify the LLVM IR are now complete; run the verifier
|
||||||
|
// to ensure that the IR is valid.
|
||||||
|
if (!DisableVerify)
|
||||||
|
PM.add(createVerifierPass());
|
||||||
|
|
||||||
// Standard Lower-Level Passes.
|
// Standard Lower-Level Passes.
|
||||||
|
|
||||||
// Set up a MachineFunction for the rest of CodeGen to work on.
|
// Set up a MachineFunction for the rest of CodeGen to work on.
|
||||||
|
|
|
@ -3544,7 +3544,8 @@ void CWriter::visitExtractValueInst(ExtractValueInst &EVI) {
|
||||||
bool CTargetMachine::addPassesToEmitWholeFile(PassManager &PM,
|
bool CTargetMachine::addPassesToEmitWholeFile(PassManager &PM,
|
||||||
formatted_raw_ostream &o,
|
formatted_raw_ostream &o,
|
||||||
CodeGenFileType FileType,
|
CodeGenFileType FileType,
|
||||||
CodeGenOpt::Level OptLevel) {
|
CodeGenOpt::Level OptLevel,
|
||||||
|
bool DisableVerify) {
|
||||||
if (FileType != TargetMachine::CGFT_AssemblyFile) return true;
|
if (FileType != TargetMachine::CGFT_AssemblyFile) return true;
|
||||||
|
|
||||||
PM.add(createGCLoweringPass());
|
PM.add(createGCLoweringPass());
|
||||||
|
|
|
@ -27,7 +27,8 @@ struct CTargetMachine : public TargetMachine {
|
||||||
virtual bool addPassesToEmitWholeFile(PassManager &PM,
|
virtual bool addPassesToEmitWholeFile(PassManager &PM,
|
||||||
formatted_raw_ostream &Out,
|
formatted_raw_ostream &Out,
|
||||||
CodeGenFileType FileType,
|
CodeGenFileType FileType,
|
||||||
CodeGenOpt::Level OptLevel);
|
CodeGenOpt::Level OptLevel,
|
||||||
|
bool DisableVerify);
|
||||||
|
|
||||||
virtual const TargetData *getTargetData() const { return 0; }
|
virtual const TargetData *getTargetData() const { return 0; }
|
||||||
};
|
};
|
||||||
|
|
|
@ -2009,7 +2009,8 @@ char CppWriter::ID = 0;
|
||||||
bool CPPTargetMachine::addPassesToEmitWholeFile(PassManager &PM,
|
bool CPPTargetMachine::addPassesToEmitWholeFile(PassManager &PM,
|
||||||
formatted_raw_ostream &o,
|
formatted_raw_ostream &o,
|
||||||
CodeGenFileType FileType,
|
CodeGenFileType FileType,
|
||||||
CodeGenOpt::Level OptLevel) {
|
CodeGenOpt::Level OptLevel,
|
||||||
|
bool DisableVerify) {
|
||||||
if (FileType != TargetMachine::CGFT_AssemblyFile) return true;
|
if (FileType != TargetMachine::CGFT_AssemblyFile) return true;
|
||||||
PM.add(new CppWriter(o));
|
PM.add(new CppWriter(o));
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -30,7 +30,8 @@ struct CPPTargetMachine : public TargetMachine {
|
||||||
virtual bool addPassesToEmitWholeFile(PassManager &PM,
|
virtual bool addPassesToEmitWholeFile(PassManager &PM,
|
||||||
formatted_raw_ostream &Out,
|
formatted_raw_ostream &Out,
|
||||||
CodeGenFileType FileType,
|
CodeGenFileType FileType,
|
||||||
CodeGenOpt::Level OptLevel);
|
CodeGenOpt::Level OptLevel,
|
||||||
|
bool DisableVerify);
|
||||||
|
|
||||||
virtual const TargetData *getTargetData() const { return 0; }
|
virtual const TargetData *getTargetData() const { return 0; }
|
||||||
};
|
};
|
||||||
|
|
|
@ -38,7 +38,8 @@ namespace llvm {
|
||||||
virtual bool addPassesToEmitWholeFile(PassManager &PM,
|
virtual bool addPassesToEmitWholeFile(PassManager &PM,
|
||||||
formatted_raw_ostream &Out,
|
formatted_raw_ostream &Out,
|
||||||
CodeGenFileType FileType,
|
CodeGenFileType FileType,
|
||||||
CodeGenOpt::Level OptLevel);
|
CodeGenOpt::Level OptLevel,
|
||||||
|
bool DisableVerify);
|
||||||
|
|
||||||
virtual const TargetData *getTargetData() const { return 0; }
|
virtual const TargetData *getTargetData() const { return 0; }
|
||||||
};
|
};
|
||||||
|
@ -1688,7 +1689,8 @@ void MSILWriter::printExternals() {
|
||||||
bool MSILTarget::addPassesToEmitWholeFile(PassManager &PM,
|
bool MSILTarget::addPassesToEmitWholeFile(PassManager &PM,
|
||||||
formatted_raw_ostream &o,
|
formatted_raw_ostream &o,
|
||||||
CodeGenFileType FileType,
|
CodeGenFileType FileType,
|
||||||
CodeGenOpt::Level OptLevel)
|
CodeGenOpt::Level OptLevel,
|
||||||
|
bool DisableVerify)
|
||||||
{
|
{
|
||||||
if (FileType != TargetMachine::CGFT_AssemblyFile) return true;
|
if (FileType != TargetMachine::CGFT_AssemblyFile) return true;
|
||||||
MSILWriter* Writer = new MSILWriter(o);
|
MSILWriter* Writer = new MSILWriter(o);
|
||||||
|
|
Loading…
Reference in New Issue