summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkaroly <karoly@3ad0048d-3df7-0310-abae-a5850022a9f2>2021-04-19 09:13:02 +0000
committerkaroly <karoly@3ad0048d-3df7-0310-abae-a5850022a9f2>2021-04-19 09:13:02 +0000
commit0f102c98fad0386770958401226d2cb88793a4ad (patch)
tree28b44af601e6c8dd966c0d20f17f23c7e4cb0a92
parente51d23be2b74de14607d09802c012791358ec4b7 (diff)
downloadfpc-0f102c98fad0386770958401226d2cb88793a4ad.tar.gz
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: https://svn.freepascal.org/svn/fpc/trunk@49233 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r--compiler/m68k/cpubase.pas8
-rw-r--r--compiler/m68k/r68kgri.inc16
-rw-r--r--compiler/m68k/r68ksri.inc36
-rw-r--r--compiler/m68k/ra68kmot.pas7
-rw-r--r--compiler/utils/mk68kreg.pp4
5 files changed, 42 insertions, 29 deletions
diff --git a/compiler/m68k/cpubase.pas b/compiler/m68k/cpubase.pas
index 6ecf62ec53..cf592f19a2 100644
--- a/compiler/m68k/cpubase.pas
+++ b/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;
diff --git a/compiler/m68k/r68kgri.inc b/compiler/m68k/r68kgri.inc
index 0e386d3f1a..31c8bf302e 100644
--- a/compiler/m68k/r68kgri.inc
+++ b/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,
diff --git a/compiler/m68k/r68ksri.inc b/compiler/m68k/r68ksri.inc
index 47fd3b2f30..0f66a7b772 100644
--- a/compiler/m68k/r68ksri.inc
+++ b/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,
diff --git a/compiler/m68k/ra68kmot.pas b/compiler/m68k/ra68kmot.pas
index ba7f0a3b4e..184a9742ae 100644
--- a/compiler/m68k/ra68kmot.pas
+++ b/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);
diff --git a/compiler/utils/mk68kreg.pp b/compiler/utils/mk68kreg.pp
index 3cd6d19c40..59c9445811 100644
--- a/compiler/utils/mk68kreg.pp
+++ b/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];