2
0
Эх сурвалжийг харах

m68k: refactor some code to not fail when the tasmop set will be bigger than 256 elements

git-svn-id: trunk@42926 -
Károly Balogh 5 жил өмнө
parent
commit
5eee29e5d1

+ 19 - 23
compiler/m68k/ag68kgas.pas

@@ -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;
 
 

+ 10 - 3
compiler/m68k/cpubase.pas

@@ -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;
 
 

+ 10 - 6
compiler/m68k/ra68kmot.pas

@@ -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;