Bläddra i källkod

* fixed arm compilation
* cleaned up code generation for exported linux procedures

florian 21 år sedan
förälder
incheckning
10e765329d

+ 17 - 14
compiler/arm/agarmgas.pas

@@ -81,8 +81,6 @@ unit agarmgas;
       begin
       begin
          with ref do
          with ref do
           begin
           begin
-            inc(offset,offsetfixup);
-
 {$ifdef extdebug}
 {$ifdef extdebug}
             // if base=NR_NO then
             // if base=NR_NO then
             //   internalerror(200308292);
             //   internalerror(200308292);
@@ -171,17 +169,18 @@ unit agarmgas;
               getopstr:=getopstr+'}';
               getopstr:=getopstr+'}';
             end;
             end;
           top_ref:
           top_ref:
-            getopstr:=getreferencestring(o.ref^);
-          top_symbol:
-            begin
-              hs:=o.sym.name;
-              if o.symofs>0 then
-               hs:=hs+'+'+tostr(o.symofs)
-              else
-               if o.symofs<0 then
-                hs:=hs+tostr(o.symofs);
-              getopstr:=hs;
-            end;
+            if o.ref^.refaddr=addr_full then
+              begin
+                hs:=o.ref^.symbol.name;
+                if o.ref^.offset>0 then
+                 hs:=hs+'+'+tostr(o.ref^.offset)
+                else
+                 if o.ref^.offset<0 then
+                  hs:=hs+tostr(o.ref^.offset);
+                getopstr:=hs;
+              end
+            else
+              getopstr:=getreferencestring(o.ref^);
           else
           else
             internalerror(2002070604);
             internalerror(2002070604);
         end;
         end;
@@ -236,7 +235,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.17  2003-11-30 19:35:29  florian
+  Revision 1.18  2004-03-06 20:35:19  florian
+    * fixed arm compilation
+    * cleaned up code generation for exported linux procedures
+
+  Revision 1.17  2003/11/30 19:35:29  florian
     * fixed several arm related problems
     * fixed several arm related problems
 
 
   Revision 1.16  2003/11/29 17:36:56  peter
   Revision 1.16  2003/11/29 17:36:56  peter

+ 13 - 1
compiler/arm/cgcpu.pas

@@ -73,6 +73,7 @@ unit cgcpu;
           l : tasmlabel);override;
           l : tasmlabel);override;
         procedure a_cmp_reg_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;reg1,reg2 : tregister;l : tasmlabel); override;
         procedure a_cmp_reg_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;reg1,reg2 : tregister;l : tasmlabel); override;
 
 
+        procedure a_jmp_name(list : taasmoutput;const s : string); override;
         procedure a_jmp_always(list : taasmoutput;l: tasmlabel); override;
         procedure a_jmp_always(list : taasmoutput;l: tasmlabel); override;
         procedure a_jmp_flags(list : taasmoutput;const f : TResFlags;l: tasmlabel); override;
         procedure a_jmp_flags(list : taasmoutput;const f : TResFlags;l: tasmlabel); override;
 
 
@@ -122,6 +123,7 @@ unit cgcpu;
        symconst,symdef,symsym,
        symconst,symdef,symsym,
        tgobj,
        tgobj,
        procinfo,cpupi,
        procinfo,cpupi,
+       cgutils,
        paramgr;
        paramgr;
 
 
 
 
@@ -798,6 +800,12 @@ unit cgcpu;
       end;
       end;
 
 
 
 
+    procedure tcgarm.a_jmp_name(list : taasmoutput;const s : string);
+      begin
+        list.concat(taicpu.op_sym(A_B,objectlibrary.newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION)));
+      end;
+
+
     procedure tcgarm.a_jmp_always(list : taasmoutput;l: tasmlabel);
     procedure tcgarm.a_jmp_always(list : taasmoutput;l: tasmlabel);
       begin
       begin
         list.concat(taicpu.op_sym(A_B,objectlibrary.newasmsymbol(l.name,AB_EXTERNAL,AT_FUNCTION)));
         list.concat(taicpu.op_sym(A_B,objectlibrary.newasmsymbol(l.name,AB_EXTERNAL,AT_FUNCTION)));
@@ -1273,7 +1281,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.45  2004-03-02 00:36:33  olle
+  Revision 1.46  2004-03-06 20:35:19  florian
+    * fixed arm compilation
+    * cleaned up code generation for exported linux procedures
+
+  Revision 1.45  2004/03/02 00:36:33  olle
     * big transformation of Tai_[const_]Symbol.Create[data]name*
     * big transformation of Tai_[const_]Symbol.Create[data]name*
 
 
   Revision 1.44  2004/02/04 22:01:13  peter
   Revision 1.44  2004/02/04 22:01:13  peter

+ 10 - 2
compiler/arm/cpubase.pas

@@ -213,11 +213,14 @@ unit cpubase;
       preference = ^treference;
       preference = ^treference;
       treference = record
       treference = record
          symbol      : tasmsymbol;
          symbol      : tasmsymbol;
+         { symbol the symbol of this reference is relative to, nil if none }
+         relsymbol      : tasmsymbol;
          offset      : longint;
          offset      : longint;
-         offsetfixup : longint;
          base,
          base,
          index       : tregister;
          index       : tregister;
          symboldata  : tlinkedlistitem;
          symboldata  : tlinkedlistitem;
+         { reference type addr or symbol itself }
+         refaddr : trefaddr;
          signindex   : shortint;
          signindex   : shortint;
          shiftimm    : byte;
          shiftimm    : byte;
          options     : trefoptions;
          options     : trefoptions;
@@ -258,6 +261,7 @@ unit cpubase;
       tparalocation = record
       tparalocation = record
          size : TCGSize;
          size : TCGSize;
          loc  : TCGLoc;
          loc  : TCGLoc;
+         lochigh : TCGLoc;
          alignment : byte;
          alignment : byte;
          case TCGLoc of
          case TCGLoc of
             LOC_REFERENCE : (reference : tparareference);
             LOC_REFERENCE : (reference : tparareference);
@@ -566,7 +570,11 @@ unit cpubase;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.26  2004-02-12 13:24:44  florian
+  Revision 1.27  2004-03-06 20:35:19  florian
+    * fixed arm compilation
+    * cleaned up code generation for exported linux procedures
+
+  Revision 1.26  2004/02/12 13:24:44  florian
     * small compilation fix
     * small compilation fix
 
 
   Revision 1.25  2004/01/29 17:09:14  florian
   Revision 1.25  2004/01/29 17:09:14  florian

+ 7 - 1
compiler/arm/cpuinfo.pas

@@ -23,7 +23,9 @@ Interface
 Type
 Type
    { Architecture word - Native unsigned type }
    { Architecture word - Native unsigned type }
    AWord  = Longword;
    AWord  = Longword;
+   AInt = longint;
    PAWord = ^AWord;
    PAWord = ^AWord;
+   PAInt = ^AInt;
 
 
    { this must be an ordinal type with the same size as a pointer }
    { this must be an ordinal type with the same size as a pointer }
    { to allow some dirty type casts for example when using        }
    { to allow some dirty type casts for example when using        }
@@ -112,7 +114,11 @@ Implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.5  2003-12-01 18:43:32  peter
+  Revision 1.6  2004-03-06 20:35:19  florian
+    * fixed arm compilation
+    * cleaned up code generation for exported linux procedures
+
+  Revision 1.5  2003/12/01 18:43:32  peter
     * s128real type is not compatible with s80real
     * s128real type is not compatible with s80real
 
 
   Revision 1.4  2003/11/17 23:23:47  florian
   Revision 1.4  2003/11/17 23:23:47  florian

+ 5 - 3
compiler/arm/cpupi.pas

@@ -34,8 +34,6 @@ unit cpupi;
 
 
     type
     type
        tarmprocinfo = class(tcgprocinfo)
        tarmprocinfo = class(tcgprocinfo)
-          { max. of space need for parameters, currently used by the PowerPC port only }
-          maxpushedparasize : aword;
           constructor create(aparent:tprocinfo);override;
           constructor create(aparent:tprocinfo);override;
           // procedure handle_body_start;override;
           // procedure handle_body_start;override;
           // procedure after_pass1;override;
           // procedure after_pass1;override;
@@ -137,7 +135,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.5  2003-12-03 17:39:05  florian
+  Revision 1.6  2004-03-06 20:35:20  florian
+    * fixed arm compilation
+    * cleaned up code generation for exported linux procedures
+
+  Revision 1.5  2003/12/03 17:39:05  florian
     * fixed several arm calling conventions issues
     * fixed several arm calling conventions issues
     * fixed reference reading in the assembler reader
     * fixed reference reading in the assembler reader
     * fixed a_loadaddr_ref_reg
     * fixed a_loadaddr_ref_reg

+ 7 - 2
compiler/arm/rgcpu.pas

@@ -48,7 +48,8 @@ unit rgcpu;
   implementation
   implementation
 
 
     uses
     uses
-      cgobj, verbose, cutils,
+      verbose, cutils,
+      cgutils,cgobj,
       procinfo,
       procinfo,
       aasmcpu;
       aasmcpu;
 
 
@@ -220,7 +221,11 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.8  2004-02-08 23:06:59  florian
+  Revision 1.9  2004-03-06 20:35:20  florian
+    * fixed arm compilation
+    * cleaned up code generation for exported linux procedures
+
+  Revision 1.8  2004/02/08 23:06:59  florian
     * fixed compilation problem
     * fixed compilation problem
 
 
   Revision 1.7  2004/01/28 15:36:47  florian
   Revision 1.7  2004/01/28 15:36:47  florian

+ 6 - 1
compiler/cgobj.pas

@@ -278,6 +278,7 @@ unit cgobj;
           procedure a_cmp_ref_loc_label(list: taasmoutput; size: tcgsize;cmp_op: topcmp; const ref: treference; const loc: tlocation;
           procedure a_cmp_ref_loc_label(list: taasmoutput; size: tcgsize;cmp_op: topcmp; const ref: treference; const loc: tlocation;
             l : tasmlabel);
             l : tasmlabel);
 
 
+          procedure a_jmp_name(list : taasmoutput;const s : string); virtual; abstract;
           procedure a_jmp_always(list : taasmoutput;l: tasmlabel); virtual; abstract;
           procedure a_jmp_always(list : taasmoutput;l: tasmlabel); virtual; abstract;
           procedure a_jmp_flags(list : taasmoutput;const f : TResFlags;l: tasmlabel); virtual; abstract;
           procedure a_jmp_flags(list : taasmoutput;const f : TResFlags;l: tasmlabel); virtual; abstract;
 
 
@@ -2109,7 +2110,11 @@ finalization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.160  2004-03-02 00:36:33  olle
+  Revision 1.161  2004-03-06 20:35:19  florian
+    * fixed arm compilation
+    * cleaned up code generation for exported linux procedures
+
+  Revision 1.160  2004/03/02 00:36:33  olle
     * big transformation of Tai_[const_]Symbol.Create[data]name*
     * big transformation of Tai_[const_]Symbol.Create[data]name*
 
 
   Revision 1.159  2004/02/27 10:21:05  florian
   Revision 1.159  2004/02/27 10:21:05  florian

+ 6 - 2
compiler/paramgr.pas

@@ -133,7 +133,7 @@ implementation
 
 
     uses
     uses
        cpuinfo,systems,
        cpuinfo,systems,
-       cgobj,tgobj,
+       cgutils,cgobj,tgobj,
        defutil,verbose;
        defutil,verbose;
 
 
     { true if uses a parameter as return value }
     { true if uses a parameter as return value }
@@ -532,7 +532,11 @@ end.
 
 
 {
 {
    $Log$
    $Log$
-   Revision 1.71  2004-02-17 19:14:09  florian
+   Revision 1.72  2004-03-06 20:35:19  florian
+     * fixed arm compilation
+     * cleaned up code generation for exported linux procedures
+
+   Revision 1.71  2004/02/17 19:14:09  florian
      * temp. fix for lochigh para
      * temp. fix for lochigh para
 
 
    Revision 1.70  2004/02/09 22:48:45  florian
    Revision 1.70  2004/02/09 22:48:45  florian

+ 8 - 24
compiler/systems/t_linux.pas

@@ -66,7 +66,7 @@ implementation
     verbose,systems,globtype,globals,
     verbose,systems,globtype,globals,
     symconst,script,
     symconst,script,
     fmodule,dos
     fmodule,dos
-    ,aasmbase,aasmtai,aasmcpu,cpubase
+    ,aasmbase,aasmtai,aasmcpu,cpubase,cgobj
     ,i_linux
     ,i_linux
     ;
     ;
 
 
@@ -175,31 +175,11 @@ begin
           is declared with cdecl }
           is declared with cdecl }
         if tprocsym(hp2.sym).first_procdef.mangledname<>hp2.name^ then
         if tprocsym(hp2.sym).first_procdef.mangledname<>hp2.name^ then
          begin
          begin
-{$ifdef i386}
            { place jump in codesegment }
            { place jump in codesegment }
-           codesegment.concat(Tai_align.Create_op(4,$90));
+           codesegment.concat(tai_align.create(target_info.alignment.procalign));
            codeSegment.concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0));
            codeSegment.concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0));
-           codeSegment.concat(Taicpu.Op_sym(A_JMP,S_NO,objectlibrary.newasmsymbol(tprocsym(hp2.sym).first_procdef.mangledname,AB_EXTERNAL,AT_FUNCTION)));
+           cg.a_jmp_name(codesegment,tprocsym(hp2.sym).first_procdef.mangledname);
            codeSegment.concat(Tai_symbol_end.Createname(hp2.name^));
            codeSegment.concat(Tai_symbol_end.Createname(hp2.name^));
-{$else i386}
-{$ifdef m68k}
-           { place jump in codesegment }
-           codesegment.concat(tai_align.create(4));
-           codesegment.concat(tai_symbol.createname_global(hp2.name^,AT_FUNCTION,0));
-           codesegment.concat(taicpu.op_sym(A_JMP,S_NO,objectlibrary.newasmsymbol(tprocsym(hp2.sym).first_procdef.mangledname,AB_EXTERNAL,AT_FUNCTION)));
-           codesegment.concat(tai_symbol_end.createname(hp2.name^));
-{$else m68k}
-{$ifdef powerpc}
-           { place jump in codesegment }
-           codesegment.concat(tai_align.create(4));
-           codesegment.concat(tai_symbol.createname_global(hp2.name^,AT_FUNCTION,0));
-           codesegment.concat(taicpu.op_sym(A_B,objectlibrary.newasmsymbol(tprocsym(hp2.sym).first_procdef.mangledname,AB_EXTERNAL,AT_FUNCTION)));
-           codesegment.concat(tai_symbol_end.createname(hp2.name^));
-{$else powerpc}
-{$error Exportliblinux.generatelib not yet implemented for target processor}
-{$endif powerpc}
-{$endif m68k}
-{$endif i386}
          end;
          end;
       end
       end
      else
      else
@@ -578,7 +558,11 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.16  2004-03-04 16:32:59  peter
+  Revision 1.17  2004-03-06 20:35:20  florian
+    * fixed arm compilation
+    * cleaned up code generation for exported linux procedures
+
+  Revision 1.16  2004/03/04 16:32:59  peter
     * misplaced $Ifdef
     * misplaced $Ifdef
 
 
   Revision 1.15  2004/03/02 00:36:33  olle
   Revision 1.15  2004/03/02 00:36:33  olle

+ 12 - 1
compiler/x86/cgx86.pas

@@ -103,6 +103,7 @@ unit cgx86;
         procedure a_cmp_reg_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;reg1,reg2 : tregister;l : tasmlabel); override;
         procedure a_cmp_reg_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;reg1,reg2 : tregister;l : tasmlabel); override;
         procedure a_cmp_ref_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;const ref: treference; reg : tregister; l : tasmlabel); override;
         procedure a_cmp_ref_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;const ref: treference; reg : tregister; l : tasmlabel); override;
 
 
+        procedure a_jmp_name(list : taasmoutput;const s : string);override;
         procedure a_jmp_always(list : taasmoutput;l: tasmlabel); override;
         procedure a_jmp_always(list : taasmoutput;l: tasmlabel); override;
         procedure a_jmp_flags(list : taasmoutput;const f : TResFlags;l: tasmlabel); override;
         procedure a_jmp_flags(list : taasmoutput;const f : TResFlags;l: tasmlabel); override;
 
 
@@ -426,6 +427,12 @@ unit cgx86;
                               Assembler code
                               Assembler code
 ****************************************************************************}
 ****************************************************************************}
 
 
+    procedure tcgx86.a_jmp_name(list : taasmoutput;const s : string);
+      begin
+        list.concat(taicpu.op_sym(A_JMP,S_NO,objectlibrary.newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION)));
+      end;
+
+
     { currently does nothing }
     { currently does nothing }
     procedure tcgx86.a_jmp_always(list : taasmoutput;l: tasmlabel);
     procedure tcgx86.a_jmp_always(list : taasmoutput;l: tasmlabel);
      begin
      begin
@@ -1781,7 +1788,11 @@ unit cgx86;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.116  2004-03-02 00:36:33  olle
+  Revision 1.117  2004-03-06 20:35:20  florian
+    * fixed arm compilation
+    * cleaned up code generation for exported linux procedures
+
+  Revision 1.116  2004/03/02 00:36:33  olle
     * big transformation of Tai_[const_]Symbol.Create[data]name*
     * big transformation of Tai_[const_]Symbol.Create[data]name*
 
 
   Revision 1.115  2004/02/27 10:21:06  florian
   Revision 1.115  2004/02/27 10:21:06  florian