Ver Fonte

m68k: added support to references like (a0,d0.w) in inline assembly, also fixed a bug, where sometimes the index register would have been randomly set as smaller than .l size, when the size wasn't specified

git-svn-id: trunk@49233 -
Károly Balogh há 4 anos atrás
pai
commit
2a7aa11163

+ 8 - 0
compiler/m68k/cpubase.pas

@@ -331,6 +331,10 @@ implementation
         {$i r68kstd.inc}
       );
 
+      std_regfullname_table : TRegNameTable = (
+        {$i r68kstdf.inc}
+      );
+
       regnumber_index : array[tregisterindex] of tregisterindex = (
         {$i r68krni.inc}
       );
@@ -484,6 +488,10 @@ implementation
     function std_regnum_search(const s:string):Tregister;
       begin
         result:=regnumber_table[findreg_by_name_table(s,std_regname_table,std_regname_index)];
+        if result=NR_NO then
+          begin
+            result:=regnumber_table[findreg_by_name_table(s,std_regfullname_table,std_regname_index)];
+          end;
       end;
 
 

+ 8 - 8
compiler/m68k/r68kgri.inc

@@ -16,30 +16,30 @@
 56,
 57,
 34,
+3,
 1,
 2,
-3,
+6,
 4,
 5,
-6,
+9,
 7,
 8,
-9,
 12,
-11,
 10,
+11,
+15,
 13,
 14,
-15,
+18,
 16,
 17,
-18,
+21,
 19,
 20,
-21,
 24,
-23,
 22,
+23,
 38,
 25,
 26,

+ 18 - 18
compiler/m68k/r68ksri.inc

@@ -1,46 +1,46 @@
 { don't edit, this file is generated from m68kreg.dat }
 0,
-43,
 42,
-45,
+43,
 44,
-47,
+45,
 46,
-49,
+47,
 48,
-51,
+49,
 50,
-53,
+51,
 52,
-55,
+53,
 54,
-57,
+55,
 56,
+57,
 34,
-1,
 3,
+1,
 2,
-5,
-4,
 6,
-7,
+4,
+5,
 9,
+7,
 8,
-11,
 12,
 10,
-13,
+11,
 15,
+13,
 14,
-17,
-16,
 18,
-19,
+16,
+17,
 21,
+19,
 20,
-23,
 24,
 22,
+23,
 38,
 25,
 26,

+ 6 - 1
compiler/m68k/ra68kmot.pas

@@ -216,6 +216,11 @@ const
         actasmregister:=std_regnum_search(lower(s));
         if actasmregister<>NR_NO then
           begin
+            { this is a hack. if the reg is valid, and its string doesn't
+              contain a dot, we make sure it's a full size reg (KB) }
+            if (getregtype(actasmregister) in [R_ADDRESSREGISTER,R_INTREGISTER]) and
+               (Pos('.',s) = 0) then
+              setsubreg(actasmregister,R_SUBWHOLE);
             result:=true;
             actasmtoken:=AS_REGISTER;
           end;
@@ -1196,7 +1201,7 @@ const
                      while actasmtoken <> AS_SEPARATOR do
                         Consume(actasmtoken);
                    end;
-                   exit;
+                 exit;
                end;
               { // (reg,reg .. // }
               Consume(AS_COMMA);

+ 2 - 2
compiler/utils/mk68kreg.pp

@@ -133,7 +133,7 @@ begin
         i:=h;
         repeat
           j:=i+p;
-          if stdnames[std_regname_index[j]]>=stdnames[std_regname_index[i]] then
+          if stdfullnames[std_regname_index[j]]>=stdfullnames[std_regname_index[i]] then
             break;
           t:=std_regname_index[i];
           std_regname_index[i]:=std_regname_index[j];
@@ -164,7 +164,7 @@ begin
         i:=h;
         repeat
           j:=i+p;
-          if gasnames[gas_regname_index[j]]>=gasnames[gas_regname_index[i]] then
+          if gasfullnames[gas_regname_index[j]]>=gasfullnames[gas_regname_index[i]] then
             break;
           t:=gas_regname_index[i];
           gas_regname_index[i]:=gas_regname_index[j];