mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-02 03:22:37 +02:00
m68k: refactor some code to not fail when the tasmop set will be bigger than 256 elements
git-svn-id: trunk@42926 -
This commit is contained in:
parent
de095c4631
commit
5eee29e5d1
@ -270,32 +270,28 @@ interface
|
||||
op : tasmop;
|
||||
begin
|
||||
op:=taicpu(hp).opcode;
|
||||
{ old versions of GAS don't like PEA.L and LEA.L }
|
||||
if (op in [
|
||||
case op of
|
||||
A_LEA,A_PEA,A_ABCD,A_BCHG,A_BCLR,A_BSET,A_BTST,
|
||||
A_EXG,A_NBCD,A_SBCD,A_SWAP,A_TAS,A_SCC,A_SCS,
|
||||
A_SEQ,A_SGE,A_SGT,A_SHI,A_SLE,A_SLS,A_SLT,A_SMI,
|
||||
A_SNE,A_SPL,A_ST,A_SVC,A_SVS,A_SF]) then
|
||||
result:=gas_op2str[op]
|
||||
else
|
||||
{ Scc/FScc is always BYTE, DBRA/DBcc is always WORD, doesn't need opsize (KB) }
|
||||
if op in [A_SXX, A_FSXX, A_DBXX, A_DBRA] then
|
||||
result:=gas_op2str[op]+cond2str[taicpu(hp).condition]
|
||||
else
|
||||
{ fix me: a fugly hack to utilize GNU AS pseudo instructions for more optimal branching }
|
||||
if op in [A_JSR] then
|
||||
result:='jbsr'
|
||||
else
|
||||
if op in [A_JMP] then
|
||||
result:='jra'
|
||||
else
|
||||
if op in [A_BXX] then
|
||||
result:='j'+cond2str[taicpu(hp).condition]+gas_opsize2str[taicpu(hp).opsize]
|
||||
else
|
||||
if op in [A_FBXX] then
|
||||
result:='fj'+{gas_op2str[op]+}cond2str[taicpu(hp).condition]+gas_opsize2str[taicpu(hp).opsize]
|
||||
else
|
||||
result:=gas_op2str[op]+gas_opsize2str[taicpu(hp).opsize];
|
||||
A_SNE,A_SPL,A_ST,A_SVC,A_SVS,A_SF:
|
||||
{ old versions of GAS don't like PEA.L and LEA.L }
|
||||
result:=gas_op2str[op];
|
||||
A_SXX, A_FSXX, A_DBXX, A_DBRA:
|
||||
{ Scc/FScc is always BYTE, DBRA/DBcc is always WORD, doesn't need opsize (KB) }
|
||||
result:=gas_op2str[op]+cond2str[taicpu(hp).condition];
|
||||
{ fix me: a fugly hack to utilize GNU AS pseudo instructions for more optimal branching }
|
||||
A_JSR:
|
||||
result:='jbsr';
|
||||
A_JMP:
|
||||
result:='jra';
|
||||
A_BXX:
|
||||
result:='j'+cond2str[taicpu(hp).condition]+gas_opsize2str[taicpu(hp).opsize];
|
||||
A_FBXX:
|
||||
result:='fj'+{gas_op2str[op]+}cond2str[taicpu(hp).condition]+gas_opsize2str[taicpu(hp).opsize];
|
||||
else
|
||||
result:=gas_op2str[op]+gas_opsize2str[taicpu(hp).opsize];
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
|
@ -399,9 +399,16 @@ implementation
|
||||
|
||||
function is_calljmp(o:tasmop):boolean;
|
||||
begin
|
||||
is_calljmp :=
|
||||
o in [A_BXX,A_FBXX,A_DBXX,A_BCC..A_BVS,A_DBCC..A_DBVS,A_FBEQ..A_FSNGLE,
|
||||
A_JSR,A_BSR,A_JMP];
|
||||
case o of
|
||||
A_BXX,A_FBXX,A_DBXX,
|
||||
A_BCC..A_BVS,
|
||||
A_DBCC..A_DBVS,
|
||||
A_FBEQ..A_FSNGLE,
|
||||
A_JSR,A_BSR,A_JMP:
|
||||
is_calljmp:=true;
|
||||
else
|
||||
is_calljmp:=false;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
|
@ -178,12 +178,16 @@ const
|
||||
actopcode:=tasmop(PtrUInt(iasmops.Find(hs)));
|
||||
{ Also filter the helper opcodes, they can't be valid
|
||||
while reading an assembly source }
|
||||
if not (actopcode in
|
||||
[A_NONE, A_LABEL, A_DBXX, A_SXX, A_BXX, A_FBXX]) then
|
||||
begin
|
||||
actasmtoken:=AS_OPCODE;
|
||||
result:=TRUE;
|
||||
exit;
|
||||
case actopcode of
|
||||
A_NONE, A_LABEL, A_DBXX, A_SXX, A_BXX, A_FBXX:
|
||||
begin
|
||||
end;
|
||||
else
|
||||
begin
|
||||
actasmtoken:=AS_OPCODE;
|
||||
result:=TRUE;
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user