mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-10-31 08:16:47 +00:00 
			
		
		
		
	Add some options to disable various code gen optimizations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86044 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
		| @@ -31,6 +31,22 @@ namespace llvm { | |||||||
|   bool EnableFastISel; |   bool EnableFastISel; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | static cl::opt<bool> DisablePostRA("disable-post-ra", cl::Hidden, | ||||||
|  |     cl::desc("Disable Post Regalloc")); | ||||||
|  | static cl::opt<bool> DisableBranchFold("disable-branch-fold", cl::Hidden, | ||||||
|  |     cl::desc("Disable branch folding")); | ||||||
|  | static cl::opt<bool> DisableCodePlace("disable-code-place", cl::Hidden, | ||||||
|  |     cl::desc("Disable code placement")); | ||||||
|  | static cl::opt<bool> DisableSSC("disable-ssc", cl::Hidden, | ||||||
|  |     cl::desc("Disable Stack Slot Coloring")); | ||||||
|  | static cl::opt<bool> DisableMachineLICM("disable-machine-licm", cl::Hidden, | ||||||
|  |     cl::desc("Disable Machine LICM")); | ||||||
|  | static cl::opt<bool> DisableMachineSink("disable-machine-sink", cl::Hidden, | ||||||
|  |     cl::desc("Disable Machine Sinking")); | ||||||
|  | static cl::opt<bool> DisableLSR("disable-lsr", cl::Hidden, | ||||||
|  |     cl::desc("Disable Loop Strength Reduction Pass")); | ||||||
|  | static cl::opt<bool> DisableCGP("disable-cgp", cl::Hidden, | ||||||
|  |     cl::desc("Disable Codegen Prepare")); | ||||||
| static cl::opt<bool> PrintLSR("print-lsr-output", cl::Hidden, | static cl::opt<bool> PrintLSR("print-lsr-output", cl::Hidden, | ||||||
|     cl::desc("Print LLVM IR produced by the loop-reduce pass")); |     cl::desc("Print LLVM IR produced by the loop-reduce pass")); | ||||||
| static cl::opt<bool> PrintISelInput("print-isel-input", cl::Hidden, | static cl::opt<bool> PrintISelInput("print-isel-input", cl::Hidden, | ||||||
| @@ -208,7 +224,7 @@ bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM, | |||||||
|   // Standard LLVM-Level Passes. |   // Standard LLVM-Level Passes. | ||||||
|  |  | ||||||
|   // Run loop strength reduction before anything else. |   // Run loop strength reduction before anything else. | ||||||
|   if (OptLevel != CodeGenOpt::None) { |   if (OptLevel != CodeGenOpt::None && !DisableLSR) { | ||||||
|     PM.add(createLoopStrengthReducePass(getTargetLowering())); |     PM.add(createLoopStrengthReducePass(getTargetLowering())); | ||||||
|     if (PrintLSR) |     if (PrintLSR) | ||||||
|       PM.add(createPrintFunctionPass("\n\n*** Code after LSR ***\n", &errs())); |       PM.add(createPrintFunctionPass("\n\n*** Code after LSR ***\n", &errs())); | ||||||
| @@ -236,7 +252,7 @@ bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM, | |||||||
|   // Make sure that no unreachable blocks are instruction selected. |   // Make sure that no unreachable blocks are instruction selected. | ||||||
|   PM.add(createUnreachableBlockEliminationPass()); |   PM.add(createUnreachableBlockEliminationPass()); | ||||||
|  |  | ||||||
|   if (OptLevel != CodeGenOpt::None) |   if (OptLevel != CodeGenOpt::None && !DisableCGP) | ||||||
|     PM.add(createCodeGenPreparePass(getTargetLowering())); |     PM.add(createCodeGenPreparePass(getTargetLowering())); | ||||||
|  |  | ||||||
|   PM.add(createStackProtectorPass(getTargetLowering())); |   PM.add(createStackProtectorPass(getTargetLowering())); | ||||||
| @@ -265,7 +281,9 @@ bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM, | |||||||
|                  /* allowDoubleDefs= */ true); |                  /* allowDoubleDefs= */ true); | ||||||
|  |  | ||||||
|   if (OptLevel != CodeGenOpt::None) { |   if (OptLevel != CodeGenOpt::None) { | ||||||
|  |     if (!DisableMachineLICM) | ||||||
|       PM.add(createMachineLICMPass()); |       PM.add(createMachineLICMPass()); | ||||||
|  |     if (!DisableMachineSink) | ||||||
|       PM.add(createMachineSinkingPass()); |       PM.add(createMachineSinkingPass()); | ||||||
|     printAndVerify(PM, "After MachineLICM and MachineSinking", |     printAndVerify(PM, "After MachineLICM and MachineSinking", | ||||||
|                    /* allowDoubleDefs= */ true); |                    /* allowDoubleDefs= */ true); | ||||||
| @@ -281,7 +299,7 @@ bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM, | |||||||
|   printAndVerify(PM, "After Register Allocation"); |   printAndVerify(PM, "After Register Allocation"); | ||||||
|  |  | ||||||
|   // Perform stack slot coloring. |   // Perform stack slot coloring. | ||||||
|   if (OptLevel != CodeGenOpt::None) { |   if (OptLevel != CodeGenOpt::None && !DisableSSC) { | ||||||
|     // FIXME: Re-enable coloring with register when it's capable of adding |     // FIXME: Re-enable coloring with register when it's capable of adding | ||||||
|     // kill markers. |     // kill markers. | ||||||
|     PM.add(createStackSlotColoringPass(false)); |     PM.add(createStackSlotColoringPass(false)); | ||||||
| @@ -304,13 +322,13 @@ bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM, | |||||||
|     printAndVerify(PM, "After PreSched2 passes"); |     printAndVerify(PM, "After PreSched2 passes"); | ||||||
|  |  | ||||||
|   // Second pass scheduler. |   // Second pass scheduler. | ||||||
|   if (OptLevel != CodeGenOpt::None) { |   if (OptLevel != CodeGenOpt::None && !DisablePostRA) { | ||||||
|     PM.add(createPostRAScheduler(OptLevel)); |     PM.add(createPostRAScheduler(OptLevel)); | ||||||
|     printAndVerify(PM, "After PostRAScheduler"); |     printAndVerify(PM, "After PostRAScheduler"); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   // Branch folding must be run after regalloc and prolog/epilog insertion. |   // Branch folding must be run after regalloc and prolog/epilog insertion. | ||||||
|   if (OptLevel != CodeGenOpt::None) { |   if (OptLevel != CodeGenOpt::None && !DisableBranchFold) { | ||||||
|     PM.add(createBranchFoldingPass(getEnableTailMergeDefault())); |     PM.add(createBranchFoldingPass(getEnableTailMergeDefault())); | ||||||
|     printAndVerify(PM, "After BranchFolding"); |     printAndVerify(PM, "After BranchFolding"); | ||||||
|   } |   } | ||||||
| @@ -327,7 +345,7 @@ bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM, | |||||||
|   if (addPreEmitPass(PM, OptLevel)) |   if (addPreEmitPass(PM, OptLevel)) | ||||||
|     printAndVerify(PM, "After PreEmit passes"); |     printAndVerify(PM, "After PreEmit passes"); | ||||||
|  |  | ||||||
|   if (OptLevel != CodeGenOpt::None) { |   if (OptLevel != CodeGenOpt::None && !DisableCodePlace) { | ||||||
|     PM.add(createCodePlacementOptPass()); |     PM.add(createCodePlacementOptPass()); | ||||||
|     printAndVerify(PM, "After CodePlacementOpt"); |     printAndVerify(PM, "After CodePlacementOpt"); | ||||||
|   } |   } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user