Jelajahi Sumber

* renamed some constants

carl 23 tahun lalu
induk
melakukan
9b12acc70a

+ 30 - 26
compiler/ia64/cpubase.pas

@@ -88,14 +88,12 @@ Const
   Firstreg = R_0;
   LastReg = R_F31;
 
-  stack_pointer = R_30;
-  frame_pointer = R_15;
-  self_pointer  = R_16;
+  stack_pointer_reg = R_30;
+  frame_pointer_reg = R_15;
+  self_pointer_reg  = R_16;
   accumulator   = R_0;
   global_pointer = R_29;
   return_pointer = R_26;
-  { it is used to pass the offset to the destructor helper routine }
-  vmt_offset_reg = R_1;
 
   max_scratch_regs = 2;
   scratch_regs : array[1..max_scratch_regs] of tregister = (R_1,R_2);
@@ -105,15 +103,8 @@ Const
   LoGPReg = R_0;
   HiGPReg = R_31;
 
-{ low and high of every possible width general purpose register (same as }
-{ above on most architctures apart from the 80x86)                       }
-  LoReg = R_0;
-  HiReg = R_31;
-
-  cpuflags = [cf_64bitaddr];
-
   { sizes }
-  pointersize   = 8;
+  pointer_size  = 8;
   extended_size = 16;
 
   general_registers = [R_0..R_31];
@@ -135,10 +126,30 @@ Const
 
   max_operands = 4;
 
-  registers_saved_on_cdecl = [R_9..R_14,R_F2..R_F9];
-
   varregs : Array [1..6] of Tregister =
             (R_9,R_10,R_11,R_12,R_13,R_14);
+            
+{*****************************************************************************
+                       GCC /ABI linking information
+*****************************************************************************}
+
+  {# Registers which must be saved when calling a routine declared as
+     cppdecl, cdecl, stdcall, safecall, palmossyscall. The registers
+     saved should be the ones as defined in the target ABI and / or GCC.
+     
+     This value can be deduced from CALLED_USED_REGISTERS array in the
+     GCC source.
+  }
+  std_saved_registers = [R_9..R_14,R_F2..R_F9];
+  {# Required parameter alignment when calling a routine declared as
+     stdcall and cdecl. The alignment value should be the one defined
+     by GCC or the target ABI. 
+     
+     The value of this constant is equal to the constant 
+     PARM_BOUNDARY / BITS_PER_UNIT in the GCC source.
+  }     
+  std_param_align = ???;
+            
 
 Type
    TReference = record
@@ -195,7 +206,6 @@ Type
 
   procedure set_location(var destloc : tlocation;const sourceloc : tlocation);
 
-  function reg2str(r : tregister) : string;
 
 {*****************************************************************************
                                   Init/Done
@@ -209,15 +219,6 @@ implementation
   uses
      verbose;
 
-  function reg2str(r : tregister) : string;
-
-    begin
-       if r in [R_0..R_31] then
-         reg2str:='R'+tostr(longint(r)-longint(R_0))
-       else if r in [R_F0..R_F31] then
-         reg2str:='F'+tostr(longint(r)-longint(R_F0))
-       else internalerror(38991);
-    end;
 
   procedure reset_reference(var ref : treference);
   begin
@@ -274,7 +275,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.2  2001-01-05 17:36:58  florian
+  Revision 1.3  2002-04-20 21:38:45  carl
+  * renamed some constants
+
+  Revision 1.2  2001/01/05 17:36:58  florian
   * the info about exception frames is stored now on the stack
   instead on the heap
 

+ 5 - 2
compiler/ia64/tgcpu.pas

@@ -213,7 +213,7 @@ implementation
            if saved[r]<>reg_not_saved then
              begin
                 reset_reference(hr);
-                hr.base:=frame_pointer;
+                hr.base:=frame_pointer_reg;
                 hr.offset:=saved[r];
                 exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOV,S_L,newreference(hr),r)));
                 unused:=unused-[r];
@@ -393,7 +393,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.1  2000-12-31 16:54:19  florian
+  Revision 1.2  2002-04-20 21:38:45  carl
+  * renamed some constants
+
+  Revision 1.1  2000/12/31 16:54:19  florian
     + initial revision
 
 }

+ 5 - 2
compiler/m68k/cga68k.pas

@@ -606,7 +606,7 @@ begin
 {$endif GDB}
 
     { omit stack frame ? }
-    if procinfo^.framepointer=stack_pointer then
+    if procinfo^.framepointer=stack_pointer_reg then
         begin
             CGMessage(cg_d_stackframe_omited);
             nostackframe:=true;
@@ -1391,7 +1391,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.1  2000-11-30 20:30:34  peter
+  Revision 1.2  2002-04-20 21:40:48  carl
+  * renamed some constants
+
+  Revision 1.1  2000/11/30 20:30:34  peter
     * moved into m68k subdir
 
   Revision 1.2  2000/07/13 11:32:37  michael

+ 6 - 19
compiler/m68k/cpubase.pas

@@ -245,9 +245,9 @@ unit cpubase;
 
        {This constant is an alias for the stack pointer, as it's name may
         differ from processor to processor.}
-       stack_pointer = R_SP;
+       stack_pointer_reg = R_SP;
 
-       frame_pointer = R_A6;
+       frame_pointer_reg = R_A6;
 
        {This constant is an alias for the accumulator, as it's name may
         differ from processor to processor.}
@@ -346,8 +346,6 @@ unit cpubase;
 
     function newreference(const r : treference) : preference;
 
-    function reg2str(r : tregister) : string;
-
     { generates an help record for constants }
     function newcsymbol(const s : string;l : longint) : pcsymbol;
 
@@ -855,20 +853,6 @@ unit cpubase;
     uses
       strings,globals,verbose;
 
-    function reg2str(r : tregister) : string;
-
-      const
-     a : array[R_NO..R_FPSR] of string[3] =
-      ('','D0','D1','D2','D3','D4','D5','D6','D7',
-       'A0','A1','A2','A3','A4','A5','A6','A7',
-      '-(SP)','(SP)+',
-       'CCR','FP0','FP1','FP2',
-       'FP3','FP4','FP5','FP6','FP7','FPCR','SR',
-       'SSP','DFC','SFC','VBR','FPSR');
-
-      begin
-         reg2str:=a[r];
-      end;
 
     procedure disposereference(var r : preference);
 
@@ -1576,7 +1560,10 @@ unit cpubase;
 end.
 {
   $Log$
-  Revision 1.1  2000-07-13 06:30:05  michael
+  Revision 1.2  2002-04-20 21:40:48  carl
+  * renamed some constants
+
+  Revision 1.1  2000/07/13 06:30:05  michael
   + Initial import
 
   Revision 1.2  2000/01/07 01:14:50  peter

+ 7 - 4
compiler/powerpc/agas.pas

@@ -51,7 +51,7 @@ unit agas;
     uses cpuasm;
 
     const
-       att_op2str : array[tasmop] of string[14] = ('<none>',
+       gas_op2str : array[tasmop] of string[14] = ('<none>',
     'add','add.','addo','addo.','addc','addc.','addco','addco.',
     'adde','adde.','addeo','addeo.','addi','addic','addic.','addis',
     'addme','addme.','addmeo','addmeo.','addze','addze.','addzeo',
@@ -203,7 +203,7 @@ unit agas;
       else
     { process operands }
         begin
-          s:=#9+att_op2str[op];
+          s:=#9+gas_op2str[op];
           if paicpu(hp)^.ops<>0 then
             begin
               if not is_calljmp(op) then
@@ -226,7 +226,7 @@ unit agas;
     begin
       tempstr := '#9';
       case c.simple of
-        false: cond2str := tempstr+att_op2str[op]+'#9'+tostr(c.bo)+','+
+        false: cond2str := tempstr+gas_op2str[op]+'#9'+tostr(c.bo)+','+
                            tostr(c.bi);
         true:
           if (op >= A_B) and (op <= A_BCLRL) then
@@ -273,7 +273,10 @@ unit agas;
 end.
 {
   $Log$
-  Revision 1.2  2002-04-06 18:13:01  jonas
+  Revision 1.3  2002-04-20 21:41:51  carl
+  * renamed some constants
+
+  Revision 1.2  2002/04/06 18:13:01  jonas
     * several powerpc-related additions and fixes
 
   Revision 1.1  2001/08/26 13:31:04  florian

+ 25 - 22
compiler/powerpc/cgcpu.pas

@@ -149,7 +149,7 @@ const
         else
           begin
             reset_reference(ref);
-            ref.base := stack_pointer;
+            ref.base := STACK_POINTER_REG;
             ref.offset := LinkageAreaSize+para_size_till_now;
             a_load_reg_ref(list,size,reg,ref);
           end;
@@ -169,7 +169,7 @@ const
         else
           begin
             reset_reference(ref);
-            ref.base := stack_pointer;
+            ref.base := STACK_POINTER_REG;
             ref.offset := LinkageAreaSize+para_size_till_now;
             a_load_const_ref(list,size,a,ref);
           end;
@@ -190,7 +190,7 @@ const
         else
           begin
             reset_reference(ref);
-            ref.base := stack_pointer;
+            ref.base := STACK_POINTER_REG;
             ref.offset := LinkageAreaSize+para_size_till_now;
             tmpreg := get_scratch_reg(list);
             a_load_ref_reg(list,size,r,tmpreg);
@@ -214,7 +214,7 @@ const
         else
           begin
             reset_reference(ref);
-            ref.base := stack_pointer;
+            ref.base := STACK_POINTER_REG;
             ref.offset := LinkageAreaSize+para_size_till_now;
             tmpreg := get_scratch_reg(list);
             a_loadaddr_ref_reg(list,size,r,tmpreg);
@@ -233,10 +233,10 @@ const
  { save our RTOC register value. Only necessary when doing pointer based    }
  { calls or cross TOC calls, but currently done always                      }
          list.concat(taicpu.op_reg_ref(A_STW,R_RTOC,
-           new_reference(stack_pointer,LA_RTOC)));
+           new_reference(STACK_POINTER_REG,LA_RTOC)));
          list.concat(taicpu.op_sym(A_BL,newasmsymbol(s)));
          list.concat(taicpu.op_reg_ref(A_LWZ,R_RTOC,
-           new_reference(stack_pointer,LA_RTOC)));
+           new_reference(STACK_POINTER_REG,LA_RTOC)));
       end;
 
 {********************** load instructions ********************}
@@ -709,7 +709,7 @@ const
  { procedure, but currently this isn't checked, so save them always         }
         { following is the entry code as described in "Altivec Programming }
         { Interface Manual", bar the saving of AltiVec registers           }
-        a_reg_alloc(list,stack_pointer);
+        a_reg_alloc(list,STACK_POINTER_REG);
         a_reg_alloc(list,R_0);
         { allocate registers containing reg parameters }
         for regcounter := R_3 to R_10 do
@@ -717,20 +717,20 @@ const
         { save return address... }
         list.concat(taicpu.op_reg_reg(A_MFSPR,R_0,R_LR));
         { ... in caller's frame }
-        list.concat(taicpu.op_reg_ref(A_STW,R_0,new_reference(STACK_POINTER,4)));
+        list.concat(taicpu.op_reg_ref(A_STW,R_0,new_reference(STACK_POINTER_REG,4)));
         a_reg_dealloc(list,R_0);
         a_reg_alloc(list,R_11);
         { save end of fpr save area }
-        list.concat(taicpu.op_reg_reg_const(A_ORI,R_11,STACK_POINTER,0));
+        list.concat(taicpu.op_reg_reg_const(A_ORI,R_11,STACK_POINTER_REG,0));
         a_reg_alloc(list,R_12);
         { 0 or 8 based on SP alignment }
         list.concat(taicpu.op_reg_reg_const_const_const(A_RLWINM,
-          R_12,STACK_POINTER,0,28,28));
+          R_12,STACK_POINTER_REG,0,28,28));
         { add in stack length }
         list.concat(taicpu.op_reg_reg_const(A_SUBFIC,R_12,R_12,
           -localsize));
         { establish new alignment }
-        list.concat(taicpu.op_reg_reg_reg(A_STWUX,STACK_POINTER,STACK_POINTER,R_12));
+        list.concat(taicpu.op_reg_reg_reg(A_STWUX,STACK_POINTER,STACK_POINTER_REG,R_12));
         a_reg_dealloc(list,R_12);
         { save floating-point registers }
         { !!! has to be optimized: only save registers that are used }
@@ -748,7 +748,7 @@ const
         a_reg_alloc(list,R_0);
         list.concat(taicpu.op_reg_reg(A_MFSPR,R_0,R_CR);
         list.concat(taicpu.op_reg_ref(A_STW,scratch_register,
-          new_reference(stack_pointer,LA_CR)));
+          new_reference(STACK_POINTER_REG,LA_CR)));
         a_reg_dealloc(list,R_0); }
         { save pointer to incoming arguments }
         list.concat(taicpu.op_reg_reg_const(A_ADDI,R_30,R_11,144));
@@ -769,7 +769,7 @@ const
  { procedure, but currently this isn't checked, so save them always         }
         { following is the entry code as described in "Altivec Programming }
         { Interface Manual", bar the saving of AltiVec registers           }
-        a_reg_alloc(list,STACK_POINTER);
+        a_reg_alloc(list,STACK_POINTER_REG);
         a_reg_alloc(list,R_0);
         { allocate registers containing reg parameters }
         for regcounter := R_3 to R_10 do
@@ -777,14 +777,14 @@ const
         { save return address... }
         list.concat(taicpu.op_reg_reg(A_MFSPR,R_0,R_LR));
         { ... in caller's frame }
-        list.concat(taicpu.op_reg_ref(A_STW,R_0,new_reference(STACK_POINTER,8)));
+        list.concat(taicpu.op_reg_ref(A_STW,R_0,new_reference(STACK_POINTER_REG,8)));
         a_reg_dealloc(list,R_0);
         { save floating-point registers }
         { !!! has to be optimized: only save registers that are used }
         list.concat(taicpu.op_sym_ofs(A_BL,newasmsymbol('_savef14'),0));
         { save gprs in gpr save area }
         { !!! has to be optimized: only save registers that are used }
-        list.concat(taicpu.op_reg_ref(A_STMW,R_13,new_reference(STACK_POINTER,-220)));
+        list.concat(taicpu.op_reg_ref(A_STMW,R_13,new_reference(STACK_POINTER_REG,-220)));
         { save the CR if necessary ( !!! always done currently ) }
         a_reg_alloc(list,R_0);
         list.concat(taicpu.op_reg_reg(A_MFSPR,R_0,R_CR));
@@ -792,16 +792,16 @@ const
           new_reference(stack_pointer,LA_CR)));
         a_reg_dealloc(list,R_0);
         { save pointer to incoming arguments }
-        list.concat(taicpu.op_reg_reg_const(A_ORI,R_31,STACK_POINTER,0));
+        list.concat(taicpu.op_reg_reg_const(A_ORI,R_31,STACK_POINTER_REG,0));
         a_reg_alloc(list,R_12);
         { 0 or 8 based on SP alignment }
         list.concat(taicpu.op_reg_reg_const_const_const(A_RLWINM,
-          R_12,STACK_POINTER,0,28,28));
+          R_12,STACK_POINTER_REG,0,28,28));
         { add in stack length }
         list.concat(taicpu.op_reg_reg_const(A_SUBFIC,R_12,R_12,
           -localsize));
         { establish new alignment }
-        list.concat(taicpu.op_reg_reg_reg(A_STWUX,STACK_POINTER,STACK_POINTER,R_12));
+        list.concat(taicpu.op_reg_reg_reg(A_STWUX,STACK_POINTER_REG,STACK_POINTER_REG,R_12));
         a_reg_dealloc(list,R_12);
         { now comes the AltiVec context save, not yet implemented !!! }
       end;
@@ -1021,11 +1021,11 @@ const
         { AltiVec context restore, not yet implemented !!! }
 
         { restore SP }
-        list.concat(taicpu.op_reg_reg_const(A_ORI,STACK_POINTER,R_31,0));
+        list.concat(taicpu.op_reg_reg_const(A_ORI,STACK_POINTER_REG,R_31,0));
         { restore gprs }
-        list.concat(taicpu.op_reg_ref(A_LMW,R_13,new_reference(STACK_POINTER,-220)));
+        list.concat(taicpu.op_reg_ref(A_LMW,R_13,new_reference(STACK_POINTER_REG,-220)));
         { restore return address ... }
-        list.concat(taicpu.op_reg_ref(A_LWZ,R_0,new_reference(STACK_POINTER,8)));
+        list.concat(taicpu.op_reg_ref(A_LWZ,R_0,new_reference(STACK_POINTER_REG,8)));
         { ... and return from _restf14 }
         list.concat(taicpu.op_sym_ofs(A_B,newasmsymbol('_restf14'),0));
       end;
@@ -1174,7 +1174,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.12  2002-04-06 18:13:01  jonas
+  Revision 1.13  2002-04-20 21:41:51  carl
+  * renamed some constants
+
+  Revision 1.12  2002/04/06 18:13:01  jonas
     * several powerpc-related additions and fixes
 
   Revision 1.11  2002/01/02 14:53:04  jonas

+ 29 - 20
compiler/powerpc/cpubase.pas

@@ -287,7 +287,6 @@ const
 *****************************************************************************}
 
 type
-  trefoptions=(ref_none,ref_parafixup,ref_localfixup);
 
   { since we have only 16 offsets, we need to be able to specify the high }
   { and low 16 bits of the address of a symbol                            }
@@ -302,7 +301,6 @@ type
      symbol      : tasmsymbol;
      symaddr     : trefsymaddr;
      offsetfixup : longint;
-     options     : trefoptions;
      alignment   : byte;
   end;
 
@@ -391,9 +389,6 @@ const
   firstsavemmreg = R_NO;
   lastsavemmreg = R_NO;
 
-  lowsavereg = firstsaveintreg;
-  highsavereg = lastsavefpureg;
-
   lvaluelocations = [LOC_REFERENCE, LOC_CREGISTER, LOC_CFPUREGISTER,
                      LOC_CMMREGISTER];
 
@@ -435,18 +430,15 @@ const
   fpuregs = [R_F0..R_F31];
   mmregs = [R_M0..R_M31];
 
-  cpuflags = [];
 
-  registers_saved_on_cdecl = [R_13..R_29];
 
   { generic register names }
-  stack_pointer    = R_1;
+  stack_pointer_reg= R_1;
   R_RTOC           = R_2;
-  frame_pointer    = stack_pointer;
-  self_pointer     = R_9;
+  frame_pointer_reg    = stack_pointer_reg;
+  self_pointer_reg  = R_9;
   accumulator      = R_3;
   accumulatorhigh  = R_4;
-  vmt_offset_reg   = R_0;
   max_scratch_regs = 3;
   scratch_regs: Array[1..max_scratch_regs] of TRegister = (R_11,R_12,R_31);
 
@@ -463,10 +455,7 @@ const
   LoReg = R_0;
   HiReg = R_31;
 
-(*  cpuflags : set of tcpuflags = []; *)
-
   { sizes }
-  pointersize   = 4;
   extended_size = 8;
 
   LinkageAreaSize = 24;
@@ -478,6 +467,28 @@ const
   LA_LR = 8;
  { offset in the linkage area for the saved RTOC register}
   LA_RTOC = 20;
+  
+{*****************************************************************************
+                       GCC /ABI linking information
+*****************************************************************************}
+
+  {# Registers which must be saved when calling a routine declared as
+     cppdecl, cdecl, stdcall, safecall, palmossyscall. The registers
+     saved should be the ones as defined in the target ABI and / or GCC.
+     
+     This value can be deduced from CALLED_USED_REGISTERS array in the
+     GCC source.
+  }
+  std_saved_registers = [R_13..R_29];
+  {# Required parameter alignment when calling a routine declared as
+     stdcall and cdecl. The alignment value should be the one defined
+     by GCC or the target ABI. 
+     
+     The value of this constant is equal to the constant 
+     PARM_BOUNDARY / BITS_PER_UNIT in the GCC source.
+  }     
+  std_param_align = 4;  { for 32-bit version only }
+  
 
 {*****************************************************************************
                                   Helpers
@@ -491,7 +502,6 @@ const
     function newreference(const r : treference) : preference;
     procedure disposereference(var r : preference);
 
-    function reg2str(r : tregister) : string;
 
     function is_calljmp(o:tasmop):boolean;
 
@@ -525,10 +535,6 @@ implementation
                                   Helpers
 *****************************************************************************}
 
-    function reg2str(r : tregister) : string;
-      begin
-         reg2str:=mot_reg2str[r];
-      end;
 
 
     function is_calljmp(o:tasmop):boolean;
@@ -662,7 +668,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.7  2002-04-06 18:13:02  jonas
+  Revision 1.8  2002-04-20 21:41:51  carl
+  * renamed some constants
+
+  Revision 1.7  2002/04/06 18:13:02  jonas
     * several powerpc-related additions and fixes
 
   Revision 1.6  2001/12/30 17:24:48  jonas