|
@@ -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);
|
|
|
|