From ba5297be3700dc9e0b31f80e3299e2785d666e67 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Wed, 5 Feb 2014 00:27:16 +0000 Subject: [PATCH] * support disabling the i386 peephole optimizer with -Oonopeephole git-svn-id: trunk@26673 - --- compiler/i386/aopt386.pas | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/compiler/i386/aopt386.pas b/compiler/i386/aopt386.pas index 0e82343ad2..04e1a40e79 100644 --- a/compiler/i386/aopt386.pas +++ b/compiler/i386/aopt386.pas @@ -64,13 +64,16 @@ Begin { or nil } While Assigned(BlockStart) Do Begin - if pass = 0 then - PrePeepHoleOpts(AsmL, BlockStart, BlockEnd); - { Peephole optimizations } - PeepHoleOptPass1(AsmL, BlockStart, BlockEnd); - { Only perform them twice in the first pass } - if pass = 0 then - PeepHoleOptPass1(AsmL, BlockStart, BlockEnd); + if (cs_opt_peephole in current_settings.optimizerswitches) then + begin + if (pass = 0) then + PrePeepHoleOpts(AsmL, BlockStart, BlockEnd); + { Peephole optimizations } + PeepHoleOptPass1(AsmL, BlockStart, BlockEnd); + { Only perform them twice in the first pass } + if pass = 0 then + PeepHoleOptPass1(AsmL, BlockStart, BlockEnd); + end; { Data flow analyzer } If (cs_opt_asmcse in current_settings.optimizerswitches) Then begin @@ -79,9 +82,12 @@ Begin changed := CSE(asmL, blockStart, blockEnd, pass) or changed; end; { More peephole optimizations } - PeepHoleOptPass2(AsmL, BlockStart, BlockEnd); - if lastLoop then - PostPeepHoleOpts(AsmL, BlockStart, BlockEnd); + if (cs_opt_peephole in current_settings.optimizerswitches) then + begin + PeepHoleOptPass2(AsmL, BlockStart, BlockEnd); + if lastLoop then + PostPeepHoleOpts(AsmL, BlockStart, BlockEnd); + end; { Free memory } dfa.clear;