Browse Source

* powerpc compiles again

peter 21 years ago
parent
commit
54cb433625

+ 6 - 3
compiler/cg64f32.pas

@@ -239,7 +239,7 @@ unit cg64f32;
       begin
       begin
         case l.loc of
         case l.loc of
           LOC_REGISTER,LOC_CREGISTER:
           LOC_REGISTER,LOC_CREGISTER:
-            a_load64_reg_ref(list,l.reg64,ref);
+            a_load64_reg_ref(list,l.register64,ref);
           LOC_CONSTANT :
           LOC_CONSTANT :
             a_load64_const_ref(list,l.value64,ref);
             a_load64_const_ref(list,l.value64,ref);
           else
           else
@@ -255,7 +255,7 @@ unit cg64f32;
           LOC_REFERENCE, LOC_CREFERENCE:
           LOC_REFERENCE, LOC_CREFERENCE:
             a_load64_const_ref(list,value,l.reference);
             a_load64_const_ref(list,value,l.reference);
           LOC_REGISTER,LOC_CREGISTER:
           LOC_REGISTER,LOC_CREGISTER:
-            a_load64_const_reg(list,value,l.reg64);
+            a_load64_const_reg(list,value,l.register64);
           else
           else
             internalerror(200112293);
             internalerror(200112293);
         end;
         end;
@@ -753,7 +753,10 @@ unit cg64f32;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.58  2004-06-16 20:07:07  florian
+  Revision 1.59  2004-06-17 16:55:46  peter
+    * powerpc compiles again
+
+  Revision 1.58  2004/06/16 20:07:07  florian
     * dwarf branch merged
     * dwarf branch merged
 
 
   Revision 1.57.2.5  2004/06/13 10:51:16  florian
   Revision 1.57.2.5  2004/06/13 10:51:16  florian

+ 66 - 61
compiler/powerpc/aasmcpu.pas

@@ -27,8 +27,9 @@ unit aasmcpu;
 interface
 interface
 
 
 uses
 uses
-  cclasses,aasmtai,
-  aasmbase,globals,verbose,
+  cclasses,
+  globtype,globals,verbose,
+  aasmbase,aasmtai,
   cpubase,cpuinfo,cgbase;
   cpubase,cpuinfo,cgbase;
 
 
     const
     const
@@ -39,54 +40,52 @@ uses
 
 
 
 
     type
     type
-      taicpu = class(taicpu_abstract)
+      taicpu = class(tai_cpu_abstract)
          constructor op_none(op : tasmop);
          constructor op_none(op : tasmop);
 
 
          constructor op_reg(op : tasmop;_op1 : tregister);
          constructor op_reg(op : tasmop;_op1 : tregister);
-         constructor op_const(op : tasmop;_op1 : longint);
+         constructor op_const(op : tasmop;_op1 : aint);
 
 
          constructor op_reg_reg(op : tasmop;_op1,_op2 : tregister);
          constructor op_reg_reg(op : tasmop;_op1,_op2 : tregister);
          constructor op_reg_ref(op : tasmop;_op1 : tregister;const _op2 : treference);
          constructor op_reg_ref(op : tasmop;_op1 : tregister;const _op2 : treference);
-         constructor op_reg_const(op:tasmop; _op1: tregister; _op2: longint);
-         constructor op_const_reg(op:tasmop; _op1: longint; _op2: tregister);
+         constructor op_reg_const(op:tasmop; _op1: tregister; _op2: aint);
+         constructor op_const_reg(op:tasmop; _op1: aint; _op2: tregister);
 
 
-         constructor op_const_const(op : tasmop;_op1,_op2 : longint);
+         constructor op_const_const(op : tasmop;_op1,_op2 : aint);
 
 
          constructor op_reg_reg_reg(op : tasmop;_op1,_op2,_op3 : tregister);
          constructor op_reg_reg_reg(op : tasmop;_op1,_op2,_op3 : tregister);
-         constructor op_reg_reg_const(op : tasmop;_op1,_op2 : tregister; _op3: Longint);
-         constructor op_reg_reg_sym_ofs(op : tasmop;_op1,_op2 : tregister; _op3: tasmsymbol;_op3ofs: longint);
+         constructor op_reg_reg_const(op : tasmop;_op1,_op2 : tregister; _op3: aint);
+         constructor op_reg_reg_sym_ofs(op : tasmop;_op1,_op2 : tregister; _op3: tasmsymbol;_op3ofs: aint);
          constructor op_reg_reg_ref(op : tasmop;_op1,_op2 : tregister; const _op3: treference);
          constructor op_reg_reg_ref(op : tasmop;_op1,_op2 : tregister; const _op3: treference);
-         constructor op_const_reg_reg(op : tasmop;_op1 : longint;_op2, _op3 : tregister);
-         constructor op_const_reg_const(op : tasmop;_op1 : longint;_op2 : tregister;_op3 : longint);
-         constructor op_const_const_const(op : tasmop;_op1 : longint;_op2 : longint;_op3 : longint);
+         constructor op_const_reg_reg(op : tasmop;_op1 : aint;_op2, _op3 : tregister);
+         constructor op_const_reg_const(op : tasmop;_op1 : aint;_op2 : tregister;_op3 : aint);
+         constructor op_const_const_const(op : tasmop;_op1 : aint;_op2 : aint;_op3 : aint);
 
 
          constructor op_reg_reg_reg_reg(op : tasmop;_op1,_op2,_op3,_op4 : tregister);
          constructor op_reg_reg_reg_reg(op : tasmop;_op1,_op2,_op3,_op4 : tregister);
          constructor op_reg_bool_reg_reg(op : tasmop;_op1: tregister;_op2:boolean;_op3,_op4:tregister);
          constructor op_reg_bool_reg_reg(op : tasmop;_op1: tregister;_op2:boolean;_op3,_op4:tregister);
-         constructor op_reg_bool_reg_const(op : tasmop;_op1: tregister;_op2:boolean;_op3:tregister;_op4: longint);
+         constructor op_reg_bool_reg_const(op : tasmop;_op1: tregister;_op2:boolean;_op3:tregister;_op4: aint);
 
 
-         constructor op_reg_reg_reg_const_const(op : tasmop;_op1,_op2,_op3 : tregister;_op4,_op5 : Longint);
-         constructor op_reg_reg_const_const_const(op : tasmop;_op1,_op2 : tregister;_op3,_op4,_op5 : Longint);
+         constructor op_reg_reg_reg_const_const(op : tasmop;_op1,_op2,_op3 : tregister;_op4,_op5 : aint);
+         constructor op_reg_reg_const_const_const(op : tasmop;_op1,_op2 : tregister;_op3,_op4,_op5 : aint);
 
 
 
 
          { this is for Jmp instructions }
          { this is for Jmp instructions }
          constructor op_cond_sym(op : tasmop;cond:TAsmCond;_op1 : tasmsymbol);
          constructor op_cond_sym(op : tasmop;cond:TAsmCond;_op1 : tasmsymbol);
-         constructor op_const_const_sym(op : tasmop;_op1,_op2 : longint;_op3: tasmsymbol);
+         constructor op_const_const_sym(op : tasmop;_op1,_op2 : aint;_op3: tasmsymbol);
 
 
 
 
          constructor op_sym(op : tasmop;_op1 : tasmsymbol);
          constructor op_sym(op : tasmop;_op1 : tasmsymbol);
-         constructor op_sym_ofs(op : tasmop;_op1 : tasmsymbol;_op1ofs:longint);
-         constructor op_reg_sym_ofs(op : tasmop;_op1 : tregister;_op2:tasmsymbol;_op2ofs : longint);
-         constructor op_sym_ofs_ref(op : tasmop;_op1 : tasmsymbol;_op1ofs:longint;const _op2 : treference);
+         constructor op_sym_ofs(op : tasmop;_op1 : tasmsymbol;_op1ofs:aint);
+         constructor op_reg_sym_ofs(op : tasmop;_op1 : tregister;_op2:tasmsymbol;_op2ofs : aint);
+         constructor op_sym_ofs_ref(op : tasmop;_op1 : tasmsymbol;_op1ofs:aint;const _op2 : treference);
 
 
-         procedure loadbool(opidx:longint;_b:boolean);
+         procedure loadbool(opidx:aint;_b:boolean);
 
 
 
 
          function is_same_reg_move(regtype: Tregistertype):boolean; override;
          function is_same_reg_move(regtype: Tregistertype):boolean; override;
 
 
          { register spilling code }
          { register spilling code }
-         function spilling_get_operation_type(opnr: longint): topertype;override;
-         function spilling_create_load(const ref:treference;r:tregister): tai;override;
-         function spilling_create_store(r:tregister; const ref:treference): tai;override;
+         function spilling_get_operation_type(opnr: aint): topertype;override;
       end;
       end;
 
 
       tai_align = class(tai_align_abstract)
       tai_align = class(tai_align_abstract)
@@ -97,6 +96,9 @@ uses
     procedure DoneAsm;
     procedure DoneAsm;
 
 
 
 
+    function spilling_create_load(const ref:treference;r:tregister): tai;
+    function spilling_create_store(r:tregister; const ref:treference): tai;
+
 implementation
 implementation
 
 
 uses cutils,rgobj;
 uses cutils,rgobj;
@@ -105,7 +107,7 @@ uses cutils,rgobj;
                                  taicpu Constructors
                                  taicpu Constructors
 *****************************************************************************}
 *****************************************************************************}
 
 
-    procedure taicpu.loadbool(opidx:longint;_b:boolean);
+    procedure taicpu.loadbool(opidx:aint;_b:boolean);
       begin
       begin
         if opidx>=ops then
         if opidx>=ops then
          ops:=opidx+1;
          ops:=opidx+1;
@@ -133,11 +135,11 @@ uses cutils,rgobj;
       end;
       end;
 
 
 
 
-    constructor taicpu.op_const(op : tasmop;_op1 : longint);
+    constructor taicpu.op_const(op : tasmop;_op1 : aint);
       begin
       begin
          inherited create(op);
          inherited create(op);
          ops:=1;
          ops:=1;
-         loadconst(0,aword(_op1));
+         loadconst(0,_op1);
       end;
       end;
 
 
 
 
@@ -149,19 +151,19 @@ uses cutils,rgobj;
          loadreg(1,_op2);
          loadreg(1,_op2);
       end;
       end;
 
 
-    constructor taicpu.op_reg_const(op:tasmop; _op1: tregister; _op2: longint);
+    constructor taicpu.op_reg_const(op:tasmop; _op1: tregister; _op2: aint);
       begin
       begin
          inherited create(op);
          inherited create(op);
          ops:=2;
          ops:=2;
          loadreg(0,_op1);
          loadreg(0,_op1);
-         loadconst(1,aword(_op2));
+         loadconst(1,_op2);
       end;
       end;
 
 
-     constructor taicpu.op_const_reg(op:tasmop; _op1: longint; _op2: tregister);
+     constructor taicpu.op_const_reg(op:tasmop; _op1: aint; _op2: tregister);
       begin
       begin
          inherited create(op);
          inherited create(op);
          ops:=2;
          ops:=2;
-         loadconst(0,aword(_op1));
+         loadconst(0,_op1);
          loadreg(1,_op2);
          loadreg(1,_op2);
       end;
       end;
 
 
@@ -175,12 +177,12 @@ uses cutils,rgobj;
       end;
       end;
 
 
 
 
-    constructor taicpu.op_const_const(op : tasmop;_op1,_op2 : longint);
+    constructor taicpu.op_const_const(op : tasmop;_op1,_op2 : aint);
       begin
       begin
          inherited create(op);
          inherited create(op);
          ops:=2;
          ops:=2;
-         loadconst(0,aword(_op1));
-         loadconst(1,aword(_op2));
+         loadconst(0,_op1);
+         loadconst(1,_op2);
       end;
       end;
 
 
 
 
@@ -193,16 +195,16 @@ uses cutils,rgobj;
          loadreg(2,_op3);
          loadreg(2,_op3);
       end;
       end;
 
 
-     constructor taicpu.op_reg_reg_const(op : tasmop;_op1,_op2 : tregister; _op3: Longint);
+     constructor taicpu.op_reg_reg_const(op : tasmop;_op1,_op2 : tregister; _op3: aint);
        begin
        begin
          inherited create(op);
          inherited create(op);
          ops:=3;
          ops:=3;
          loadreg(0,_op1);
          loadreg(0,_op1);
          loadreg(1,_op2);
          loadreg(1,_op2);
-         loadconst(2,aword(_op3));
+         loadconst(2,_op3);
       end;
       end;
 
 
-     constructor taicpu.op_reg_reg_sym_ofs(op : tasmop;_op1,_op2 : tregister; _op3: tasmsymbol;_op3ofs: longint);
+     constructor taicpu.op_reg_reg_sym_ofs(op : tasmop;_op1,_op2 : tregister; _op3: tasmsymbol;_op3ofs: aint);
        begin
        begin
          inherited create(op);
          inherited create(op);
          ops:=3;
          ops:=3;
@@ -220,32 +222,32 @@ uses cutils,rgobj;
          loadref(2,_op3);
          loadref(2,_op3);
       end;
       end;
 
 
-    constructor taicpu.op_const_reg_reg(op : tasmop;_op1 : longint;_op2, _op3 : tregister);
+    constructor taicpu.op_const_reg_reg(op : tasmop;_op1 : aint;_op2, _op3 : tregister);
       begin
       begin
          inherited create(op);
          inherited create(op);
          ops:=3;
          ops:=3;
-         loadconst(0,aword(_op1));
+         loadconst(0,_op1);
          loadreg(1,_op2);
          loadreg(1,_op2);
          loadreg(2,_op3);
          loadreg(2,_op3);
       end;
       end;
 
 
-     constructor taicpu.op_const_reg_const(op : tasmop;_op1 : longint;_op2 : tregister;_op3 : longint);
+     constructor taicpu.op_const_reg_const(op : tasmop;_op1 : aint;_op2 : tregister;_op3 : aint);
       begin
       begin
          inherited create(op);
          inherited create(op);
          ops:=3;
          ops:=3;
-         loadconst(0,aword(_op1));
+         loadconst(0,_op1);
          loadreg(1,_op2);
          loadreg(1,_op2);
-         loadconst(2,aword(_op3));
+         loadconst(2,_op3);
       end;
       end;
 
 
 
 
-     constructor taicpu.op_const_const_const(op : tasmop;_op1 : longint;_op2 : longint;_op3 : longint);
+     constructor taicpu.op_const_const_const(op : tasmop;_op1 : aint;_op2 : aint;_op3 : aint);
       begin
       begin
          inherited create(op);
          inherited create(op);
          ops:=3;
          ops:=3;
-         loadconst(0,aword(_op1));
-         loadconst(1,aword(_op2));
-         loadconst(2,aword(_op3));
+         loadconst(0,_op1);
+         loadconst(1,_op2);
+         loadconst(2,_op3);
       end;
       end;
 
 
 
 
@@ -269,7 +271,7 @@ uses cutils,rgobj;
          loadreg(3,_op4);
          loadreg(3,_op4);
       end;
       end;
 
 
-     constructor taicpu.op_reg_bool_reg_const(op : tasmop;_op1: tregister;_op2:boolean;_op3:tregister;_op4: longint);
+     constructor taicpu.op_reg_bool_reg_const(op : tasmop;_op1: tregister;_op2:boolean;_op3:tregister;_op4: aint);
       begin
       begin
          inherited create(op);
          inherited create(op);
          ops:=4;
          ops:=4;
@@ -280,7 +282,7 @@ uses cutils,rgobj;
       end;
       end;
 
 
 
 
-     constructor taicpu.op_reg_reg_reg_const_const(op : tasmop;_op1,_op2,_op3 : tregister;_op4,_op5 : Longint);
+     constructor taicpu.op_reg_reg_reg_const_const(op : tasmop;_op1,_op2,_op3 : tregister;_op4,_op5 : aint);
       begin
       begin
          inherited create(op);
          inherited create(op);
          ops:=5;
          ops:=5;
@@ -291,15 +293,15 @@ uses cutils,rgobj;
          loadconst(4,cardinal(_op5));
          loadconst(4,cardinal(_op5));
       end;
       end;
 
 
-     constructor taicpu.op_reg_reg_const_const_const(op : tasmop;_op1,_op2 : tregister;_op3,_op4,_op5 : Longint);
+     constructor taicpu.op_reg_reg_const_const_const(op : tasmop;_op1,_op2 : tregister;_op3,_op4,_op5 : aint);
       begin
       begin
          inherited create(op);
          inherited create(op);
          ops:=5;
          ops:=5;
          loadreg(0,_op1);
          loadreg(0,_op1);
          loadreg(1,_op2);
          loadreg(1,_op2);
-         loadconst(2,aword(_op3));
-         loadconst(3,cardinal(_op4));
-         loadconst(4,cardinal(_op5));
+         loadconst(2,_op3);
+         loadconst(3,_op4);
+         loadconst(4,_op5);
       end;
       end;
 
 
     constructor taicpu.op_cond_sym(op : tasmop;cond:TAsmCond;_op1 : tasmsymbol);
     constructor taicpu.op_cond_sym(op : tasmop;cond:TAsmCond;_op1 : tasmsymbol);
@@ -310,12 +312,12 @@ uses cutils,rgobj;
          loadsymbol(0,_op1,0);
          loadsymbol(0,_op1,0);
       end;
       end;
 
 
-     constructor taicpu.op_const_const_sym(op : tasmop;_op1,_op2 : longint; _op3: tasmsymbol);
+     constructor taicpu.op_const_const_sym(op : tasmop;_op1,_op2 : aint; _op3: tasmsymbol);
       begin
       begin
          inherited create(op);
          inherited create(op);
          ops:=3;
          ops:=3;
-         loadconst(0,aword(_op1));
-         loadconst(1,aword(_op2));
+         loadconst(0,_op1);
+         loadconst(1,_op2);
          loadsymbol(2,_op3,0);
          loadsymbol(2,_op3,0);
       end;
       end;
 
 
@@ -328,7 +330,7 @@ uses cutils,rgobj;
       end;
       end;
 
 
 
 
-    constructor taicpu.op_sym_ofs(op : tasmop;_op1 : tasmsymbol;_op1ofs:longint);
+    constructor taicpu.op_sym_ofs(op : tasmop;_op1 : tasmsymbol;_op1ofs:aint);
       begin
       begin
          inherited create(op);
          inherited create(op);
          ops:=1;
          ops:=1;
@@ -336,7 +338,7 @@ uses cutils,rgobj;
       end;
       end;
 
 
 
 
-     constructor taicpu.op_reg_sym_ofs(op : tasmop;_op1 : tregister;_op2:tasmsymbol;_op2ofs : longint);
+     constructor taicpu.op_reg_sym_ofs(op : tasmop;_op1 : tregister;_op2:tasmsymbol;_op2ofs : aint);
       begin
       begin
          inherited create(op);
          inherited create(op);
          ops:=2;
          ops:=2;
@@ -345,7 +347,7 @@ uses cutils,rgobj;
       end;
       end;
 
 
 
 
-    constructor taicpu.op_sym_ofs_ref(op : tasmop;_op1 : tasmsymbol;_op1ofs:longint;const _op2 : treference);
+    constructor taicpu.op_sym_ofs_ref(op : tasmop;_op1 : tasmsymbol;_op1ofs:aint;const _op2 : treference);
       begin
       begin
          inherited create(op);
          inherited create(op);
          ops:=2;
          ops:=2;
@@ -368,7 +370,7 @@ uses cutils,rgobj;
       end;
       end;
 
 
 
 
-    function taicpu.spilling_get_operation_type(opnr: longint): topertype;
+    function taicpu.spilling_get_operation_type(opnr: aint): topertype;
       begin
       begin
         result := operand_read;
         result := operand_read;
         case opcode of
         case opcode of
@@ -384,13 +386,13 @@ uses cutils,rgobj;
       end;
       end;
 
 
 
 
-    function taicpu.spilling_create_load(const ref:treference;r:tregister): tai;
+    function spilling_create_load(const ref:treference;r:tregister): tai;
       begin
       begin
         result:=taicpu.op_reg_ref(A_LWZ,r,ref);
         result:=taicpu.op_reg_ref(A_LWZ,r,ref);
       end;
       end;
 
 
 
 
-    function taicpu.spilling_create_store(r:tregister; const ref:treference): tai;
+    function spilling_create_store(r:tregister; const ref:treference): tai;
       begin
       begin
         result:=taicpu.op_reg_ref(A_STW,r,ref);
         result:=taicpu.op_reg_ref(A_STW,r,ref);
       end;
       end;
@@ -408,7 +410,10 @@ uses cutils,rgobj;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.25  2004-02-08 23:10:21  jonas
+  Revision 1.26  2004-06-17 16:55:46  peter
+    * powerpc compiles again
+
+  Revision 1.25  2004/02/08 23:10:21  jonas
     * taicpu.is_same_reg_move() now gets a regtype parameter so it only
     * taicpu.is_same_reg_move() now gets a regtype parameter so it only
       removes moves of that particular register type. This is necessary so
       removes moves of that particular register type. This is necessary so
       we don't remove the live_start instruction of a register before it
       we don't remove the live_start instruction of a register before it

+ 6 - 17
compiler/powerpc/agppcgas.pas

@@ -73,16 +73,9 @@ unit agppcgas;
             asmbin : 'as';
             asmbin : 'as';
             asmcmd : '-o $OBJ $ASM';
             asmcmd : '-o $OBJ $ASM';
             supported_target : system_any;
             supported_target : system_any;
-            outputbinary: false;
-            allowdirect : true;
-            needar : true;
-            labelprefix_only_inside_procedure : false;
+            flags : [af_allowdirect,af_needar,af_smartlink_sections];
             labelprefix : '.L';
             labelprefix : '.L';
             comment : '# ';
             comment : '# ';
-            secnames : ('',
-              '.text','.data','.text',
-              '','','','','','',
-              '.stab','.stabstr','COMMON')
           );
           );
 
 
 
 
@@ -94,16 +87,9 @@ unit agppcgas;
             asmbin : 'as';
             asmbin : 'as';
             asmcmd : '-o $OBJ $ASM';
             asmcmd : '-o $OBJ $ASM';
             supported_target : system_any;
             supported_target : system_any;
-            outputbinary: false;
-            allowdirect : true;
-            needar : true;
-            labelprefix_only_inside_procedure : false;
+            flags : [af_allowdirect,af_needar,af_smartlink_sections];
             labelprefix : 'L';
             labelprefix : 'L';
             comment : '# ';
             comment : '# ';
-            secnames : ('',
-              '.text','.data','.text',
-              '','','','','','',
-              '.stab','.stabstr','COMMON')
           );
           );
 
 
 
 
@@ -379,7 +365,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.42  2004-03-02 17:32:12  florian
+  Revision 1.43  2004-06-17 16:55:46  peter
+    * powerpc compiles again
+
+  Revision 1.42  2004/03/02 17:32:12  florian
     * make cycle fixed
     * make cycle fixed
     + pic support for darwin
     + pic support for darwin
     + support of importing vars from shared libs on darwin implemented
     + support of importing vars from shared libs on darwin implemented

+ 60 - 76
compiler/powerpc/agppcmpw.pas

@@ -72,7 +72,10 @@ interface
 
 
       const_storage_class = '[RW]';
       const_storage_class = '[RW]';
 
 
-
+      secnames : array[TAsmSectionType] of string[10] = ('',
+        'csect','csect [TC]','csect [TC]',  {TODO: Perhaps use other section types.}
+        '','','','','','','','','','','','',''
+      );
 
 
 {$ifdef GDB}
 {$ifdef GDB}
 var
 var
@@ -624,7 +627,7 @@ var
     end;
     end;
 
 
     var
     var
-      LasTSec : TSection;
+      LasTSec : TAsmSectionType;
       lastfileinfo : tfileposinfo;
       lastfileinfo : tfileposinfo;
       infile,
       infile,
       lastinfile   : tinputfile;
       lastinfile   : tinputfile;
@@ -834,15 +837,15 @@ var
               begin
               begin
                  {if LasTSec<>sec_none then
                  {if LasTSec<>sec_none then
                   AsmWriteLn('_'+target_asm.secnames[LasTSec]+#9#9'ENDS');}
                   AsmWriteLn('_'+target_asm.secnames[LasTSec]+#9#9'ENDS');}
-                 if tai_section(hp).sec<>sec_none then
+                 if tai_section(hp).sectype<>sec_none then
                   begin
                   begin
                     AsmLn;
                     AsmLn;
-                    AsmWriteLn(#9+target_asm.secnames[tai_section(hp).sec]);
+                    AsmWriteLn(#9+secnames[tai_section(hp).sectype]);
 {$ifdef GDB}
 {$ifdef GDB}
                   lastfileinfo.line:=-1;
                   lastfileinfo.line:=-1;
 {$endif GDB}
 {$endif GDB}
                   end;
                   end;
-                 LasTSec:=tai_section(hp).sec;
+                 LasTSec:=tai_section(hp).sectype;
                end;
                end;
             ait_align:
             ait_align:
               begin
               begin
@@ -869,64 +872,49 @@ var
                      {TODO: ? PadTabs(s,#0) }
                      {TODO: ? PadTabs(s,#0) }
                    end;
                    end;
               end;
               end;
-            ait_const_32bit,
-            ait_const_8bit,
-            ait_const_16bit :
-              begin
-                 AsmWrite(ait_const2str[hp.typ]+tostr(tai_const(hp).value));
-                 consttyp:=hp.typ;
-                 l:=0;
-                 repeat
-                   found:=(not (tai(hp.next)=nil)) and (tai(hp.next).typ=consttyp);
-                   if found then
-                    begin
-                      hp:=tai(hp.next);
-                      s:=','+tostr(tai_const(hp).value);
-                      AsmWrite(s);
-                      inc(l,length(s));
-                    end;
-                 until (not found) or (l>line_length);
-                 AsmLn;
-               end;
-            ait_const_symbol:
-              begin
-                s:= tai_const_symbol(hp).sym.name;
-                ReplaceForbiddenChars(s);
-
-                AsmWrite(#9'dc.l'#9);
-                if tai_const_symbol(hp).sym.typ = AT_FUNCTION then
-                  begin
-                    if use_PR then
-                      AsmWrite('.');
-
-                    AsmWrite(s);
-
-                    if use_PR then
-                      AsmWriteLn('[PR]')
-                    else
-                      AsmWriteLn('[DS]')
-                  end
-                else
-                  begin
-                    AsmWrite(s);
-                    if not macos_direct_globals then
-                      AsmWriteLn(const_storage_class);
-                  end;
-
-                (* TODO: the following might need to be included. Temporaily we
-                generate an error
-
-                if tai_const_symbol(hp).offset>0 then
-                  AsmWrite('+'+tostr(tai_const_symbol(hp).offset))
-                else if tai_const_symbol(hp).offset<0 then
-                  AsmWrite(tostr(tai_const_symbol(hp).offset));
-                *)
-
-                if tai_const_symbol(hp).offset <> 0 then
-                  InternalError(2002110101);
+           ait_const_uleb128bit,
+           ait_const_sleb128bit,
+           ait_const_128bit,
+           ait_const_64bit,
+           ait_const_32bit,
+           ait_const_16bit,
+           ait_const_8bit,
+           ait_const_rva_symbol,
+           ait_const_indirect_symbol :
+             begin
+               AsmWrite(ait_const2str[hp.typ]);
+               consttyp:=hp.typ;
+               l:=0;
+               repeat
+                 if assigned(tai_const(hp).sym) then
+                   begin
+                     if use_PR then
+                       AsmWrite('.');
+                     if assigned(tai_const(hp).endsym) then
+                       s:=tai_const(hp).endsym.name+'-'+tai_const(hp).sym.name
+                     else
+                       s:=tai_const(hp).sym.name;
+                     ReplaceForbiddenChars(s);
+                     if tai_const(hp).value<>0 then
+                       InternalError(2002110101);
+                     if use_PR then
+                       AsmWriteLn('[PR]')
+                     else
+                       AsmWriteLn('[DS]');
+                   end
+                 else
+                   s:=tostr(tai_const(hp).value);
+                 AsmWrite(s);
+                 if (l>line_length) or
+                    (hp.next=nil) or
+                    (tai(hp.next).typ<>consttyp) then
+                   break;
+                 hp:=tai(hp.next);
+                 AsmWrite(',');
+               until false;
+               AsmLn;
+             end;
 
 
-                AsmLn;
-              end;
             ait_real_32bit:
             ait_real_32bit:
               AsmWriteLn(#9'dc.l'#9'"'+single2str(tai_real_32bit(hp).value)+'"');
               AsmWriteLn(#9'dc.l'#9'"'+single2str(tai_real_32bit(hp).value)+'"');
             ait_real_64bit:
             ait_real_64bit:
@@ -1094,7 +1082,7 @@ var
 
 
               ait_stab_function_name: ;
               ait_stab_function_name: ;
 {$endif GDB}
 {$endif GDB}
-              ait_cut :
+              ait_cutobject :
                 begin
                 begin
                      { only reset buffer if nothing has changed }
                      { only reset buffer if nothing has changed }
                        if AsmSize=AsmStartSize then
                        if AsmSize=AsmStartSize then
@@ -1109,21 +1097,21 @@ var
                           AsmWriteLn(#9'end');
                           AsmWriteLn(#9'end');
                           AsmClose;
                           AsmClose;
                           DoAssemble;
                           DoAssemble;
-                          AsmCreate(tai_cut(hp).place);
+                          AsmCreate(tai_cutobject(hp).place);
                         end;
                         end;
                      { avoid empty files }
                      { avoid empty files }
-                       while assigned(hp.next) and (tai(hp.next).typ in [ait_cut,ait_section,ait_comment]) do
+                       while assigned(hp.next) and (tai(hp.next).typ in [ait_cutobject,ait_section,ait_comment]) do
                         begin
                         begin
                           if tai(hp.next).typ=ait_section then
                           if tai(hp.next).typ=ait_section then
                            begin
                            begin
-                             lasTSec:=tai_section(hp.next).sec;
+                             lasTSec:=tai_section(hp.next).sectype;
                            end;
                            end;
                           hp:=tai(hp.next);
                           hp:=tai(hp.next);
                         end;
                         end;
                        WriteAsmFileHeader;
                        WriteAsmFileHeader;
 
 
                        if lasTSec<>sec_none then
                        if lasTSec<>sec_none then
-                         AsmWriteLn(#9+target_asm.secnames[lasTSec]);
+                         AsmWriteLn(#9+secnames[lasTSec]);
                        {   AsmWriteLn('_'+target_asm.secnames[lasTSec]+#9#9+
                        {   AsmWriteLn('_'+target_asm.secnames[lasTSec]+#9#9+
                                      'SEGMENT'#9'PARA PUBLIC USE32 '''+
                                      'SEGMENT'#9'PARA PUBLIC USE32 '''+
                                      target_asm.secnames[lasTSec]+'''');
                                      target_asm.secnames[lasTSec]+'''');
@@ -1345,16 +1333,9 @@ var
             asmbin : 'PPCAsm';
             asmbin : 'PPCAsm';
             asmcmd : '-case on $ASM -o $OBJ';
             asmcmd : '-case on $ASM -o $OBJ';
             supported_target : system_any; { what should I write here ?? }
             supported_target : system_any; { what should I write here ?? }
-            outputbinary: false;
-            allowdirect : true;
-            needar : true;
-            labelprefix_only_inside_procedure : true;
+            flags : [af_allowdirect,af_needar,af_smartlink_sections,af_labelprefix_only_inside_procedure];
             labelprefix : '@';
             labelprefix : '@';
             comment : '; ';
             comment : '; ';
-            secnames : ('',
-              'csect','csect [TC]','csect [TC]',  {TODO: Perhaps use other section types.}
-              '','','','','','',
-              '','','')
           );
           );
 
 
 initialization
 initialization
@@ -1362,7 +1343,10 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.34  2004-03-17 12:03:31  olle
+  Revision 1.35  2004-06-17 16:55:46  peter
+    * powerpc compiles again
+
+  Revision 1.34  2004/03/17 12:03:31  olle
     * bugfix for multiline string constants
     * bugfix for multiline string constants
 
 
   Revision 1.33  2004/03/02 00:57:01  olle
   Revision 1.33  2004/03/02 00:57:01  olle

+ 50 - 63
compiler/powerpc/cgcpu.pas

@@ -27,7 +27,7 @@ unit cgcpu;
   interface
   interface
 
 
     uses
     uses
-       symtype,
+       globtype,symtype,
        cgbase,cgobj,
        cgbase,cgobj,
        aasmbase,aasmcpu,aasmtai,
        aasmbase,aasmcpu,aasmtai,
        cpubase,cpuinfo,node,cg64f32,rgcpu;
        cpubase,cpuinfo,node,cg64f32,rgcpu;
@@ -44,7 +44,7 @@ unit cgcpu;
         { left to right), this allows to move the parameter to    }
         { left to right), this allows to move the parameter to    }
         { register, if the cpu supports register calling          }
         { register, if the cpu supports register calling          }
         { conventions                                             }
         { conventions                                             }
-        procedure a_param_const(list : taasmoutput;size : tcgsize;a : aword;const locpara : tparalocation);override;
+        procedure a_param_const(list : taasmoutput;size : tcgsize;a : aint;const locpara : tparalocation);override;
         procedure a_param_ref(list : taasmoutput;size : tcgsize;const r : treference;const locpara : tparalocation);override;
         procedure a_param_ref(list : taasmoutput;size : tcgsize;const r : treference;const locpara : tparalocation);override;
         procedure a_paramaddr_ref(list : taasmoutput;const r : treference;const locpara : tparalocation);override;
         procedure a_paramaddr_ref(list : taasmoutput;const r : treference;const locpara : tparalocation);override;
 
 
@@ -52,16 +52,16 @@ unit cgcpu;
         procedure a_call_name(list : taasmoutput;const s : string);override;
         procedure a_call_name(list : taasmoutput;const s : string);override;
         procedure a_call_reg(list : taasmoutput;reg: tregister); override;
         procedure a_call_reg(list : taasmoutput;reg: tregister); override;
 
 
-        procedure a_op_const_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; a: AWord; reg: TRegister); override;
+        procedure a_op_const_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; a: aint; reg: TRegister); override;
         procedure a_op_reg_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; src, dst: TRegister); override;
         procedure a_op_reg_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; src, dst: TRegister); override;
 
 
         procedure a_op_const_reg_reg(list: taasmoutput; op: TOpCg;
         procedure a_op_const_reg_reg(list: taasmoutput; op: TOpCg;
-          size: tcgsize; a: aword; src, dst: tregister); override;
+          size: tcgsize; a: aint; src, dst: tregister); override;
         procedure a_op_reg_reg_reg(list: taasmoutput; op: TOpCg;
         procedure a_op_reg_reg_reg(list: taasmoutput; op: TOpCg;
           size: tcgsize; src1, src2, dst: tregister); override;
           size: tcgsize; src1, src2, dst: tregister); override;
 
 
         { move instructions }
         { move instructions }
-        procedure a_load_const_reg(list : taasmoutput; size: tcgsize; a : aword;reg : tregister);override;
+        procedure a_load_const_reg(list : taasmoutput; size: tcgsize; a : aint;reg : tregister);override;
         procedure a_load_reg_ref(list : taasmoutput; fromsize, tosize: tcgsize; reg : tregister;const ref : treference);override;
         procedure a_load_reg_ref(list : taasmoutput; fromsize, tosize: tcgsize; reg : tregister;const ref : treference);override;
         procedure a_load_ref_reg(list : taasmoutput; fromsize, tosize : tcgsize;const Ref : treference;reg : tregister);override;
         procedure a_load_ref_reg(list : taasmoutput; fromsize, tosize : tcgsize;const Ref : treference;reg : tregister);override;
         procedure a_load_reg_reg(list : taasmoutput; fromsize, tosize : tcgsize;reg1,reg2 : tregister);override;
         procedure a_load_reg_reg(list : taasmoutput; fromsize, tosize : tcgsize;reg1,reg2 : tregister);override;
@@ -72,7 +72,7 @@ unit cgcpu;
         procedure a_loadfpu_reg_ref(list: taasmoutput; size: tcgsize; reg: tregister; const ref: treference); override;
         procedure a_loadfpu_reg_ref(list: taasmoutput; size: tcgsize; reg: tregister; const ref: treference); override;
 
 
         {  comparison operations }
         {  comparison operations }
-        procedure a_cmp_const_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;a : aword;reg : tregister;
+        procedure a_cmp_const_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;a : aint;reg : tregister;
           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;
 
 
@@ -82,18 +82,17 @@ unit cgcpu;
 
 
         procedure g_flags2reg(list: taasmoutput; size: TCgSize; const f: TResFlags; reg: TRegister); override;
         procedure g_flags2reg(list: taasmoutput; size: TCgSize; const f: TResFlags; reg: TRegister); override;
 
 
-        procedure g_stackframe_entry(list : taasmoutput;localsize : longint);override;
-        procedure g_return_from_proc(list : taasmoutput;parasize : aword); override;
-        procedure g_restore_frame_pointer(list : taasmoutput);override;
+        procedure g_proc_entry(list : taasmoutput;localsize : longint;nostackframe:boolean);override;
+        procedure g_proc_exit(list : taasmoutput;parasize : longint;nostackframe:boolean); override;
 
 
         procedure a_loadaddr_ref_reg(list : taasmoutput;const ref : treference;r : tregister);override;
         procedure a_loadaddr_ref_reg(list : taasmoutput;const ref : treference;r : tregister);override;
 
 
-        procedure g_concatcopy(list : taasmoutput;const source,dest : treference;len : aword; delsource,loadref : boolean);override;
+        procedure g_concatcopy(list : taasmoutput;const source,dest : treference;len : aint; delsource,loadref : boolean);override;
 
 
         procedure g_overflowcheck(list: taasmoutput; const l: tlocation; def: tdef); override;
         procedure g_overflowcheck(list: taasmoutput; const l: tlocation; def: tdef); override;
         { find out whether a is of the form 11..00..11b or 00..11...00. If }
         { find out whether a is of the form 11..00..11b or 00..11...00. If }
         { that's the case, we can use rlwinm to do an AND operation        }
         { that's the case, we can use rlwinm to do an AND operation        }
-        function get_rlwi_const(a: aword; var l1, l2: longint): boolean;
+        function get_rlwi_const(a: aint; var l1, l2: longint): boolean;
 
 
         procedure g_save_standard_registers(list:Taasmoutput);override;
         procedure g_save_standard_registers(list:Taasmoutput);override;
         procedure g_restore_standard_registers(list:Taasmoutput);override;
         procedure g_restore_standard_registers(list:Taasmoutput);override;
@@ -107,7 +106,7 @@ unit cgcpu;
         (* NOT IN USE: *)
         (* NOT IN USE: *)
         procedure g_stackframe_entry_mac(list : taasmoutput;localsize : longint);
         procedure g_stackframe_entry_mac(list : taasmoutput;localsize : longint);
         (* NOT IN USE: *)
         (* NOT IN USE: *)
-        procedure g_return_from_proc_mac(list : taasmoutput;parasize : aword);
+        procedure g_return_from_proc_mac(list : taasmoutput;parasize : aint);
 
 
 
 
         { Make sure ref is a valid reference for the PowerPC and sets the }
         { Make sure ref is a valid reference for the PowerPC and sets the }
@@ -133,14 +132,14 @@ unit cgcpu;
 
 
         function save_regs(list : taasmoutput):longint;
         function save_regs(list : taasmoutput):longint;
         procedure restore_regs(list : taasmoutput);
         procedure restore_regs(list : taasmoutput);
-        
+
         function get_darwin_call_stub(const s: string): tasmsymbol;
         function get_darwin_call_stub(const s: string): tasmsymbol;
      end;
      end;
 
 
      tcg64fppc = class(tcg64f32)
      tcg64fppc = class(tcg64f32)
        procedure a_op64_reg_reg(list : taasmoutput;op:TOpCG;regsrc,regdst : tregister64);override;
        procedure a_op64_reg_reg(list : taasmoutput;op:TOpCG;regsrc,regdst : tregister64);override;
-       procedure a_op64_const_reg(list : taasmoutput;op:TOpCG;value : qword;reg : tregister64);override;
-       procedure a_op64_const_reg_reg(list: taasmoutput;op:TOpCG;value : qword;regsrc,regdst : tregister64);override;
+       procedure a_op64_const_reg(list : taasmoutput;op:TOpCG;value : int64;reg : tregister64);override;
+       procedure a_op64_const_reg_reg(list: taasmoutput;op:TOpCG;value : int64;regsrc,regdst : tregister64);override;
        procedure a_op64_reg_reg_reg(list: taasmoutput;op:TOpCG;regsrc1,regsrc2,regdst : tregister64);override;
        procedure a_op64_reg_reg_reg(list: taasmoutput;op:TOpCG;regsrc1,regsrc2,regdst : tregister64);override;
      end;
      end;
 
 
@@ -159,7 +158,7 @@ const
   implementation
   implementation
 
 
     uses
     uses
-       globtype,globals,verbose,systems,cutils,
+       globals,verbose,systems,cutils,
        symconst,symdef,symsym,
        symconst,symdef,symsym,
        rgobj,tgobj,cpupi,procinfo,paramgr,
        rgobj,tgobj,cpupi,procinfo,paramgr,
        cgutils;
        cgutils;
@@ -235,7 +234,7 @@ const
       end;
       end;
 
 
 
 
-    procedure tcgppc.a_param_const(list : taasmoutput;size : tcgsize;a : aword;const locpara : tparalocation);
+    procedure tcgppc.a_param_const(list : taasmoutput;size : tcgsize;a : aint;const locpara : tparalocation);
       var
       var
         ref: treference;
         ref: treference;
       begin
       begin
@@ -332,7 +331,7 @@ const
         if not(assigned(importssection)) then
         if not(assigned(importssection)) then
           importssection:=TAAsmoutput.create;
           importssection:=TAAsmoutput.create;
 
 
-        importsSection.concat(Tai_section.Create(sec_data));
+        importsSection.concat(Tai_section.Create(sec_data,'',0));
         importsSection.concat(Tai_direct.create(strpnew('.section __TEXT,__symbol_stub1,symbol_stubs,pure_instructions,16')));
         importsSection.concat(Tai_direct.create(strpnew('.section __TEXT,__symbol_stub1,symbol_stubs,pure_instructions,16')));
         importsSection.concat(Tai_align.Create(4));
         importsSection.concat(Tai_align.Create(4));
         result := objectlibrary.newasmsymbol(stubname,AB_EXTERNAL,AT_FUNCTION);
         result := objectlibrary.newasmsymbol(stubname,AB_EXTERNAL,AT_FUNCTION);
@@ -351,11 +350,11 @@ const
 {$else powerpc}
 {$else powerpc}
         internalerror(2004010502);
         internalerror(2004010502);
 {$endif powerpc}
 {$endif powerpc}
-        importsSection.concat(Tai_section.Create(sec_data));
+        importsSection.concat(Tai_section.Create(sec_data,'',0));
         importsSection.concat(Tai_direct.create(strpnew('.lazy_symbol_pointer')));
         importsSection.concat(Tai_direct.create(strpnew('.lazy_symbol_pointer')));
         importsSection.concat(Tai_symbol.Create(l1,0));
         importsSection.concat(Tai_symbol.Create(l1,0));
         importsSection.concat(Tai_direct.create(strpnew((#9+'.indirect_symbol ')+s)));
         importsSection.concat(Tai_direct.create(strpnew((#9+'.indirect_symbol ')+s)));
-        importsSection.concat(tai_const_symbol.createname(strpnew('dyld_stub_binding_helper'),AT_FUNCTION,0));
+        importsSection.concat(tai_const.createname(strpnew('dyld_stub_binding_helper'),AT_FUNCTION,0));
       end;
       end;
 
 
 
 
@@ -417,7 +416,7 @@ const
 
 
 {********************** load instructions ********************}
 {********************** load instructions ********************}
 
 
-     procedure tcgppc.a_load_const_reg(list : taasmoutput; size: TCGSize; a : aword; reg : TRegister);
+     procedure tcgppc.a_load_const_reg(list : taasmoutput; size: TCGSize; a : aint; reg : TRegister);
 
 
        begin
        begin
           if not(size in [OS_8,OS_S8,OS_16,OS_S16,OS_32,OS_S32]) then
           if not(size in [OS_8,OS_S8,OS_16,OS_S16,OS_32,OS_S32]) then
@@ -602,7 +601,7 @@ const
        end;
        end;
 
 
 
 
-     procedure tcgppc.a_op_const_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; a: AWord; reg: TRegister);
+     procedure tcgppc.a_op_const_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; a: aint; reg: TRegister);
 
 
        begin
        begin
          a_op_const_reg_reg(list,op,size,a,reg,reg);
          a_op_const_reg_reg(list,op,size,a,reg,reg);
@@ -617,7 +616,7 @@ const
 
 
 
 
     procedure tcgppc.a_op_const_reg_reg(list: taasmoutput; op: TOpCg;
     procedure tcgppc.a_op_const_reg_reg(list: taasmoutput; op: TOpCg;
-                       size: tcgsize; a: aword; src, dst: tregister);
+                       size: tcgsize; a: aint; src, dst: tregister);
       var
       var
         l1,l2: longint;
         l1,l2: longint;
         oplo, ophi: tasmop;
         oplo, ophi: tasmop;
@@ -634,15 +633,7 @@ const
       begin
       begin
         if op = OP_SUB then
         if op = OP_SUB then
           begin
           begin
-{$ifopt q+}
-{$q-}
-{$define overflowon}
-{$endif}
-            a_op_const_reg_reg(list,OP_ADD,size,aword(-longint(a)),src,dst);
-{$ifdef overflowon}
-{$q+}
-{$undef overflowon}
-{$endif}
+            a_op_const_reg_reg(list,OP_ADD,size,-a,src,dst);
             exit;
             exit;
           end;
           end;
         ophi := TOpCG2AsmOpConstHi[op];
         ophi := TOpCG2AsmOpConstHi[op];
@@ -658,7 +649,7 @@ const
                   a_load_reg_reg(list,size,size,src,dst);
                   a_load_reg_reg(list,size,size,src,dst);
                 exit;
                 exit;
               end
               end
-            else if (a = high(aword)) then
+            else if (a = high(aint)) then
               begin
               begin
                 case op of
                 case op of
                   OP_OR:
                   OP_OR:
@@ -822,7 +813,7 @@ const
 
 
 {*************** compare instructructions ****************}
 {*************** compare instructructions ****************}
 
 
-      procedure tcgppc.a_cmp_const_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;a : aword;reg : tregister;
+      procedure tcgppc.a_cmp_const_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;a : aint;reg : tregister;
         l : tasmlabel);
         l : tasmlabel);
 
 
         var
         var
@@ -1025,7 +1016,7 @@ const
 
 
 { *********** entry/exit code and address loading ************ }
 { *********** entry/exit code and address loading ************ }
 
 
-    procedure tcgppc.g_stackframe_entry(list : taasmoutput;localsize : longint);
+    procedure tcgppc.g_proc_entry(list : taasmoutput;localsize : longint;nostackframe:boolean);
      { generated the entry code of a procedure/function. Note: localsize is the }
      { generated the entry code of a procedure/function. Note: localsize is the }
      { sum of the size necessary for local variables and the maximum possible   }
      { sum of the size necessary for local variables and the maximum possible   }
      { combined size of ALL the parameters of a procedure called by the current }
      { combined size of ALL the parameters of a procedure called by the current }
@@ -1038,7 +1029,7 @@ const
      var regcounter,firstregfpu,firstreggpr: TSuperRegister;
      var regcounter,firstregfpu,firstreggpr: TSuperRegister;
          href,href2 : treference;
          href,href2 : treference;
          usesfpr,usesgpr,gotgot : boolean;
          usesfpr,usesgpr,gotgot : boolean;
-         parastart : aword;
+         parastart : aint;
 //         r,r2,rsp:Tregister;
 //         r,r2,rsp:Tregister;
          l : tasmlabel;
          l : tasmlabel;
          regcounter2, firstfpureg: Tsuperregister;
          regcounter2, firstfpureg: Tsuperregister;
@@ -1173,7 +1164,7 @@ const
                end;
                end;
 
 
              { compute end of gpr save area }
              { compute end of gpr save area }
-             a_op_const_reg(list,OP_ADD,OS_ADDR,aword(href.offset+8),NR_R12);
+             a_op_const_reg(list,OP_ADD,OS_ADDR,href.offset+8,NR_R12);
           end;
           end;
 
 
         { save gprs and fetch GOT pointer }
         { save gprs and fetch GOT pointer }
@@ -1284,7 +1275,7 @@ const
 
 
       end;
       end;
 
 
-    procedure tcgppc.g_return_from_proc(list : taasmoutput;parasize : aword);
+    procedure tcgppc.g_proc_exit(list : taasmoutput;parasize : longint;nostackframe:boolean);
      { This procedure may be called before, as well as after g_stackframe_entry }
      { This procedure may be called before, as well as after g_stackframe_entry }
      { is called. NOTE registers are not to be allocated through the register   }
      { is called. NOTE registers are not to be allocated through the register   }
      { allocator here, because the register colouring has already occured !!    }
      { allocator here, because the register colouring has already occured !!    }
@@ -1294,7 +1285,7 @@ const
          href : treference;
          href : treference;
          usesfpr,usesgpr,genret : boolean;
          usesfpr,usesgpr,genret : boolean;
          regcounter2, firstfpureg:Tsuperregister;
          regcounter2, firstfpureg:Tsuperregister;
-         localsize: aword;
+         localsize: aint;
       begin
       begin
         { AltiVec context restore, not yet implemented !!! }
         { AltiVec context restore, not yet implemented !!! }
 
 
@@ -1677,7 +1668,7 @@ const
           end;
           end;
       end;
       end;
 
 
-    procedure tcgppc.g_return_from_proc_mac(list : taasmoutput;parasize : aword);
+    procedure tcgppc.g_return_from_proc_mac(list : taasmoutput;parasize : aint);
  (* NOT IN USE *)
  (* NOT IN USE *)
 
 
       var
       var
@@ -1724,13 +1715,6 @@ const
       end;
       end;
 
 
 
 
-    procedure tcgppc.g_restore_frame_pointer(list : taasmoutput);
-
-      begin
-         { no frame pointer on the PowerPC (maybe there is one in the SystemV ABI?)}
-      end;
-
-
      procedure tcgppc.a_loadaddr_ref_reg(list : taasmoutput;const ref : treference;r : tregister);
      procedure tcgppc.a_loadaddr_ref_reg(list : taasmoutput;const ref : treference;r : tregister);
 
 
        var
        var
@@ -1806,7 +1790,7 @@ const
            end
            end
          else if ref2.offset <> 0 Then
          else if ref2.offset <> 0 Then
            if ref2.base <> NR_NO then
            if ref2.base <> NR_NO then
-             a_op_const_reg_reg(list,OP_ADD,OS_32,aword(ref2.offset),ref2.base,r)
+             a_op_const_reg_reg(list,OP_ADD,OS_32,ref2.offset,ref2.base,r)
            { FixRef makes sure that "(ref.index <> R_NO) and (ref.offset <> 0)" never}
            { FixRef makes sure that "(ref.index <> R_NO) and (ref.offset <> 0)" never}
            { occurs, so now only ref.offset has to be loaded                         }
            { occurs, so now only ref.offset has to be loaded                         }
            else
            else
@@ -1832,13 +1816,13 @@ const
     maxmoveunit = 4;
     maxmoveunit = 4;
 {$endif ppc603}
 {$endif ppc603}
 
 
-    procedure tcgppc.g_concatcopy(list : taasmoutput;const source,dest : treference;len : aword; delsource,loadref : boolean);
+    procedure tcgppc.g_concatcopy(list : taasmoutput;const source,dest : treference;len : aint; delsource,loadref : boolean);
 
 
       var
       var
         countreg: TRegister;
         countreg: TRegister;
         src, dst: TReference;
         src, dst: TReference;
         lab: tasmlabel;
         lab: tasmlabel;
-        count, count2: aword;
+        count, count2: aint;
         orgsrc, orgdst: boolean;
         orgsrc, orgdst: boolean;
         size: tcgsize;
         size: tcgsize;
 
 
@@ -2122,11 +2106,11 @@ const
 
 
     { find out whether a is of the form 11..00..11b or 00..11...00. If }
     { find out whether a is of the form 11..00..11b or 00..11...00. If }
     { that's the case, we can use rlwinm to do an AND operation        }
     { that's the case, we can use rlwinm to do an AND operation        }
-    function tcgppc.get_rlwi_const(a: aword; var l1, l2: longint): boolean;
+    function tcgppc.get_rlwi_const(a: aint; var l1, l2: longint): boolean;
 
 
       var
       var
         temp : longint;
         temp : longint;
-        testbit : aword;
+        testbit : aint;
         compare: boolean;
         compare: boolean;
 
 
       begin
       begin
@@ -2224,7 +2208,7 @@ const
 
 
                 if Smallint(Lo(ref.offset)) < 0 then
                 if Smallint(Lo(ref.offset)) < 0 then
                   tmpref.offset := Hi(ref.offset) + 1 {Compensate when lo part is negative}
                   tmpref.offset := Hi(ref.offset) + 1 {Compensate when lo part is negative}
-                else 
+                else
                   tmpref.offset := Hi(ref.offset);
                   tmpref.offset := Hi(ref.offset);
 
 
                 if (tmpreg <> NR_NO) then
                 if (tmpreg <> NR_NO) then
@@ -2305,7 +2289,7 @@ const
       end;
       end;
 
 
 
 
-    procedure tcg64fppc.a_op64_const_reg(list : taasmoutput;op:TOpCG;value : qword;reg : tregister64);
+    procedure tcg64fppc.a_op64_const_reg(list : taasmoutput;op:TOpCG;value : int64;reg : tregister64);
       begin
       begin
         a_op64_const_reg_reg(list,op,value,reg,reg);
         a_op64_const_reg_reg(list,op,value,reg,reg);
       end;
       end;
@@ -2335,7 +2319,7 @@ const
       end;
       end;
 
 
 
 
-    procedure tcg64fppc.a_op64_const_reg_reg(list: taasmoutput;op:TOpCG;value : qword;regsrc,regdst : tregister64);
+    procedure tcg64fppc.a_op64_const_reg_reg(list: taasmoutput;op:TOpCG;value : int64;regsrc,regdst : tregister64);
 
 
       const
       const
         ops: array[boolean,1..3] of tasmop = ((A_ADDIC,A_ADDC,A_ADDZE),
         ops: array[boolean,1..3] of tasmop = ((A_ADDIC,A_ADDC,A_ADDZE),
@@ -2348,25 +2332,25 @@ const
         case op of
         case op of
           OP_AND,OP_OR,OP_XOR:
           OP_AND,OP_OR,OP_XOR:
             begin
             begin
-              cg.a_op_const_reg_reg(list,op,OS_32,aword(value),regsrc.reglo,regdst.reglo);
-              cg.a_op_const_reg_reg(list,op,OS_32,aword(value shr 32),regsrc.reghi,
+              cg.a_op_const_reg_reg(list,op,OS_32,aint(value),regsrc.reglo,regdst.reglo);
+              cg.a_op_const_reg_reg(list,op,OS_32,aint(value shr 32),regsrc.reghi,
                 regdst.reghi);
                 regdst.reghi);
             end;
             end;
           OP_ADD, OP_SUB:
           OP_ADD, OP_SUB:
             begin
             begin
-              if (int64(value) < 0) then
+              if (value < 0) then
                 begin
                 begin
                   if op = OP_ADD then
                   if op = OP_ADD then
                     op := OP_SUB
                     op := OP_SUB
                   else
                   else
                     op := OP_ADD;
                     op := OP_ADD;
-                  int64(value) := -int64(value);
+                  value := -value;
                 end;
                 end;
               if (longint(value) <> 0) then
               if (longint(value) <> 0) then
                 begin
                 begin
                   issub := op = OP_SUB;
                   issub := op = OP_SUB;
-                  if (int64(value) > 0) and
-                     (int64(value)-ord(issub) <= 32767) then
+                  if (value > 0) and
+                     (value-ord(issub) <= 32767) then
                     begin
                     begin
                       list.concat(taicpu.op_reg_reg_const(ops[issub,1],
                       list.concat(taicpu.op_reg_reg_const(ops[issub,1],
                         regdst.reglo,regsrc.reglo,longint(value)));
                         regdst.reglo,regsrc.reglo,longint(value)));
@@ -2396,7 +2380,7 @@ const
               else
               else
                 begin
                 begin
                   cg.a_load_reg_reg(list,OS_INT,OS_INT,regsrc.reglo,regdst.reglo);
                   cg.a_load_reg_reg(list,OS_INT,OS_INT,regsrc.reglo,regdst.reglo);
-                  cg.a_op_const_reg_reg(list,op,OS_32,aword(value shr 32),regsrc.reghi,
+                  cg.a_op_const_reg_reg(list,op,OS_32,aint(value shr 32),regsrc.reghi,
                     regdst.reghi);
                     regdst.reghi);
                 end;
                 end;
             end;
             end;
@@ -2412,7 +2396,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.171  2004-06-02 17:18:10  jonas
+  Revision 1.172  2004-06-17 16:55:46  peter
+    * powerpc compiles again
+
+  Revision 1.171  2004/06/02 17:18:10  jonas
     * parameters passed on the stack now also work as register variables
     * parameters passed on the stack now also work as register variables
 
 
   Revision 1.170  2004/05/31 18:08:41  jonas
   Revision 1.170  2004/05/31 18:08:41  jonas

+ 27 - 10
compiler/powerpc/cpubase.pas

@@ -29,7 +29,8 @@ unit cpubase;
 interface
 interface
 
 
 uses
 uses
-  strings,cutils,cclasses,aasmbase,cpuinfo,cgbase;
+  strings,globtype,
+  cutils,cclasses,aasmbase,cpuinfo,cgbase;
 
 
 
 
 {*****************************************************************************
 {*****************************************************************************
@@ -137,6 +138,10 @@ uses
         {$i rppcstab.inc}
         {$i rppcstab.inc}
       );
       );
 
 
+      regdwarf_table : array[tregisterindex] of shortint = (
+        {$i rppcdwrf.inc}
+      );
+
       { registers which may be destroyed by calls }
       { registers which may be destroyed by calls }
       VOLATILE_INTREGISTERS = [RS_R3..RS_R12];
       VOLATILE_INTREGISTERS = [RS_R3..RS_R12];
 {$warning FIXME!!}
 {$warning FIXME!!}
@@ -333,19 +338,13 @@ uses
 {$else FPC_BIG_ENDIAN}
 {$else FPC_BIG_ENDIAN}
                 1 : (value : AWord);
                 1 : (value : AWord);
 {$endif FPC_BIG_ENDIAN}
 {$endif FPC_BIG_ENDIAN}
-                { can't do this, this layout depends on the host cpu. Use }
-                { lo(valueqword)/hi(valueqword) instead (JM)              }
-                { 2 : (valuelow, valuehigh:AWord);                        }
-                { overlay a complete 64 Bit value }
-                3 : (valueqword : qword);
+                2 : (value64 : int64);
               );
               );
             LOC_FPUREGISTER, LOC_CFPUREGISTER, LOC_MMREGISTER, LOC_CMMREGISTER,
             LOC_FPUREGISTER, LOC_CFPUREGISTER, LOC_MMREGISTER, LOC_CMMREGISTER,
               LOC_REGISTER,LOC_CREGISTER : (
               LOC_REGISTER,LOC_CREGISTER : (
                 case longint of
                 case longint of
                   1 : (registerlow,registerhigh : tregister);
                   1 : (registerlow,registerhigh : tregister);
                   2 : (register : tregister);
                   2 : (register : tregister);
-                  { overlay a 64 Bit register type }
-                  3 : (reg64 : tregister64);
                   4 : (register64 : tregister64);
                   4 : (register64 : tregister64);
                 );
                 );
             LOC_FLAGS : (resflags : tresflags);
             LOC_FLAGS : (resflags : tresflags);
@@ -409,6 +408,8 @@ uses
       }
       }
 {$warning As indicated in rs6000.h, but can't find it anywhere else!}
 {$warning As indicated in rs6000.h, but can't find it anywhere else!}
       NR_PIC_OFFSET_REG = NR_R30;
       NR_PIC_OFFSET_REG = NR_R30;
+      { Return address of a function }
+      NR_RETURN_ADDRESS_REG = NR_R0;
       { Results are returned in this register (32-bit values) }
       { Results are returned in this register (32-bit values) }
       NR_FUNCTION_RETURN_REG = NR_R3;
       NR_FUNCTION_RETURN_REG = NR_R3;
       RS_FUNCTION_RETURN_REG = RS_R3;
       RS_FUNCTION_RETURN_REG = RS_R3;
@@ -487,7 +488,7 @@ uses
 
 
     function cgsize2subreg(s:Tcgsize):Tsubregister;
     function cgsize2subreg(s:Tcgsize):Tsubregister;
     { Returns the tcgsize corresponding with the size of reg.}
     { Returns the tcgsize corresponding with the size of reg.}
-    function reg_cgsize(const reg: tregister) : tcgsize; virtual;
+    function reg_cgsize(const reg: tregister) : tcgsize;
 
 
     function findreg_by_number(r:Tregister):tregisterindex;
     function findreg_by_number(r:Tregister):tregisterindex;
     function std_regnum_search(const s:string):Tregister;
     function std_regnum_search(const s:string):Tregister;
@@ -594,6 +595,19 @@ implementation
       end;
       end;
 
 
 
 
+    function reg_cgsize(const reg: tregister): tcgsize;
+      begin
+        case getregtype(reg) of
+          R_MMREGISTER,
+          R_FPUREGISTER,
+          R_INTREGISTER :
+            result:=OS_32;
+          else
+            internalerror(200303181);
+        end;
+      end;
+
+
     function cgsize2subreg(s:Tcgsize):Tsubregister;
     function cgsize2subreg(s:Tcgsize):Tsubregister;
       begin
       begin
         cgsize2subreg:=R_SUBWHOLE;
         cgsize2subreg:=R_SUBWHOLE;
@@ -627,7 +641,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.87  2004-06-16 20:07:10  florian
+  Revision 1.88  2004-06-17 16:55:46  peter
+    * powerpc compiles again
+
+  Revision 1.87  2004/06/16 20:07:10  florian
     * dwarf branch merged
     * dwarf branch merged
 
 
   Revision 1.86.2.1  2004/05/01 11:12:24  florian
   Revision 1.86.2.1  2004/05/01 11:12:24  florian

+ 28 - 25
compiler/powerpc/nppcadd.pas

@@ -205,7 +205,7 @@ interface
         if (right.location.loc = LOC_CONSTANT) then
         if (right.location.loc = LOC_CONSTANT) then
           begin
           begin
 {$ifdef dummy}
 {$ifdef dummy}
-            if (right.location.size in [OS_64,OS_S64]) and (hi(right.location.valueqword)<>0) and ((hi(right.location.valueqword)<>$ffffffff) or unsigned) then
+            if (right.location.size in [OS_64,OS_S64]) and (hi(right.location.value64)<>0) and ((hi(right.location.value64)<>$ffffffff) or unsigned) then
               internalerror(2002080301);
               internalerror(2002080301);
 {$endif extdebug}
 {$endif extdebug}
             if (nodetype in [equaln,unequaln]) then
             if (nodetype in [equaln,unequaln]) then
@@ -688,11 +688,11 @@ interface
           location_copy(oldleft,left.location);
           location_copy(oldleft,left.location);
           location_copy(oldright,right.location);
           location_copy(oldright,right.location);
           if left.location.loc = LOC_CONSTANT then
           if left.location.loc = LOC_CONSTANT then
-            left.location.valueqword := left.location.valueqword shr 32
+            left.location.value64 := left.location.value64 shr 32
           else
           else
             left.location.registerlow := left.location.registerhigh;
             left.location.registerlow := left.location.registerhigh;
           if right.location.loc = LOC_CONSTANT then
           if right.location.loc = LOC_CONSTANT then
-            right.location.valueqword := right.location.valueqword shr 32
+            right.location.value64 := right.location.value64 shr 32
           else
           else
             right.location.registerlow := right.location.registerhigh;
             right.location.registerlow := right.location.registerhigh;
 
 
@@ -865,38 +865,38 @@ interface
                         end
                         end
                       else
                       else
                         begin
                         begin
-                          if (aword(right.location.valueqword) <> 0) then
+                          if (aword(right.location.value64) <> 0) then
                             tempreg64.reglo := cg.getintregister(exprasmlist,OS_32)
                             tempreg64.reglo := cg.getintregister(exprasmlist,OS_32)
                           else
                           else
                             tempreg64.reglo := left.location.registerlow;
                             tempreg64.reglo := left.location.registerlow;
-                          if ((right.location.valueqword shr 32) <> 0) then
+                          if ((right.location.value64 shr 32) <> 0) then
                             tempreg64.reghi := cg.getintregister(exprasmlist,OS_32)
                             tempreg64.reghi := cg.getintregister(exprasmlist,OS_32)
                           else
                           else
                             tempreg64.reghi := left.location.registerhigh;
                             tempreg64.reghi := left.location.registerhigh;
                         end;
                         end;
 
 
-                      if (aword(right.location.valueqword) <> 0) then
+                      if (aword(right.location.value64) <> 0) then
                         { negative values can be handled using SUB, }
                         { negative values can be handled using SUB, }
                         { positive values < 65535 using XOR.        }
                         { positive values < 65535 using XOR.        }
-                        if (longint(right.location.valueqword) >= -32767) and
-                           (longint(right.location.valueqword) < 0) then
+                        if (longint(right.location.value64) >= -32767) and
+                           (longint(right.location.value64) < 0) then
                           cg.a_op_const_reg_reg(exprasmlist,OP_SUB,OS_INT,
                           cg.a_op_const_reg_reg(exprasmlist,OP_SUB,OS_INT,
-                            aword(right.location.valueqword),
+                            aword(right.location.value64),
                             left.location.registerlow,tempreg64.reglo)
                             left.location.registerlow,tempreg64.reglo)
                         else
                         else
                           cg.a_op_const_reg_reg(exprasmlist,OP_XOR,OS_INT,
                           cg.a_op_const_reg_reg(exprasmlist,OP_XOR,OS_INT,
-                            aword(right.location.valueqword),
+                            aword(right.location.value64),
                             left.location.registerlow,tempreg64.reglo);
                             left.location.registerlow,tempreg64.reglo);
 
 
-                      if ((right.location.valueqword shr 32) <> 0) then
-                        if (longint(right.location.valueqword shr 32) >= -32767) and
-                           (longint(right.location.valueqword shr 32) < 0) then
+                      if ((right.location.value64 shr 32) <> 0) then
+                        if (longint(right.location.value64 shr 32) >= -32767) and
+                           (longint(right.location.value64 shr 32) < 0) then
                           cg.a_op_const_reg_reg(exprasmlist,OP_SUB,OS_INT,
                           cg.a_op_const_reg_reg(exprasmlist,OP_SUB,OS_INT,
-                            aword(right.location.valueqword shr 32),
+                            aword(right.location.value64 shr 32),
                             left.location.registerhigh,tempreg64.reghi)
                             left.location.registerhigh,tempreg64.reghi)
                         else
                         else
                           cg.a_op_const_reg_reg(exprasmlist,OP_XOR,OS_INT,
                           cg.a_op_const_reg_reg(exprasmlist,OP_XOR,OS_INT,
-                            aword(right.location.valueqword shr 32),
+                            aword(right.location.value64 shr 32),
                             left.location.registerhigh,tempreg64.reghi);
                             left.location.registerhigh,tempreg64.reghi);
                     end
                     end
                   else
                   else
@@ -931,7 +931,7 @@ interface
                   if (left.location.loc = LOC_CONSTANT) then
                   if (left.location.loc = LOC_CONSTANT) then
                     swapleftright;
                     swapleftright;
                   if (right.location.loc = LOC_CONSTANT) then
                   if (right.location.loc = LOC_CONSTANT) then
-                    cg64.a_op64_const_reg_reg(exprasmlist,op,right.location.valueqword,
+                    cg64.a_op64_const_reg_reg(exprasmlist,op,right.location.value64,
                       left.location.register64,location.register64)
                       left.location.register64,location.register64)
                   else
                   else
                     cg64.a_op64_reg_reg_reg(exprasmlist,op,right.location.register64,
                     cg64.a_op64_reg_reg_reg(exprasmlist,op,right.location.register64,
@@ -957,18 +957,18 @@ interface
                       else
                       else
                         // reg64 - const64
                         // reg64 - const64
                         cg64.a_op64_const_reg_reg(exprasmlist,OP_SUB,
                         cg64.a_op64_const_reg_reg(exprasmlist,OP_SUB,
-                          right.location.valueqword,left.location.register64,
+                          right.location.value64,left.location.register64,
                           location.register64)
                           location.register64)
                     end
                     end
-                  else if ((left.location.valueqword shr 32) = 0) then
+                  else if ((left.location.value64 shr 32) = 0) then
                     begin
                     begin
                       if (location.registerlow = NR_NO) then
                       if (location.registerlow = NR_NO) then
                         begin
                         begin
                          location.registerlow := cg.getintregister(exprasmlist,OS_INT);
                          location.registerlow := cg.getintregister(exprasmlist,OS_INT);
                          location.registerhigh := cg.getintregister(exprasmlist,OS_INT);
                          location.registerhigh := cg.getintregister(exprasmlist,OS_INT);
                       end;
                       end;
-                      if (int64(left.location.valueqword) >= low(smallint)) and
-                         (int64(left.location.valueqword) <= high(smallint)) then
+                      if (int64(left.location.value64) >= low(smallint)) and
+                         (int64(left.location.value64) <= high(smallint)) then
                         begin
                         begin
                           // consts16 - reg64
                           // consts16 - reg64
                           exprasmlist.concat(taicpu.op_reg_reg_const(A_SUBFIC,
                           exprasmlist.concat(taicpu.op_reg_reg_const(A_SUBFIC,
@@ -987,7 +987,7 @@ interface
                       exprasmlist.concat(taicpu.op_reg_reg(A_SUBFZE,
                       exprasmlist.concat(taicpu.op_reg_reg(A_SUBFZE,
                         location.registerhigh,right.location.registerhigh));
                         location.registerhigh,right.location.registerhigh));
                     end
                     end
-                  else if (aword(left.location.valueqword) = 0) then
+                  else if (aword(left.location.value64) = 0) then
                     begin
                     begin
                       // (const32 shl 32) - reg64
                       // (const32 shl 32) - reg64
                       if (location.registerlow = NR_NO) then
                       if (location.registerlow = NR_NO) then
@@ -997,7 +997,7 @@ interface
                       end;
                       end;
                       exprasmlist.concat(taicpu.op_reg_reg_const(A_SUBFIC,
                       exprasmlist.concat(taicpu.op_reg_reg_const(A_SUBFIC,
                         location.registerlow,right.location.registerlow,0));
                         location.registerlow,right.location.registerlow,0));
-                      left.location.valueqword := left.location.valueqword shr 32;
+                      left.location.value64 := left.location.value64 shr 32;
                       location_force_reg(exprasmlist,left.location,OS_32,true);
                       location_force_reg(exprasmlist,left.location,OS_32,true);
                       exprasmlist.concat(taicpu.op_reg_reg_reg(A_SUBFE,
                       exprasmlist.concat(taicpu.op_reg_reg_reg(A_SUBFE,
                         location.registerhigh,right.location.registerhigh,
                         location.registerhigh,right.location.registerhigh,
@@ -1494,7 +1494,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.43  2004-03-18 16:19:03  peter
+  Revision 1.44  2004-06-17 16:55:46  peter
+    * powerpc compiles again
+
+  Revision 1.43  2004/03/18 16:19:03  peter
     * fixed operator overload allowing for pointer-string
     * fixed operator overload allowing for pointer-string
     * replaced some type_e_mismatch with more informational messages
     * replaced some type_e_mismatch with more informational messages
 
 
@@ -1617,8 +1620,8 @@ end.
   Revision 1.12  2002/08/14 18:41:48  jonas
   Revision 1.12  2002/08/14 18:41:48  jonas
     - remove valuelow/valuehigh fields from tlocation, because they depend
     - remove valuelow/valuehigh fields from tlocation, because they depend
       on the endianess of the host operating system -> difficult to get
       on the endianess of the host operating system -> difficult to get
-      right. Use lo/hi(location.valueqword) instead (remember to use
-      valueqword and not value!!)
+      right. Use lo/hi(location.value64) instead (remember to use
+      value64 and not value!!)
 
 
   Revision 1.11  2002/08/11 14:32:32  peter
   Revision 1.11  2002/08/11 14:32:32  peter
     * renamed current_library to objectlibrary
     * renamed current_library to objectlibrary

+ 5 - 2
compiler/powerpc/nppcld.pas

@@ -63,7 +63,7 @@ unit nppcld;
                     begin
                     begin
                       l:=objectlibrary.newasmsymbol('L'+tvarsym(symtableentry).mangledname+'$non_lazy_ptr',AB_COMMON,AT_DATA);
                       l:=objectlibrary.newasmsymbol('L'+tvarsym(symtableentry).mangledname+'$non_lazy_ptr',AB_COMMON,AT_DATA);
                       picdata.concat(tai_symbol.create(l,0));
                       picdata.concat(tai_symbol.create(l,0));
-                      picdata.concat(tai_const_symbol.create_indirect(objectlibrary.newasmsymbol(tvarsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA)));
+                      picdata.concat(tai_const.create_indirect_sym(objectlibrary.newasmsymbol(tvarsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA)));
                       picdata.concat(tai_const.create_32bit(0));
                       picdata.concat(tai_const.create_32bit(0));
                     end;
                     end;
 
 
@@ -87,7 +87,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.2  2004-03-05 22:17:11  jonas
+  Revision 1.3  2004-06-17 16:55:46  peter
+    * powerpc compiles again
+
+  Revision 1.2  2004/03/05 22:17:11  jonas
     * fixed importing of variables from shared libraries, but disabled
     * fixed importing of variables from shared libraries, but disabled
       PIC support for now. You have to save/restore r31 when you us it! :)
       PIC support for now. You have to save/restore r31 when you us it! :)
       Also, it's not necessary to support the imported variables
       Also, it's not necessary to support the imported variables

+ 114 - 111
compiler/powerpc/ppcreg.dat

@@ -6,124 +6,127 @@
 ; layout
 ; layout
 ; <name>,<value>,<stdname>,<gasname>,<gasshortname>,<motname>,<stabidx>
 ; <name>,<value>,<stdname>,<gasname>,<gasshortname>,<motname>,<stabidx>
 ;
 ;
-NO,$00,$00,INVALID,INVALID,INVALID,INVALID,-1
+NO,$00,$00,INVALID,INVALID,INVALID,INVALID,-1,-1
 
 
-R0,$01,$00,r0,r0,0,r0,0
-R1,$01,$01,r1,r1,1,r1,1
-R2,$01,$02,r2,r2,2,r2,2
-R3,$01,$03,r3,r3,3,r3,3
-R4,$01,$04,r4,r4,4,r4,4
-R5,$01,$05,r5,r5,5,r5,5
-R6,$01,$06,r6,r6,6,r6,6
-R7,$01,$07,r7,r7,7,r7,7
-R8,$01,$08,r8,r8,8,r8,8
-R9,$01,$09,r9,r9,9,r9,9
-R10,$01,$0a,r10,r10,10,r10,10
-R11,$01,$0b,r11,r11,11,r11,11
-R12,$01,$0c,r12,r12,12,r12,12
-R13,$01,$0d,r13,r13,13,r13,13
-R14,$01,$0e,r14,r14,14,r14,14
-R15,$01,$0f,r15,r15,15,r15,15
-R16,$01,$10,r16,r16,16,r16,16
-R17,$01,$11,r17,r17,17,r17,17
-R18,$01,$12,r18,r18,18,r18,18
-R19,$01,$13,r19,r19,19,r19,19
-R20,$01,$14,r20,r20,20,r20,20
-R21,$01,$15,r21,r21,21,r21,21
-R22,$01,$16,r22,r22,22,r22,22
-R23,$01,$17,r23,r23,23,r23,23
-R24,$01,$18,r24,r24,24,r24,24
-R25,$01,$19,r25,r25,25,r25,25
-R26,$01,$1a,r26,r26,26,r26,26
-R27,$01,$1b,r27,r27,27,r27,27
-R28,$01,$1c,r28,r28,28,r28,28
-R29,$01,$1d,r29,r29,29,r29,29
-R30,$01,$1e,r30,r30,30,r30,30
-R31,$01,$1f,r31,r31,31,r31,31
+R0,$01,$00,r0,r0,0,r0,0,0
+R1,$01,$01,r1,r1,1,r1,1,1
+R2,$01,$02,r2,r2,2,r2,2,2
+R3,$01,$03,r3,r3,3,r3,3,3
+R4,$01,$04,r4,r4,4,r4,4,4
+R5,$01,$05,r5,r5,5,r5,5,5
+R6,$01,$06,r6,r6,6,r6,6,6
+R7,$01,$07,r7,r7,7,r7,7,7
+R8,$01,$08,r8,r8,8,r8,8,8
+R9,$01,$09,r9,r9,9,r9,9,9
+R10,$01,$0a,r10,r10,10,r10,10,10
+R11,$01,$0b,r11,r11,11,r11,11,11
+R12,$01,$0c,r12,r12,12,r12,12,12
+R13,$01,$0d,r13,r13,13,r13,13,13
+R14,$01,$0e,r14,r14,14,r14,14,14
+R15,$01,$0f,r15,r15,15,r15,15,15
+R16,$01,$10,r16,r16,16,r16,16,16
+R17,$01,$11,r17,r17,17,r17,17,17
+R18,$01,$12,r18,r18,18,r18,18,18
+R19,$01,$13,r19,r19,19,r19,19,19
+R20,$01,$14,r20,r20,20,r20,20,20
+R21,$01,$15,r21,r21,21,r21,21,21
+R22,$01,$16,r22,r22,22,r22,22,22
+R23,$01,$17,r23,r23,23,r23,23,23
+R24,$01,$18,r24,r24,24,r24,24,24
+R25,$01,$19,r25,r25,25,r25,25,25
+R26,$01,$1a,r26,r26,26,r26,26,26
+R27,$01,$1b,r27,r27,27,r27,27,27
+R28,$01,$1c,r28,r28,28,r28,28,28
+R29,$01,$1d,r29,r29,29,r29,29,29
+R30,$01,$1e,r30,r30,30,r30,30,30
+R31,$01,$1f,r31,r31,31,r31,31,31
 
 
-F0,$02,$00,F0,f0,0,F0,32
-F1,$02,$01,F1,f1,1,F1,33
-F2,$02,$02,F2,f2,2,F2,34
-F3,$02,$03,F3,f3,3,F3,35
-F4,$02,$04,F4,f4,4,F4,36
-F5,$02,$05,F5,f5,5,F5,37
-F6,$02,$06,F6,f6,6,F6,38
-F7,$02,$07,F7,f7,7,F7,39
-F8,$02,$08,F8,f8,8,F8,40
-F9,$02,$09,F9,f9,9,F9,41
-F10,$02,$0a,F10,f10,10,F10,42
-F11,$02,$0b,F11,f11,11,F11,43
-F12,$02,$0c,F12,f12,12,F12,44
-F13,$02,$0d,F13,f13,13,F13,45
-F14,$02,$0e,F14,f14,14,F14,46
-F15,$02,$0f,F15,f15,15,F15,47
-F16,$02,$10,F16,f16,16,F16,48
-F17,$02,$11,F17,f17,17,F17,49
-F18,$02,$12,F18,f18,18,F18,50
-F19,$02,$13,F19,f19,19,F19,51
-F20,$02,$14,F20,f20,20,F20,52
-F21,$02,$15,F21,f21,21,F21,53
-F22,$02,$16,F22,f22,22,F22,54
-F23,$02,$17,F23,f23,23,F23,55
-F24,$02,$18,F24,f24,24,F24,56
-F25,$02,$19,F25,f25,25,F25,57
-F26,$02,$1a,F26,f26,26,F26,58
-F27,$02,$1b,F27,f27,27,F27,59
-F28,$02,$1c,F28,f28,28,F28,60
-F29,$02,$1d,F29,f29,29,F29,61
-F30,$02,$1e,F30,f30,30,F30,62
-F31,$02,$1f,F31,f31,31,F31,63
+F0,$02,$00,F0,f0,0,F0,32,32
+F1,$02,$01,F1,f1,1,F1,33,33
+F2,$02,$02,F2,f2,2,F2,34,34
+F3,$02,$03,F3,f3,3,F3,35,35
+F4,$02,$04,F4,f4,4,F4,36,36
+F5,$02,$05,F5,f5,5,F5,37,37
+F6,$02,$06,F6,f6,6,F6,38,38
+F7,$02,$07,F7,f7,7,F7,39,39
+F8,$02,$08,F8,f8,8,F8,40,40
+F9,$02,$09,F9,f9,9,F9,41,41
+F10,$02,$0a,F10,f10,10,F10,42,42
+F11,$02,$0b,F11,f11,11,F11,43,43
+F12,$02,$0c,F12,f12,12,F12,44,44
+F13,$02,$0d,F13,f13,13,F13,45,45
+F14,$02,$0e,F14,f14,14,F14,46,46
+F15,$02,$0f,F15,f15,15,F15,47,47
+F16,$02,$10,F16,f16,16,F16,48,48
+F17,$02,$11,F17,f17,17,F17,49,49
+F18,$02,$12,F18,f18,18,F18,50,50
+F19,$02,$13,F19,f19,19,F19,51,51
+F20,$02,$14,F20,f20,20,F20,52,52
+F21,$02,$15,F21,f21,21,F21,53,53
+F22,$02,$16,F22,f22,22,F22,54,54
+F23,$02,$17,F23,f23,23,F23,55,55
+F24,$02,$18,F24,f24,24,F24,56,56
+F25,$02,$19,F25,f25,25,F25,57,57
+F26,$02,$1a,F26,f26,26,F26,58,58
+F27,$02,$1b,F27,f27,27,F27,59,59
+F28,$02,$1c,F28,f28,28,F28,60,60
+F29,$02,$1d,F29,f29,29,F29,61,61
+F30,$02,$1e,F30,f30,30,F30,62,62
+F31,$02,$1f,F31,f31,31,F31,63,63
 
 
-M0,$03,$00,M0,v0,0,M0,-1
-M1,$03,$01,M1,v1,1,M1,-1
-M2,$03,$02,M2,v2,2,M2,-1
-M3,$03,$03,M3,v3,3,M3,-1
-M4,$03,$04,M4,v4,4,M4,-1
-M5,$03,$05,M5,v5,5,M5,-1
-M6,$03,$06,M6,v6,6,M6,-1
-M7,$03,$07,M7,v7,7,M7,-1
-M8,$03,$08,M8,v8,8,M8,-1
-M9,$03,$09,M9,v9,9,M9,-1
-M10,$03,$0a,M10,v10,10,M10,-1
-M11,$03,$0b,M11,v11,11,M11,-1
-M12,$03,$0c,M12,v12,12,M12,-1
-M13,$03,$0d,M13,v13,13,M13,-1
-M14,$03,$0e,M14,v14,14,M14,-1
-M15,$03,$0f,M15,v15,15,M15,-1
-M16,$03,$10,M16,v16,16,M16,-1
-M17,$03,$11,M17,v17,17,M17,-1
-M18,$03,$12,M18,v18,18,M18,-1
-M19,$03,$13,M19,v19,19,M19,-1
-M20,$03,$14,M20,v20,20,M20,-1
-M21,$03,$15,M21,v21,21,M21,-1
-M22,$03,$16,M22,v22,22,M22,-1
-M23,$03,$17,M23,v23,23,M23,-1
-M24,$03,$18,M24,v24,24,M24,-1
-M25,$03,$19,M25,v25,25,M25,-1
-M26,$03,$1a,M26,v26,26,M26,-1
-M27,$03,$1b,M27,v27,27,M27,-1
-M28,$03,$1c,M28,v28,28,M28,-1
-M29,$03,$1d,M29,v29,29,M29,-1
-M30,$03,$1e,M30,v30,30,M30,-1
-M31,$03,$1f,M31,v31,31,M31,-1
+M0,$03,$00,M0,v0,0,M0,-1,-1
+M1,$03,$01,M1,v1,1,M1,-1,-1
+M2,$03,$02,M2,v2,2,M2,-1,-1
+M3,$03,$03,M3,v3,3,M3,-1,-1
+M4,$03,$04,M4,v4,4,M4,-1,-1
+M5,$03,$05,M5,v5,5,M5,-1,-1
+M6,$03,$06,M6,v6,6,M6,-1,-1
+M7,$03,$07,M7,v7,7,M7,-1,-1
+M8,$03,$08,M8,v8,8,M8,-1,-1
+M9,$03,$09,M9,v9,9,M9,-1,-1
+M10,$03,$0a,M10,v10,10,M10,-1,-1
+M11,$03,$0b,M11,v11,11,M11,-1,-1
+M12,$03,$0c,M12,v12,12,M12,-1,-1
+M13,$03,$0d,M13,v13,13,M13,-1,-1
+M14,$03,$0e,M14,v14,14,M14,-1,-1
+M15,$03,$0f,M15,v15,15,M15,-1,-1
+M16,$03,$10,M16,v16,16,M16,-1,-1
+M17,$03,$11,M17,v17,17,M17,-1,-1
+M18,$03,$12,M18,v18,18,M18,-1,-1
+M19,$03,$13,M19,v19,19,M19,-1,-1
+M20,$03,$14,M20,v20,20,M20,-1,-1
+M21,$03,$15,M21,v21,21,M21,-1,-1
+M22,$03,$16,M22,v22,22,M22,-1,-1
+M23,$03,$17,M23,v23,23,M23,-1,-1
+M24,$03,$18,M24,v24,24,M24,-1,-1
+M25,$03,$19,M25,v25,25,M25,-1,-1
+M26,$03,$1a,M26,v26,26,M26,-1,-1
+M27,$03,$1b,M27,v27,27,M27,-1,-1
+M28,$03,$1c,M28,v28,28,M28,-1,-1
+M29,$03,$1d,M29,v29,29,M29,-1,-1
+M30,$03,$1e,M30,v30,30,M30,-1,-1
+M31,$03,$1f,M31,v31,31,M31,-1,-1
 
 
-CR,$05,$00,CR,cr,cr,CR,-1
-CR0,$05,$01,CR0,cr0,cr0,CR0,68
-CR1,$05,$02,CR1,cr1,cr1,CR1,69
-CR2,$05,$03,CR2,cr2,cr2,CR2,70
-CR3,$05,$04,CR3,cr3,cr3,CR3,71
-CR4,$05,$05,CR4,cr4,cr4,CR4,72
-CR5,$05,$06,CR5,cr5,cr5,CR5,73
-CR6,$05,$07,CR6,cr6,cr5,CR6,74
-CR7,$05,$08,CR7,cr7,cr6,CR7,75
-XER,$05,$09,XER,xer,xer,XER,76
-LR,$05,$0a,LR,lr,lr,LR,65
-CTR,$05,$0b,CTR,ctr,ctr,CTR,66
-FPSCR,$05,$0c,FPSCR,fpscr,fpscr,FPSCR,-1
+CR,$05,$00,CR,cr,cr,CR,-1,-1
+CR0,$05,$01,CR0,cr0,cr0,CR0,68,68
+CR1,$05,$02,CR1,cr1,cr1,CR1,69,69
+CR2,$05,$03,CR2,cr2,cr2,CR2,70,70
+CR3,$05,$04,CR3,cr3,cr3,CR3,71,71
+CR4,$05,$05,CR4,cr4,cr4,CR4,72,72
+CR5,$05,$06,CR5,cr5,cr5,CR5,73,73
+CR6,$05,$07,CR6,cr6,cr5,CR6,74,74
+CR7,$05,$08,CR7,cr7,cr6,CR7,75,75
+XER,$05,$09,XER,xer,xer,XER,76,76
+LR,$05,$0a,LR,lr,lr,LR,65,65
+CTR,$05,$0b,CTR,ctr,ctr,CTR,66,66
+FPSCR,$05,$0c,FPSCR,fpscr,fpscr,FPSCR,-1,-1
 
 
 ;
 ;
 ; $Log$
 ; $Log$
-; Revision 1.5  2003-12-10 22:19:27  florian
+; Revision 1.6  2004-06-17 16:55:46  peter
+;   * powerpc compiles again
+;
+; Revision 1.5  2003/12/10 22:19:27  florian
 ;   + short gas register names for smartlinking added
 ;   + short gas register names for smartlinking added
 ;
 ;
 ; Revision 1.4  2003/09/04 21:07:03  florian
 ; Revision 1.4  2003/09/04 21:07:03  florian

+ 111 - 0
compiler/powerpc/rppcdwrf.inc

@@ -0,0 +1,111 @@
+{ don't edit, this file is generated from ppcreg.dat }
+-1,
+0,
+1,
+2,
+3,
+4,
+5,
+6,
+7,
+8,
+9,
+10,
+11,
+12,
+13,
+14,
+15,
+16,
+17,
+18,
+19,
+20,
+21,
+22,
+23,
+24,
+25,
+26,
+27,
+28,
+29,
+30,
+31,
+32,
+33,
+34,
+35,
+36,
+37,
+38,
+39,
+40,
+41,
+42,
+43,
+44,
+45,
+46,
+47,
+48,
+49,
+50,
+51,
+52,
+53,
+54,
+55,
+56,
+57,
+58,
+59,
+60,
+61,
+62,
+63,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+68,
+69,
+70,
+71,
+72,
+73,
+74,
+75,
+76,
+65,
+66,
+-1

+ 5 - 2
compiler/regvars.pas

@@ -655,7 +655,7 @@ implementation
               if assigned(fpuregvars[i]) then
               if assigned(fpuregvars[i]) then
                 begin
                 begin
                   reg:=tvarsym(fpuregvars[i]).localloc.register;
                   reg:=tvarsym(fpuregvars[i]).localloc.register;
-                  size:=cg.reg_cgsize(reg);
+                  size:=reg_cgsize(reg);
                   cg.a_loadfpu_reg_reg(list,size,reg,reg);
                   cg.a_loadfpu_reg_reg(list,size,reg,reg);
                   cg.ungetregister(list,reg);
                   cg.ungetregister(list,reg);
                 end;
                 end;
@@ -670,7 +670,10 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.75  2004-05-30 15:36:55  jonas
+  Revision 1.76  2004-06-17 16:55:46  peter
+    * powerpc compiles again
+
+  Revision 1.75  2004/05/30 15:36:55  jonas
     * fixed regvars compilation
     * fixed regvars compilation
 
 
   Revision 1.74  2004/02/08 20:15:42  jonas
   Revision 1.74  2004/02/08 20:15:42  jonas

+ 12 - 2
compiler/utils/mkppcreg.pp

@@ -31,6 +31,7 @@ var s : string;
     gasnames,
     gasnames,
     gssnames,
     gssnames,
     motnames,
     motnames,
+    dwarfs,
     stabs : array[0..max_regcount-1] of string[63];
     stabs : array[0..max_regcount-1] of string[63];
     regnumber_index,
     regnumber_index,
     std_regname_index,
     std_regname_index,
@@ -277,6 +278,8 @@ begin
         motnames[regcount]:=readstr;
         motnames[regcount]:=readstr;
         readcomma;
         readcomma;
         stabs[regcount]:=readstr;
         stabs[regcount]:=readstr;
+        readcomma;
+        dwarfs[regcount]:=readstr;
         { Create register number }
         { Create register number }
         if supregs[regcount][1]<>'$' then
         if supregs[regcount][1]<>'$' then
           begin
           begin
@@ -305,7 +308,7 @@ procedure write_inc_files;
 
 
 var
 var
     norfile,stdfile,motfile,supfile,
     norfile,stdfile,motfile,supfile,
-    numfile,stabfile,confile,gasfile,gssfile,
+    numfile,stabfile,confile,gasfile,gssfile,dwarffile,
     rnifile,srifile,mrifile,grifile : text;
     rnifile,srifile,mrifile,grifile : text;
     first:boolean;
     first:boolean;
 
 
@@ -319,6 +322,7 @@ begin
   openinc(gssfile,'rppcgss.inc');
   openinc(gssfile,'rppcgss.inc');
   openinc(motfile,'rppcmot.inc');
   openinc(motfile,'rppcmot.inc');
   openinc(stabfile,'rppcstab.inc');
   openinc(stabfile,'rppcstab.inc');
+  openinc(dwarffile,'rppcdwrf.inc');
   openinc(norfile,'rppcnor.inc');
   openinc(norfile,'rppcnor.inc');
   openinc(rnifile,'rppcrni.inc');
   openinc(rnifile,'rppcrni.inc');
   openinc(srifile,'rppcsri.inc');
   openinc(srifile,'rppcsri.inc');
@@ -335,6 +339,7 @@ begin
           writeln(gssfile,',');
           writeln(gssfile,',');
           writeln(motfile,',');
           writeln(motfile,',');
           writeln(stabfile,',');
           writeln(stabfile,',');
+          writeln(dwarffile,',');
           writeln(rnifile,',');
           writeln(rnifile,',');
           writeln(srifile,',');
           writeln(srifile,',');
           writeln(grifile,',');
           writeln(grifile,',');
@@ -350,6 +355,7 @@ begin
       write(gssfile,'''',gssnames[i],'''');
       write(gssfile,'''',gssnames[i],'''');
       write(motfile,'''',motnames[i],'''');
       write(motfile,'''',motnames[i],'''');
       write(stabfile,stabs[i]);
       write(stabfile,stabs[i]);
+      write(dwarffile,dwarfs[i]);
       write(rnifile,regnumber_index[i]);
       write(rnifile,regnumber_index[i]);
       write(srifile,std_regname_index[i]);
       write(srifile,std_regname_index[i]);
       write(grifile,gas_regname_index[i]);
       write(grifile,gas_regname_index[i]);
@@ -364,6 +370,7 @@ begin
   closeinc(gssfile);
   closeinc(gssfile);
   closeinc(motfile);
   closeinc(motfile);
   closeinc(stabfile);
   closeinc(stabfile);
+  closeinc(dwarffile);
   closeinc(norfile);
   closeinc(norfile);
   closeinc(rnifile);
   closeinc(rnifile);
   closeinc(srifile);
   closeinc(srifile);
@@ -390,7 +397,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.7  2003-12-16 21:49:47  florian
+  Revision 1.8  2004-06-17 16:55:46  peter
+    * powerpc compiles again
+
+  Revision 1.7  2003/12/16 21:49:47  florian
     * fixed ppc compilation
     * fixed ppc compilation
 
 
   Revision 1.6  2003/12/10 22:19:28  florian
   Revision 1.6  2003/12/10 22:19:28  florian