Browse Source

Error message about distinct destination and source registers.

Margers 2 months ago
parent
commit
b1f122ffad
2 changed files with 10 additions and 2 deletions
  1. 3 1
      compiler/msg/errore.msg
  2. 7 1
      compiler/x86/aasmcpu.pas

+ 3 - 1
compiler/msg/errore.msg

@@ -3028,7 +3028,7 @@ asmr_e_a64_regset_too_large=07147_E_Too many registers in register set.
 #
 #
 # Assembler/binary writers
 # Assembler/binary writers
 #
 #
-# 08037 is the last used one
+# 08039 is the last used one
 #
 #
 asmw_f_too_many_asm_files=08000_F_Too many assembler files
 asmw_f_too_many_asm_files=08000_F_Too many assembler files
 % With smartlinking enabled, there are too many assembler
 % With smartlinking enabled, there are too many assembler
@@ -3087,6 +3087,8 @@ asmw_e_illegal_use_of_rip=08034_E_Asm: RIP cannot be used as index register or w
 asmw_e_seh_invalid_data_size=08035_F_Illegal function size for SEH function
 asmw_e_seh_invalid_data_size=08035_F_Illegal function size for SEH function
 asmw_e_illegal_use_of_sp=08036_E_Asm: ESP/RSP cannot be used as index register
 asmw_e_illegal_use_of_sp=08036_E_Asm: ESP/RSP cannot be used as index register
 asmw_e_illegal_unset_index=08037_E_Wasm32 symbol $1 without index value error
 asmw_e_illegal_unset_index=08037_E_Wasm32 symbol $1 without index value error
+asmw_e_destination_and_source_registers_must_be_distinct=08038_E_Asm: $1 destination and source registers must be distinct.
+asmw_e_destination_index_mask_registers_should_be_distinct=08039_E_Asm: $1 destination, index and mask registers should be distinct.
 #
 #
 # Executing linker/assembler
 # Executing linker/assembler
 #
 #

+ 7 - 1
compiler/x86/aasmcpu.pas

@@ -2041,7 +2041,13 @@ implementation
              begin
              begin
                if (IF_DISTINCT in insentry^.flags) then
                if (IF_DISTINCT in insentry^.flags) then
                   if not DistinctRegisters(IF_DALL in insentry^.flags) then
                   if not DistinctRegisters(IF_DALL in insentry^.flags) then
-                    break;  { unacceptable register combination (shoud be distinct) }
+                    begin
+                      if IF_DALL in insentry^.flags then
+                        Message1(asmw_e_destination_index_mask_registers_should_be_distinct,GetString)
+                      else
+                        Message1(asmw_e_destination_and_source_registers_must_be_distinct,GetString);
+                      exit;  { unacceptable register combination (shoud be distinct) }
+                    end;
                result:=true;
                result:=true;
                exit;
                exit;
              end;
              end;