浏览代码

internal assembler-reader x86 (local/global var) - validate asm-opcode-attsuffix and memrefsize

git-svn-id: branches/tg74/avx512-0037785@47984 -
tg74 4 年之前
父节点
当前提交
b6cf482fcf

+ 4 - 4
compiler/i386/i386atts.inc

@@ -425,9 +425,9 @@ attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufINT,
-attsufINT,
 attsufNONE,
-attsufINT,
+attsufNONE,
+attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
@@ -539,14 +539,14 @@ attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
-attsufINT,
+attsufNONE,
 attsufNONE,
 attsufINT,
 attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
-attsufINT,
+attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,

+ 4 - 4
compiler/i8086/i8086atts.inc

@@ -425,9 +425,9 @@ attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufINT,
-attsufINT,
 attsufNONE,
-attsufINT,
+attsufNONE,
+attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
@@ -539,14 +539,14 @@ attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
-attsufINT,
+attsufNONE,
 attsufNONE,
 attsufINT,
 attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
-attsufINT,
+attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,

+ 1 - 4
compiler/msg/errore.msg

@@ -2922,10 +2922,7 @@ asmr_e_multiple_segment_overrides=07139_E_Cannot use multiple segment overrides
 asmr_w_multiple_segment_overrides=07140_W_Multiple segment overrides (only the last one will take effect)
 asmr_w_segment_override_ignored_in_64bit_mode=07141_W_Segment base $1 will be generated, but is ignored by the CPU in 64-bit mode
 asmr_e_mismatch_broadcasting_elements=07142_E_Mismatch broadcasting elements (expected: {$1} found: {$2})
-asmr_e_invalid_arrangement=07143_E_Invalid arrangement specifier "$1"
-asmr_e_a64_invalid_regset=07144_E_Registers in a register set must be consecutive.
-asmr_e_unknown_field=07145_E_Unknown field identifier
-% The internal assembler read cannot find the passed field identifier.
+asmr_e_not_supported_combination_attsuffix_memrefsize_type=07143_E_Not supported combination opcode: $1 - att-suffix-type {$2} and memrefsize-type {$3}
 #
 # Assembler/binary writers
 #

+ 3 - 5
compiler/msgidx.inc

@@ -856,9 +856,7 @@ const
   asmr_w_multiple_segment_overrides=07140;
   asmr_w_segment_override_ignored_in_64bit_mode=07141;
   asmr_e_mismatch_broadcasting_elements=07142;
-  asmr_e_invalid_arrangement=07143;
-  asmr_e_a64_invalid_regset=07144;
-  asmr_e_unknown_field=07145;
+  asmr_e_not_supported_combination_attsuffix_memrefsize_type=07143;
   asmw_f_too_many_asm_files=08000;
   asmw_f_assembler_output_not_supported=08001;
   asmw_f_comp_not_supported=08002;
@@ -1140,9 +1138,9 @@ const
   option_info=11024;
   option_help_pages=11025;
 
-  MsgTxtSize = 87862;
+  MsgTxtSize = 87822;
 
   MsgIdxMax : array[1..20] of longint=(
-    28,107,361,131,99,63,146,37,223,68,
+    28,107,361,131,99,63,144,37,223,68,
     64,20,30,1,1,1,1,1,1,1
   );

文件差异内容过多而无法显示
+ 254 - 255
compiler/msgtxt.inc


+ 18 - 6
compiler/x86/aasmcpu.pas

@@ -685,6 +685,7 @@ interface
 implementation
 
      uses
+       typinfo,
        cutils,
        globals,
        systems,
@@ -2309,7 +2310,7 @@ implementation
     function is_16_bit_ref(const ref:treference):boolean;
       var
         ir,br : Tregister;
-        isub,bsub : tsubregister;
+        isub,bsub : cgbase.tsubregister;
       begin
         if (ref.index<>NR_NO) and (getregtype(ref.index)=R_MMREGISTER) then
           exit(false);
@@ -2469,15 +2470,15 @@ implementation
         // ax cx dx bx si di bp sp   -- in x86reg.dat
         // ax cx dx bx sp bp si di   -- needed order
           (0, 1, 2, 3, 6, 7, 5, 4);
-        maxsupreg: array[tregistertype] of tsuperregister=
+        maxsupreg: array[cgbase.tregistertype] of cgbase.tsuperregister=
 {$ifdef x86_64}
           (0, 16, 9, 8, 32, 32, 8, 0, 0, 0);
 {$else x86_64}
           (0,  8, 9, 8,  8, 32, 8, 0, 0, 0);
 {$endif x86_64}
       var
-        rs: tsuperregister;
-        rt: tregistertype;
+        rs: cgbase.tsuperregister;
+        rt: cgbase.tregistertype;
       begin
         rs:=getsupreg(r);
         rt:=getregtype(r);
@@ -2534,7 +2535,7 @@ implementation
         base,index,scalefactor,
         o     : longint;
         ir,br : Tregister;
-        isub,bsub : tsubregister;
+        isub,bsub : cgbase.tsubregister;
       begin
         result:=false;
         ir:=input.ref^.index;
@@ -4640,7 +4641,7 @@ implementation
       end;
 
 
-    function taicpu.is_same_reg_move(regtype: Tregistertype):boolean;
+    function taicpu.is_same_reg_move(regtype: cgbase.Tregistertype):boolean;
       begin
         result:=(((opcode=A_MOV) or (opcode=A_XCHG)) and
                  (regtype = R_INTREGISTER) and
@@ -5522,6 +5523,17 @@ implementation
           InsTabMemRefSizeInfoCache^[AsmOp].RegYMMSizeMask:=RegYMMSizeMask;
           InsTabMemRefSizeInfoCache^[AsmOp].RegZMMSizeMask:=RegZMMSizeMask;
 
+          if (InsTabMemRefSizeInfoCache^[AsmOp].ExistsSSEAVX) and
+             (gas_needsuffix[AsmOp] <> AttSufNONE) and
+             (not(InsTabMemRefSizeInfoCache^[AsmOp].MemRefSize in MemRefMultiples)) then
+          begin
+            // combination (attsuffix <> "AttSufNONE") and (MemRefSize is not in MemRefMultiples) is not supported =>> check opcode-definition in x86ins.dat');
+            //InternalError(20210102);
+            Message3(asmr_e_not_supported_combination_attsuffix_memrefsize_type,
+                     std_op2str[AsmOp],
+                     GetEnumName(typeinfo(TAttSuffix), ord(gas_needsuffix[AsmOp])),
+                     GetEnumName(typeinfo(TMemRefSizeInfo), ord(InsTabMemRefSizeInfoCache^[AsmOp].MemRefSize)));
+          end;
         end;
       end;
 

+ 5 - 2
compiler/x86/rax86.pas

@@ -1597,9 +1597,12 @@ procedure Tx86Instruction.SetInstructionOpsize;
                end;
             end;
           end
-          else if not(MemRefSize in [msiMemRegSize]) then
+          else if
+             (gas_needsuffix[opcode] = AttSufNone) and
+             (not(MemRefSize in [msiMemRegSize])) then
           begin
-            //bExistMemRef:=false;
+            // external gnu-assembler: no suffix =>> use instructions.opsize to define memory-reference size
+            // Tx86Instruction: local variable: operand.opsize
 
             for i := 1 to ops do
              if tx86operand(operands[i]).opr.typ in [OPR_REFERENCE,OPR_LOCAL] then

+ 4 - 4
compiler/x86/x86ins.dat

@@ -2344,7 +2344,7 @@ mmxreg,xmmreg         \331\2\x0F\x2D\110              KATMAI,SSE,MMX
 xmmreg,rm32           \333\321\2\x0F\x2A\110      KATMAI,SSE
 xmmreg,rm64           \333\321\2\x0F\x2A\110      KATMAI,SSE,X86_64
 
-[CVTSS2SI,cvtss2siX]
+[CVTSS2SI]
 (Ch_Wop2, Ch_Rop1)
 reg32|64,mem32	      \333\320\2\x0F\x2D\110          KATMAI,SSE
 reg32|64,xmmreg       \333\320\2\x0F\x2D\110          KATMAI,SSE
@@ -2354,7 +2354,7 @@ reg32|64,xmmreg       \333\320\2\x0F\x2D\110          KATMAI,SSE
 mmxreg,mem64          \331\2\x0F\x2C\110              KATMAI,SSE,MMX
 mmxreg,xmmreg         \331\2\x0F\x2C\110              KATMAI,SSE,MMX
 
-[CVTTSS2SI,cvttss2siX]
+[CVTTSS2SI]
 (Ch_Wop2, Ch_Rop1)
 reg32|64,mem32        \333\320\2\x0F\x2C\110          KATMAI,SSE
 reg32|64,xmmreg       \333\320\2\x0F\x2C\110          KATMAI,SSE
@@ -2866,7 +2866,7 @@ xmmreg,xmmrm            \361\2\x0F\x5B\110              WILLAMETTE,SSE2,SM
 xmmreg,xmmreg            \2\x0F\x5A\110                WILLAMETTE,SSE2 ;,SQ
 xmmreg,mem64             \2\x0F\x5A\110                WILLAMETTE,SSE2 ;,SQ
 
-[CVTSD2SI,cvtsd2siX]
+[CVTSD2SI]
 (Ch_Wop2, Ch_Rop1)
 reg32,xmmreg 	        \334\2\x0F\x2D\110        WILLAMETTE,SSE2
 reg32,mem64          	\334\2\x0F\x2D\110        WILLAMETTE,SSE2
@@ -2900,7 +2900,7 @@ xmmreg,xmmrm            \361\2\x0F\xE6\110              WILLAMETTE,SSE2,SM
 (Ch_Wop2, Ch_Rop1)
 xmmreg,xmmrm            \333\2\x0F\x5B\110              WILLAMETTE,SSE2,SM
 
-[CVTTSD2SI,cvttsd2siX]
+[CVTTSD2SI]
 (Ch_Wop2, Ch_Rop1)
 reg32|64,xmmreg         \334\320\2\x0F\x2C\110        WILLAMETTE,SSE2
 reg32|64,mem64          \334\320\2\x0F\x2C\110        WILLAMETTE,SSE2

+ 4 - 4
compiler/x86_64/x8664ats.inc

@@ -411,9 +411,9 @@ attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufINT,
-attsufINT,
 attsufNONE,
-attsufINT,
+attsufNONE,
+attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
@@ -525,14 +525,14 @@ attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
-attsufINT,
+attsufNONE,
 attsufNONE,
 attsufINT,
 attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
-attsufINT,
+attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,

部分文件因为文件数量过多而无法显示