[llvm-commits] [llvm] r97357 - in /llvm/trunk: include/llvm/Target/TargetMachine.h lib/CodeGen/LLVMTargetMachine.cpp lib/Target/CBackend/CBackend.cpp lib/Target/CBackend/CTargetMachine.h lib/Target/CppBackend/CPPBackend.cpp lib/Target/CppBackend/
nicolas geoffray
nicolas.geoffray at gmail.com
Sun Feb 28 01:59:44 PST 2010
Thanks Dan!
On Sun, Feb 28, 2010 at 1:41 AM, Dan Gohman <gohman at apple.com> wrote:
> Author: djg
> Date: Sat Feb 27 18:41:59 2010
> New Revision: 97357
>
> URL: http://llvm.org/viewvc/llvm-project?rev=97357&view=rev
> Log:
> Add a flag to addPassesToEmit* to disable the Verifier pass run
> after LSR, so that clients can opt in.
>
> Modified:
> llvm/trunk/include/llvm/Target/TargetMachine.h
> llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
> llvm/trunk/lib/Target/CBackend/CBackend.cpp
> llvm/trunk/lib/Target/CBackend/CTargetMachine.h
> llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp
> llvm/trunk/lib/Target/CppBackend/CPPTargetMachine.h
> llvm/trunk/lib/Target/MSIL/MSILWriter.cpp
>
> Modified: llvm/trunk/include/llvm/Target/TargetMachine.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetMachine.h?rev=97357&r1=97356&r2=97357&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/Target/TargetMachine.h (original)
> +++ llvm/trunk/include/llvm/Target/TargetMachine.h Sat Feb 27 18:41:59 2010
> @@ -190,7 +190,8 @@
> virtual bool addPassesToEmitFile(PassManagerBase &,
> formatted_raw_ostream &,
> CodeGenFileType,
> - CodeGenOpt::Level) {
> + CodeGenOpt::Level,
> + bool DisableVerify = true) {
> return true;
> }
>
> @@ -202,7 +203,8 @@
> ///
> virtual bool addPassesToEmitMachineCode(PassManagerBase &,
> JITCodeEmitter &,
> - CodeGenOpt::Level) {
> + CodeGenOpt::Level,
> + bool DisableVerify = true) {
> return true;
> }
>
> @@ -212,7 +214,8 @@
> virtual bool WantsWholeFile() const { return false; }
> virtual bool addPassesToEmitWholeFile(PassManager &,
> formatted_raw_ostream &,
> CodeGenFileType,
> - CodeGenOpt::Level) {
> + CodeGenOpt::Level,
> + bool DisableVerify = true) {
> return true;
> }
> };
> @@ -227,7 +230,8 @@
> /// addCommonCodeGenPasses - Add standard LLVM codegen passes used for
> /// both emitting to assembly files or machine code output.
> ///
> - bool addCommonCodeGenPasses(PassManagerBase &, CodeGenOpt::Level);
> + bool addCommonCodeGenPasses(PassManagerBase &, CodeGenOpt::Level,
> + bool DisableVerify);
>
> private:
> virtual void setCodeModelForJIT();
> @@ -242,7 +246,8 @@
> virtual bool addPassesToEmitFile(PassManagerBase &PM,
> formatted_raw_ostream &Out,
> CodeGenFileType FileType,
> - CodeGenOpt::Level);
> + CodeGenOpt::Level,
> + bool DisableVerify = true);
>
> /// addPassesToEmitMachineCode - Add passes to the specified pass manager
> to
> /// get machine code emitted. This uses a JITCodeEmitter object to
> handle
> @@ -252,7 +257,8 @@
> ///
> virtual bool addPassesToEmitMachineCode(PassManagerBase &PM,
> JITCodeEmitter &MCE,
> - CodeGenOpt::Level);
> + CodeGenOpt::Level,
> + bool DisableVerify = true);
>
> /// Target-Independent Code Generator Pass Configuration Options.
>
>
> Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=97357&r1=97356&r2=97357&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original)
> +++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Sat Feb 27 18:41:59 2010
> @@ -115,9 +115,10 @@
> bool LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
> formatted_raw_ostream &Out,
> CodeGenFileType FileType,
> - CodeGenOpt::Level OptLevel) {
> + CodeGenOpt::Level OptLevel,
> + bool DisableVerify) {
> // Add common CodeGen passes.
> - if (addCommonCodeGenPasses(PM, OptLevel))
> + if (addCommonCodeGenPasses(PM, OptLevel, DisableVerify))
> return true;
>
> OwningPtr<MCContext> Context(new MCContext());
> @@ -193,12 +194,13 @@
> ///
> bool LLVMTargetMachine::addPassesToEmitMachineCode(PassManagerBase &PM,
> JITCodeEmitter &JCE,
> - CodeGenOpt::Level
> OptLevel) {
> + CodeGenOpt::Level
> OptLevel,
> + bool DisableVerify) {
> // Make sure the code model is set.
> setCodeModelForJIT();
>
> // Add common CodeGen passes.
> - if (addCommonCodeGenPasses(PM, OptLevel))
> + if (addCommonCodeGenPasses(PM, OptLevel, DisableVerify))
> return true;
>
> addCodeEmitter(PM, OptLevel, JCE);
> @@ -221,9 +223,15 @@
> /// emitting to assembly files or machine code output.
> ///
> bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM,
> - CodeGenOpt::Level OptLevel)
> {
> + CodeGenOpt::Level OptLevel,
> + bool DisableVerify) {
> // 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.
> if (EnableSplitGEPGVN) {
> PM.add(createGEPSplitterPass());
> @@ -235,9 +243,6 @@
> PM.add(createLoopStrengthReducePass(getTargetLowering()));
> if (PrintLSR)
> 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
> @@ -277,6 +282,11 @@
> "*** Final LLVM Code input to ISel
> ***\n",
> &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.
>
> // Set up a MachineFunction for the rest of CodeGen to work on.
>
> Modified: llvm/trunk/lib/Target/CBackend/CBackend.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CBackend/CBackend.cpp?rev=97357&r1=97356&r2=97357&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/CBackend/CBackend.cpp (original)
> +++ llvm/trunk/lib/Target/CBackend/CBackend.cpp Sat Feb 27 18:41:59 2010
> @@ -3544,7 +3544,8 @@
> bool CTargetMachine::addPassesToEmitWholeFile(PassManager &PM,
> formatted_raw_ostream &o,
> CodeGenFileType FileType,
> - CodeGenOpt::Level OptLevel)
> {
> + CodeGenOpt::Level OptLevel,
> + bool DisableVerify) {
> if (FileType != TargetMachine::CGFT_AssemblyFile) return true;
>
> PM.add(createGCLoweringPass());
>
> Modified: llvm/trunk/lib/Target/CBackend/CTargetMachine.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CBackend/CTargetMachine.h?rev=97357&r1=97356&r2=97357&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/CBackend/CTargetMachine.h (original)
> +++ llvm/trunk/lib/Target/CBackend/CTargetMachine.h Sat Feb 27 18:41:59
> 2010
> @@ -27,7 +27,8 @@
> virtual bool addPassesToEmitWholeFile(PassManager &PM,
> formatted_raw_ostream &Out,
> CodeGenFileType FileType,
> - CodeGenOpt::Level OptLevel);
> + CodeGenOpt::Level OptLevel,
> + bool DisableVerify);
>
> virtual const TargetData *getTargetData() const { return 0; }
> };
>
> Modified: llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp?rev=97357&r1=97356&r2=97357&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp (original)
> +++ llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp Sat Feb 27 18:41:59
> 2010
> @@ -2009,7 +2009,8 @@
> bool CPPTargetMachine::addPassesToEmitWholeFile(PassManager &PM,
> formatted_raw_ostream &o,
> CodeGenFileType FileType,
> - CodeGenOpt::Level
> OptLevel) {
> + CodeGenOpt::Level
> OptLevel,
> + bool DisableVerify) {
> if (FileType != TargetMachine::CGFT_AssemblyFile) return true;
> PM.add(new CppWriter(o));
> return false;
>
> Modified: llvm/trunk/lib/Target/CppBackend/CPPTargetMachine.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CppBackend/CPPTargetMachine.h?rev=97357&r1=97356&r2=97357&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/CppBackend/CPPTargetMachine.h (original)
> +++ llvm/trunk/lib/Target/CppBackend/CPPTargetMachine.h Sat Feb 27 18:41:59
> 2010
> @@ -30,7 +30,8 @@
> virtual bool addPassesToEmitWholeFile(PassManager &PM,
> formatted_raw_ostream &Out,
> CodeGenFileType FileType,
> - CodeGenOpt::Level OptLevel);
> + CodeGenOpt::Level OptLevel,
> + bool DisableVerify);
>
> virtual const TargetData *getTargetData() const { return 0; }
> };
>
> Modified: llvm/trunk/lib/Target/MSIL/MSILWriter.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSIL/MSILWriter.cpp?rev=97357&r1=97356&r2=97357&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/MSIL/MSILWriter.cpp (original)
> +++ llvm/trunk/lib/Target/MSIL/MSILWriter.cpp Sat Feb 27 18:41:59 2010
> @@ -38,7 +38,8 @@
> virtual bool addPassesToEmitWholeFile(PassManager &PM,
> formatted_raw_ostream &Out,
> CodeGenFileType FileType,
> - CodeGenOpt::Level OptLevel);
> + CodeGenOpt::Level OptLevel,
> + bool DisableVerify);
>
> virtual const TargetData *getTargetData() const { return 0; }
> };
> @@ -1688,7 +1689,8 @@
> bool MSILTarget::addPassesToEmitWholeFile(PassManager &PM,
> formatted_raw_ostream &o,
> CodeGenFileType FileType,
> - CodeGenOpt::Level OptLevel)
> + CodeGenOpt::Level OptLevel,
> + bool DisableVerify)
> {
> if (FileType != TargetMachine::CGFT_AssemblyFile) return true;
> MSILWriter* Writer = new MSILWriter(o);
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20100228/0daaeeaf/attachment.html>
More information about the llvm-commits
mailing list