From c40240990e3d71205c2056d150fdcee9b8327f9a Mon Sep 17 00:00:00 2001 From: florian Date: Tue, 29 Sep 2015 19:31:33 +0000 Subject: [PATCH] * popt386 uses now also all routines of aoptx86 git-svn-id: trunk@31894 - --- compiler/i386/popt386.pas | 75 --------------------------------------- compiler/x86/aoptx86.pas | 3 +- 2 files changed, 2 insertions(+), 76 deletions(-) diff --git a/compiler/i386/popt386.pas b/compiler/i386/popt386.pas index f982276834..bb9aee2918 100644 --- a/compiler/i386/popt386.pas +++ b/compiler/i386/popt386.pas @@ -471,81 +471,6 @@ begin end; -function MatchInstruction(const instr: tai; const op: TAsmOp; const opsize: topsizes): boolean; - begin - result := - (instr.typ = ait_instruction) and - (taicpu(instr).opcode = op) and - ((opsize = []) or (taicpu(instr).opsize in opsize)); - end; - - -function MatchInstruction(const instr: tai; const op1,op2: TAsmOp; const opsize: topsizes): boolean; - begin - result := - (instr.typ = ait_instruction) and - ((taicpu(instr).opcode = op1) or - (taicpu(instr).opcode = op2) - ) and - ((opsize = []) or (taicpu(instr).opsize in opsize)); - end; - - -function MatchInstruction(const instr: tai; const op1,op2,op3: TAsmOp; const opsize: topsizes): boolean; - begin - result := - (instr.typ = ait_instruction) and - ((taicpu(instr).opcode = op1) or - (taicpu(instr).opcode = op2) or - (taicpu(instr).opcode = op3) - ) and - ((opsize = []) or (taicpu(instr).opsize in opsize)); - end; - - -function MatchOperand(const oper: TOper; const reg: TRegister): boolean; inline; - begin - result := (oper.typ = top_reg) and (oper.reg = reg); - end; - - -function MatchOperand(const oper: TOper; const a: tcgint): boolean; inline; - begin - result := (oper.typ = top_const) and (oper.val = a); - end; - - -function MatchOperand(const oper1: TOper; const oper2: TOper): boolean; inline; - begin - result := oper1.typ = oper2.typ; - - if result then - case oper1.typ of - top_const: - Result:=oper1.val = oper2.val; - top_reg: - Result:=oper1.reg = oper2.reg; - top_ref: - Result:=RefsEqual(oper1.ref^, oper2.ref^); - else - internalerror(2013102801); - end - end; - - -function MatchReference(const ref : treference;base,index : TRegister) : Boolean; - begin - Result:=(ref.offset=0) and - (ref.scalefactor in [0,1]) and - (ref.segment=NR_NO) and - (ref.symbol=nil) and - (ref.relsymbol=nil) and - ((base=NR_INVALID) or - (ref.base=base)) and - ((index=NR_INVALID) or - (ref.index=index)); - end; - { First pass of peephole optimizations } procedure PeepHoleOptPass1(Asml: TAsmList; BlockStart, BlockEnd: tai); diff --git a/compiler/x86/aoptx86.pas b/compiler/x86/aoptx86.pas index 00d238d43a..c731f140ad 100644 --- a/compiler/x86/aoptx86.pas +++ b/compiler/x86/aoptx86.pas @@ -39,6 +39,7 @@ unit aoptx86; function MatchOperand(const oper: TOper; const reg: TRegister): boolean; inline; function MatchOperand(const oper: TOper; const a: tcgint): boolean; inline; + function MatchOperand(const oper1: TOper; const oper2: TOper): boolean; function RefsEqual(const r1, r2: treference): boolean; @@ -96,7 +97,7 @@ unit aoptx86; end; - function MatchOperand(const oper1: TOper; const oper2: TOper): boolean; inline; + function MatchOperand(const oper1: TOper; const oper2: TOper): boolean; begin result := oper1.typ = oper2.typ;