Просмотр исходного кода

* patch by Jeppe Johansen to support jumptable generation for case nodes on arm/thumb-2, resolves #19502

git-svn-id: trunk@18233 -
florian 14 лет назад
Родитель
Сommit
2eb39c8843

+ 5 - 1
compiler/aasmtai.pas

@@ -113,7 +113,9 @@ interface
             relsyms (nor do they support dwarf, for that matter)
           }
           aitconst_darwin_dwarf_delta64,
-          aitconst_darwin_dwarf_delta32
+          aitconst_darwin_dwarf_delta32,
+          { ARM Thumb-2 only }
+          aitconst_half16bit { used for table jumps. The actual value is the 16bit value shifted left once }
         );
 
     const
@@ -1326,6 +1328,8 @@ implementation
             result:=LengthUleb128(qword(value));
           aitconst_sleb128bit :
             result:=LengthSleb128(value);
+          aitconst_half16bit:
+            result:=2;
           else
             internalerror(200603253);
         end;

+ 7 - 3
compiler/aggas.pas

@@ -195,10 +195,10 @@ implementation
 
 
     const
-      ait_const2str : array[aitconst_128bit..aitconst_darwin_dwarf_delta32] of string[20]=(
+      ait_const2str : array[aitconst_128bit..aitconst_half16bit] of string[20]=(
         #9'.fixme128'#9,#9'.quad'#9,#9'.long'#9,#9'.short'#9,#9'.byte'#9,
         #9'.sleb128'#9,#9'.uleb128'#9,
-        #9'.rva'#9,#9'.secrel32'#9,#9'.quad'#9,#9'.long'#9
+        #9'.rva'#9,#9'.secrel32'#9,#9'.quad'#9,#9'.long'#9,#9'.short'#9
       );
 
     function ReplaceForbiddenChars(const s: string): string;
@@ -835,7 +835,8 @@ implementation
                  aitconst_rva_symbol,
                  aitconst_secrel32_symbol,
                  aitconst_darwin_dwarf_delta32,
-                 aitconst_darwin_dwarf_delta64:
+                 aitconst_darwin_dwarf_delta64,
+                 aitconst_half16bit:
                    begin
                      if (target_info.system in systems_darwin) and
                         (constdef in [aitconst_uleb128bit,aitconst_sleb128bit]) then
@@ -881,6 +882,9 @@ implementation
                              { 64 bit constants are already handled above in this case }
                              s:=tostr(longint(tai_const(hp).value));
 {$endif cpu64bitaddr}
+                           if constdef = aitconst_half16bit then
+                             s:='('+s+')/2';
+
                            AsmWrite(s);
                            inc(l,length(s));
                            { Values with symbols are written on a single line to improve

+ 3 - 1
compiler/arm/armatt.inc

@@ -202,5 +202,7 @@
 'iteet',
 'ittet',
 'itett',
-'itttt'
+'itttt',
+'tbb',
+'tbh'
 );

+ 2 - 0
compiler/arm/armatts.inc

@@ -202,5 +202,7 @@ attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
+attsufNONE,
+attsufNONE,
 attsufNONE
 );

+ 3 - 0
compiler/arm/armins.dat

@@ -623,3 +623,6 @@ reg32,reg32,reg32,reg32  \x16\x00\x80\x90		 ARM7
 [ITETT]
 
 [ITTTT]
+
+[TBB]
+[TBH]

+ 3 - 1
compiler/arm/armop.inc

@@ -202,5 +202,7 @@ A_ITTTE,
 A_ITEET,
 A_ITTET,
 A_ITETT,
-A_ITTTT
+A_ITTTT,
+A_TBB,
+A_TBH
 );