浏览代码

Added aitconst_gs for AVR pointer references to Flash.

git-svn-id: trunk@30419 -
Jeppe Johansen 10 年之前
父节点
当前提交
e2272c8a7e
共有 5 个文件被更改,包括 23 次插入6 次删除
  1. 13 1
      compiler/aasmtai.pas
  2. 4 1
      compiler/aggas.pas
  3. 3 2
      compiler/assemble.pas
  4. 2 1
      compiler/llvm/agllvm.pas
  5. 1 1
      compiler/x86/agx86nsm.pas

+ 13 - 1
compiler/aasmtai.pas

@@ -133,6 +133,8 @@ interface
           aitconst_darwin_dwarf_delta32,
           aitconst_darwin_dwarf_delta32,
           { ARM Thumb-2 only }
           { ARM Thumb-2 only }
           aitconst_half16bit, { used for table jumps. The actual value is the 16bit value shifted left once }
           aitconst_half16bit, { used for table jumps. The actual value is the 16bit value shifted left once }
+          { AVR }
+          aitconst_gs, { Upper 16-bit of 17-bit constant }
           { for use by dwarf debugger information }
           { for use by dwarf debugger information }
           aitconst_16bit_unaligned,
           aitconst_16bit_unaligned,
           aitconst_32bit_unaligned,
           aitconst_32bit_unaligned,
@@ -1680,6 +1682,11 @@ implementation
                consttype:=aitconst_ptr;
                consttype:=aitconst_ptr;
            end;
            end;
 {$else i8086}
 {$else i8086}
+{$ifdef avr}
+         if assigned(_sym) and (_sym.typ=AT_FUNCTION) then
+           consttype:=aitconst_gs
+         else
+{$endif avr}
          consttype:=aitconst_ptr;
          consttype:=aitconst_ptr;
 {$endif i8086}
 {$endif i8086}
          { sym is allowed to be nil, this is used to write nil pointers }
          { sym is allowed to be nil, this is used to write nil pointers }
@@ -1784,7 +1791,11 @@ implementation
           consttype:=aitconst_farptr
           consttype:=aitconst_farptr
         else
         else
 {$endif i8086}
 {$endif i8086}
+{$ifdef avr}
+          consttype:=aitconst_gs;
+{$else avr}
           consttype:=aitconst_ptr;
           consttype:=aitconst_ptr;
+{$endif avr}
         sym:=nil;
         sym:=nil;
         endsym:=nil;
         endsym:=nil;
         symofs:=0;
         symofs:=0;
@@ -1868,7 +1879,8 @@ implementation
             result:=LengthUleb128(qword(value));
             result:=LengthUleb128(qword(value));
           aitconst_sleb128bit :
           aitconst_sleb128bit :
             result:=LengthSleb128(value);
             result:=LengthSleb128(value);
-          aitconst_half16bit:
+          aitconst_half16bit,
+          aitconst_gs:
             result:=2;
             result:=2;
           aitconst_got:
           aitconst_got:
             result:=sizeof(pint);
             result:=sizeof(pint);

+ 4 - 1
compiler/aggas.pas

@@ -127,7 +127,7 @@ implementation
       ait_const2str : array[aitconst_128bit..aitconst_64bit_unaligned] of string[20]=(
       ait_const2str : array[aitconst_128bit..aitconst_64bit_unaligned] of string[20]=(
         #9'.fixme128'#9,#9'.quad'#9,#9'.long'#9,#9'.short'#9,#9'.byte'#9,
         #9'.fixme128'#9,#9'.quad'#9,#9'.long'#9,#9'.short'#9,#9'.byte'#9,
         #9'.sleb128'#9,#9'.uleb128'#9,
         #9'.sleb128'#9,#9'.uleb128'#9,
-        #9'.rva'#9,#9'.secrel32'#9,#9'.quad'#9,#9'.long'#9,#9'.short'#9,
+        #9'.rva'#9,#9'.secrel32'#9,#9'.quad'#9,#9'.long'#9,#9'.short'#9,#9'.short'#9,
         #9'.short'#9,#9'.long'#9,#9'.quad'#9
         #9'.short'#9,#9'.long'#9,#9'.quad'#9
       );
       );
 
 
@@ -919,6 +919,7 @@ implementation
                  aitconst_darwin_dwarf_delta32,
                  aitconst_darwin_dwarf_delta32,
                  aitconst_darwin_dwarf_delta64,
                  aitconst_darwin_dwarf_delta64,
                  aitconst_half16bit,
                  aitconst_half16bit,
+                 aitconst_gs,
                  aitconst_16bit_unaligned,
                  aitconst_16bit_unaligned,
                  aitconst_32bit_unaligned,
                  aitconst_32bit_unaligned,
                  aitconst_64bit_unaligned:
                  aitconst_64bit_unaligned:
@@ -995,6 +996,8 @@ implementation
 {$endif cpu64bitaddr}
 {$endif cpu64bitaddr}
                            if constdef = aitconst_half16bit then
                            if constdef = aitconst_half16bit then
                              s:='('+s+')/2';
                              s:='('+s+')/2';
+                           if constdef = aitconst_gs then
+                             s:='gs('+s+')';
 
 
                            AsmWrite(s);
                            AsmWrite(s);
                            inc(l,length(s));
                            inc(l,length(s));

+ 3 - 2
compiler/assemble.pas

@@ -1665,11 +1665,12 @@ Implementation
                    aitconst_darwin_dwarf_delta32,
                    aitconst_darwin_dwarf_delta32,
                    aitconst_darwin_dwarf_delta64:
                    aitconst_darwin_dwarf_delta64:
                      ObjData.writebytes(Tai_const(hp).value,tai_const(hp).size);
                      ObjData.writebytes(Tai_const(hp).value,tai_const(hp).size);
-                   aitconst_half16bit:
+                   aitconst_half16bit,
+                   aitconst_gs:
                      begin
                      begin
                        tmp:=Tai_const(hp).value div 2;
                        tmp:=Tai_const(hp).value div 2;
                        ObjData.writebytes(tmp,2);
                        ObjData.writebytes(tmp,2);
-                     end
+                     end;
                    else
                    else
                      internalerror(200603254);
                      internalerror(200603254);
                  end;
                  end;

+ 2 - 1
compiler/llvm/agllvm.pas

@@ -623,7 +623,8 @@ implementation
           aitconst_secrel32_symbol,
           aitconst_secrel32_symbol,
           aitconst_darwin_dwarf_delta32,
           aitconst_darwin_dwarf_delta32,
           aitconst_darwin_dwarf_delta64,
           aitconst_darwin_dwarf_delta64,
-          aitconst_half16bit:
+          aitconst_half16bit,
+          aitconst_gs:
             internalerror(2014052901);
             internalerror(2014052901);
           aitconst_128bit,
           aitconst_128bit,
           aitconst_64bit,
           aitconst_64bit,

+ 1 - 1
compiler/x86/agx86nsm.pas

@@ -451,7 +451,7 @@ interface
         #9'FIXME_128BIT'#9,#9'DQ'#9,#9'DD'#9,#9'DW'#9,#9'DB'#9,
         #9'FIXME_128BIT'#9,#9'DQ'#9,#9'DD'#9,#9'DW'#9,#9'DB'#9,
         #9'FIXME_SLEB128BIT'#9,#9'FIXME_ULEB128BIT'#9,
         #9'FIXME_SLEB128BIT'#9,#9'FIXME_ULEB128BIT'#9,
         #9'RVA'#9,#9'SECREL32'#9,#9'FIXME_darwin_dwarf_delta64'#9,
         #9'RVA'#9,#9'SECREL32'#9,#9'FIXME_darwin_dwarf_delta64'#9,
-        #9'FIXME_darwin_dwarf_delta32'#9,#9'FIXME_half16bit'#9,
+        #9'FIXME_darwin_dwarf_delta32'#9,#9'FIXME_half16bit'#9,#9'FIXME_gs'#9,
         #9'DW'#9,#9'DD'#9,#9'FIXME_64BIT_UNALIGNED'#9
         #9'DW'#9,#9'DD'#9,#9'FIXME_64BIT_UNALIGNED'#9
       );
       );