浏览代码

* a64: Porting of MatchOperand function from x86 that takes integer parameter

J. Gareth "Curious Kit" Moreton 3 年之前
父节点
当前提交
af9c9a826e
共有 1 个文件被更改,包括 8 次插入3 次删除
  1. 8 3
      compiler/armgen/aoptarm.pas

+ 8 - 3
compiler/armgen/aoptarm.pas

@@ -33,7 +33,7 @@ Unit aoptarm;
 Interface
 Interface
 
 
 uses
 uses
-  cgbase, cgutils, cpubase, aasmtai, aasmcpu,aopt, aoptobj;
+  cgbase, cgutils, globtype, cpubase, aasmtai, aasmcpu,aopt, aoptobj;
 
 
 Type
 Type
   { while ARM and AAarch64 look not very similar at a first glance,
   { while ARM and AAarch64 look not very similar at a first glance,
@@ -54,7 +54,6 @@ Type
     function OptPass1SXTB(var p: tai): Boolean;
     function OptPass1SXTB(var p: tai): Boolean;
     function OptPass1SXTH(var p: tai): Boolean;
     function OptPass1SXTH(var p: tai): Boolean;
 
 
-
     function OptPass1LDR(var p: tai): Boolean; virtual;
     function OptPass1LDR(var p: tai): Boolean; virtual;
     function OptPass1STR(var p: tai): Boolean; virtual;
     function OptPass1STR(var p: tai): Boolean; virtual;
     function OptPass1And(var p: tai): Boolean; virtual;
     function OptPass1And(var p: tai): Boolean; virtual;
@@ -71,11 +70,12 @@ Type
 
 
   function MatchOperand(const oper: TOper; const reg: TRegister): boolean; inline;
   function MatchOperand(const oper: TOper; const reg: TRegister): boolean; inline;
   function MatchOperand(const oper1: TOper; const oper2: TOper): boolean; inline;
   function MatchOperand(const oper1: TOper; const oper2: TOper): boolean; inline;
+  function MatchOperand(const oper: TOper; const a: TCGInt): boolean; inline;
 
 
 Implementation
 Implementation
 
 
   uses
   uses
-    cutils,verbose,globtype,globals,
+    cutils,verbose,globals,
     systems,
     systems,
     cpuinfo,
     cpuinfo,
     cgobj,procinfo,
     cgobj,procinfo,
@@ -196,6 +196,11 @@ Implementation
     end;
     end;
 
 
 
 
+  function MatchOperand(const oper: TOper; const a: TCGInt): boolean; inline;
+    begin
+      result := (oper.typ = top_const) and (oper.val = a);
+    end;
+
 {$ifdef AARCH64}
 {$ifdef AARCH64}
   function TARMAsmOptimizer.USxtOp2Op(var p,hp1: tai; shiftmode: tshiftmode): Boolean;
   function TARMAsmOptimizer.USxtOp2Op(var p,hp1: tai; shiftmode: tshiftmode): Boolean;
     var
     var