Browse Source

* register parameters are now LOC_CREGISTER instead of LOC_REGISTER

Jonas Maebe 23 years ago
parent
commit
bfbf0ea7c6
2 changed files with 44 additions and 30 deletions
  1. 32 29
      compiler/cgobj.pas
  2. 12 1
      compiler/paramgr.pas

+ 32 - 29
compiler/cgobj.pas

@@ -25,7 +25,7 @@
 {# @abstract(Abstract code generator unit)
 {# @abstract(Abstract code generator unit)
    Abstreact code generator unit. This contains the base class
    Abstreact code generator unit. This contains the base class
    to implement for all new supported processors.
    to implement for all new supported processors.
-   
+
    WARNING: None of the routines implemented in these modules,
    WARNING: None of the routines implemented in these modules,
    or their descendants, should use the temp. allocator, as
    or their descendants, should use the temp. allocator, as
    these routines may be called inside genentrycode, and the
    these routines may be called inside genentrycode, and the
@@ -249,22 +249,22 @@ unit cgobj;
           procedure g_flags2reg(list: taasmoutput; size: TCgSize; const f: tresflags; reg: TRegister); virtual; abstract;
           procedure g_flags2reg(list: taasmoutput; size: TCgSize; const f: tresflags; reg: TRegister); virtual; abstract;
           procedure g_flags2ref(list: taasmoutput; size: TCgSize; const f: tresflags; const ref:TReference); virtual;
           procedure g_flags2ref(list: taasmoutput; size: TCgSize; const f: tresflags; const ref:TReference); virtual;
 
 
-          
+
          {#
          {#
              This routine is used in exception management nodes. It should
              This routine is used in exception management nodes. It should
              save the exception reason currently in the accumulator. The
              save the exception reason currently in the accumulator. The
-             save should be done either to a temp (pointed to by href). 
+             save should be done either to a temp (pointed to by href).
              or on the stack (pushing the value on the stack).
              or on the stack (pushing the value on the stack).
-             
-             The size of the value to save is OS_S32. 
+
+             The size of the value to save is OS_S32.
           }
           }
          procedure g_exception_reason_save(list : taasmoutput; const href : treference);virtual;
          procedure g_exception_reason_save(list : taasmoutput; const href : treference);virtual;
          {#
          {#
              This routine is used in exception management nodes. It should
              This routine is used in exception management nodes. It should
              save the exception reason constant. The
              save the exception reason constant. The
-             save should be done either to a temp (pointed to by href). 
+             save should be done either to a temp (pointed to by href).
              or on the stack (pushing the value on the stack).
              or on the stack (pushing the value on the stack).
-             
+
              The size of the value to save is OS_S32
              The size of the value to save is OS_S32
           }
           }
          procedure g_exception_reason_save_const(list : taasmoutput; const href : treference; a: aword);virtual;
          procedure g_exception_reason_save_const(list : taasmoutput; const href : treference; a: aword);virtual;
@@ -273,11 +273,11 @@ unit cgobj;
              load the exception reason to the accumulator. The saved value
              load the exception reason to the accumulator. The saved value
              should either be in the temp. area (pointed to by href , href should
              should either be in the temp. area (pointed to by href , href should
              *NOT* be freed) or on the stack (the value should be popped).
              *NOT* be freed) or on the stack (the value should be popped).
-             
-             The size of the value to restore is OS_S32. 
+
+             The size of the value to restore is OS_S32.
           }
           }
          procedure g_exception_reason_load(list : taasmoutput; const href : treference);virtual;
          procedure g_exception_reason_load(list : taasmoutput; const href : treference);virtual;
-          
+
 
 
           procedure g_maybe_loadself(list : taasmoutput);virtual;
           procedure g_maybe_loadself(list : taasmoutput);virtual;
           {# This should emit the opcode to copy len bytes from the source
           {# This should emit the opcode to copy len bytes from the source
@@ -316,7 +316,7 @@ unit cgobj;
              the runtime library. The default behavior
              the runtime library. The default behavior
              does not need to be modified, as it is generic
              does not need to be modified, as it is generic
              for all platforms.
              for all platforms.
-             
+
              @param(stackframesize Number of bytes which will be allocated on the stack)
              @param(stackframesize Number of bytes which will be allocated on the stack)
           }
           }
           procedure g_stackcheck(list : taasmoutput;stackframesize : longint);virtual;
           procedure g_stackcheck(list : taasmoutput;stackframesize : longint);virtual;
@@ -358,19 +358,19 @@ unit cgobj;
           {# Emits instruction for allocating the locals in entry
           {# Emits instruction for allocating the locals in entry
              code of a routine. This is one of the first
              code of a routine. This is one of the first
              routine called in @var(genentrycode).
              routine called in @var(genentrycode).
-             
+
              @param(localsize Number of bytes to allocate as locals)
              @param(localsize Number of bytes to allocate as locals)
           }
           }
           procedure g_stackframe_entry(list : taasmoutput;localsize : longint);virtual; abstract;
           procedure g_stackframe_entry(list : taasmoutput;localsize : longint);virtual; abstract;
-          {# Emits instructiona for restoring the frame pointer 
+          {# Emits instructiona for restoring the frame pointer
              at routine exit. For some processors, this routine
              at routine exit. For some processors, this routine
              may do nothing at all.
              may do nothing at all.
           }
           }
           procedure g_restore_frame_pointer(list : taasmoutput);virtual; abstract;
           procedure g_restore_frame_pointer(list : taasmoutput);virtual; abstract;
           {# Emits instructions for returning from a subroutine.
           {# Emits instructions for returning from a subroutine.
-             Should also restore the stack. 
-             
-             @param(parasize  Number of bytes of parameters to deallocate from stack)   
+             Should also restore the stack.
+
+             @param(parasize  Number of bytes of parameters to deallocate from stack)
           }
           }
           procedure g_return_from_proc(list : taasmoutput;parasize : aword);virtual; abstract;
           procedure g_return_from_proc(list : taasmoutput;parasize : aword);virtual; abstract;
           procedure g_call_constructor_helper(list : taasmoutput);virtual;
           procedure g_call_constructor_helper(list : taasmoutput);virtual;
@@ -419,8 +419,8 @@ unit cgobj;
         procedure a_param64_const(list : taasmoutput;value : qword;const loc : tparalocation);virtual;abstract;
         procedure a_param64_const(list : taasmoutput;value : qword;const loc : tparalocation);virtual;abstract;
         procedure a_param64_ref(list : taasmoutput;const r : treference;const loc : tparalocation);virtual;abstract;
         procedure a_param64_ref(list : taasmoutput;const r : treference;const loc : tparalocation);virtual;abstract;
         procedure a_param64_loc(list : taasmoutput;const l : tlocation;const loc : tparalocation);virtual;abstract;
         procedure a_param64_loc(list : taasmoutput;const l : tlocation;const loc : tparalocation);virtual;abstract;
-        
-        
+
+
 
 
         { override to catch 64bit rangechecks }
         { override to catch 64bit rangechecks }
         procedure g_rangecheck64(list: taasmoutput; const p: tnode;
         procedure g_rangecheck64(list: taasmoutput; const p: tnode;
@@ -526,7 +526,7 @@ unit cgobj;
 
 
       begin
       begin
          case locpara.loc of
          case locpara.loc of
-            LOC_REGISTER:
+            LOC_REGISTER,LOC_CREGISTER:
               a_load_reg_reg(list,size,r,locpara.register);
               a_load_reg_reg(list,size,r,locpara.register);
             LOC_REFERENCE:
             LOC_REFERENCE:
               begin
               begin
@@ -1427,25 +1427,25 @@ unit cgobj;
     procedure tcg.g_profilecode(list : taasmoutput);
     procedure tcg.g_profilecode(list : taasmoutput);
       begin
       begin
       end;
       end;
-      
-      
+
+
     procedure tcg.g_exception_reason_save(list : taasmoutput; const href : treference);
     procedure tcg.g_exception_reason_save(list : taasmoutput; const href : treference);
      begin
      begin
        a_load_reg_ref(exprasmlist, OS_S32, accumulator, href);
        a_load_reg_ref(exprasmlist, OS_S32, accumulator, href);
      end;
      end;
-     
+
     procedure tcg.g_exception_reason_save_const(list : taasmoutput; const href : treference; a: aword);
     procedure tcg.g_exception_reason_save_const(list : taasmoutput; const href : treference; a: aword);
      begin
      begin
        a_load_const_ref(list, OS_S32, a, href);
        a_load_const_ref(list, OS_S32, a, href);
      end;
      end;
-     
+
     procedure tcg.g_exception_reason_load(list : taasmoutput; const href : treference);
     procedure tcg.g_exception_reason_load(list : taasmoutput; const href : treference);
      begin
      begin
        a_load_ref_reg(list, OS_S32, href, accumulator);
        a_load_ref_reg(list, OS_S32, href, accumulator);
      end;
      end;
-     
-    
-      
+
+
+
 
 
 
 
     procedure tcg64.a_op64_const_reg_reg(list: taasmoutput;op:TOpCG;value : qword;regsrc,regdst : tregister64);
     procedure tcg64.a_op64_const_reg_reg(list: taasmoutput;op:TOpCG;value : qword;regsrc,regdst : tregister64);
@@ -1460,8 +1460,8 @@ unit cgobj;
         a_load64_reg_reg(list,regsrc2,regdst);
         a_load64_reg_reg(list,regsrc2,regdst);
         a_op64_reg_reg(list,op,regsrc1,regdst);
         a_op64_reg_reg(list,op,regsrc1,regdst);
       end;
       end;
-      
-      
+
+
 
 
 
 
 finalization
 finalization
@@ -1470,7 +1470,10 @@ finalization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.44  2002-08-09 19:10:05  carl
+  Revision 1.45  2002-08-10 17:15:20  jonas
+    * register parameters are now LOC_CREGISTER instead of LOC_REGISTER
+
+  Revision 1.44  2002/08/09 19:10:05  carl
     - moved new_exception and free_exception to ncgutils
     - moved new_exception and free_exception to ncgutils
 
 
   Revision 1.43  2002/08/05 18:27:48  carl
   Revision 1.43  2002/08/05 18:27:48  carl

+ 12 - 1
compiler/paramgr.pas

@@ -162,6 +162,14 @@ unit paramgr;
                 ((vo_regable in tvarsym(hp.parasym).varoptions) or
                 ((vo_regable in tvarsym(hp.parasym).varoptions) or
                  (vo_fpuregable in tvarsym(hp.parasym).varoptions)) then
                  (vo_fpuregable in tvarsym(hp.parasym).varoptions)) then
                 begin
                 begin
+                   case hp.paraloc.loc of
+                     LOC_REGISTER:
+                       hp.paraloc.loc := LOC_CREGISTER;
+                     LOC_FPUREGISTER:
+                       hp.paraloc.loc := LOC_CFPUREGISTER;
+                     LOC_MMREGISTER:
+                       hp.paraloc.loc := LOC_CMMREGISTER;
+                   end;
                    tvarsym(hp.parasym).reg:=hp.paraloc.register;
                    tvarsym(hp.parasym).reg:=hp.paraloc.register;
                    rg.regvar_loaded[hp.paraloc.register]:=true;
                    rg.regvar_loaded[hp.paraloc.register]:=true;
                 end;
                 end;
@@ -175,7 +183,10 @@ end.
 
 
 {
 {
    $Log$
    $Log$
-   Revision 1.9  2002-08-09 07:33:02  florian
+   Revision 1.10  2002-08-10 17:15:20  jonas
+     * register parameters are now LOC_CREGISTER instead of LOC_REGISTER
+
+   Revision 1.9  2002/08/09 07:33:02  florian
      * a couple of interface related fixes
      * a couple of interface related fixes
 
 
    Revision 1.8  2002/08/06 20:55:21  florian
    Revision 1.8  2002/08/06 20:55:21  florian