瀏覽代碼

* fixed synchronising 64bit regvars on 32bit systems at the start and
end of procedures
* hack for ppc for loading of paras from their callee location to local
temps

Jonas Maebe 20 年之前
父節點
當前提交
fcf16c4983
共有 2 個文件被更改,包括 41 次插入9 次删除
  1. 30 7
      compiler/ncgutil.pas
  2. 11 2
      compiler/powerpc/cgcpu.pas

+ 30 - 7
compiler/ncgutil.pas

@@ -138,10 +138,6 @@ implementation
 *****************************************************************************}
 
     procedure location_free(list: taasmoutput; const location : TLocation);
-{$ifdef cputargethasfixedstack}
-      var
-        href : treference;
-{$endif cputargethasfixedstack}
       begin
         case location.loc of
           LOC_VOID:
@@ -1455,6 +1451,11 @@ implementation
           the initialization and body is parsed because the refcounts are
           incremented using the local copies }
         current_procinfo.procdef.parast.foreach_static({$ifndef TP}@{$endif}copyvalueparas,list);
+{$ifdef powerpc}
+        { unget the register that contains the stack pointer before the procedure entry, }
+        { which is used to access the parameters in their original callee-side location  }
+        cg.a_reg_dealloc(list,NR_R12);
+{$endif powerpc}
       end;
 
 
@@ -1978,7 +1979,15 @@ implementation
                             end;
                             { Allocate register already, to prevent first allocation to be
                               inside a loop }
-                            cg.a_reg_sync(list,localloc.register);
+{$ifndef cpu64bit}
+                            if cgsize in [OS_64,OS_S64] then
+                              begin
+                                cg.a_reg_sync(list,localloc.register64.reglo);
+                                cg.a_reg_sync(list,localloc.register64.reghi);
+                              end
+                            else
+{$endif cpu64bit}
+                              cg.a_reg_sync(list,localloc.register);
                           end
                         else
 {$endif NOT OLDREGVARS}
@@ -2063,7 +2072,15 @@ implementation
                       in the parent procedures }
                     case localloc.loc of
                       LOC_CREGISTER :
-                        cg.a_reg_sync(list,localloc.register);
+{$ifndef cpu64bit}
+                        if def_cgsize(vartype.def) in [OS_64,OS_S64] then
+                          begin
+                            cg.a_reg_sync(list,localloc.register64.reglo);
+                            cg.a_reg_sync(list,localloc.register64.reghi);
+                          end
+                        else
+{$endif cpu64bit}
+                          cg.a_reg_sync(list,localloc.register);
                       LOC_REFERENCE :
                         begin
                           case st.symtabletype of
@@ -2290,7 +2307,13 @@ implementation
 end.
 {
   $Log$
-  Revision 1.248  2004-12-11 01:03:01  jonas
+  Revision 1.249  2004-12-11 12:42:28  jonas
+    * fixed synchronising 64bit regvars on 32bit systems at the start and
+      end of procedures
+    * hack for ppc for loading of paras from their callee location to local
+      temps
+
+  Revision 1.248  2004/12/11 01:03:01  jonas
     * fixed int64 regvar bug in location_force_register
 
   Revision 1.247  2004/12/05 12:28:11  peter

+ 11 - 2
compiler/powerpc/cgcpu.pas

@@ -1169,8 +1169,11 @@ const
 
 { see "!!! always allocate space for all registers for now !!!" above }
 
+{        done in ncgutil because it may only be released after the parameters }
+{        have been moved to their final resting place                         }
 {        if usesfpr or usesgpr then }
-          a_reg_dealloc(list,NR_R12);
+{          a_reg_dealloc(list,NR_R12); }
+
 
         { if we didn't get the GOT pointer till now, we've to calculate it now }
         if not(gotgot) and (pi_needs_got in current_procinfo.flags) then
@@ -2293,7 +2296,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.187  2004-12-04 21:47:46  jonas
+  Revision 1.188  2004-12-11 12:42:28  jonas
+    * fixed synchronising 64bit regvars on 32bit systems at the start and
+      end of procedures
+    * hack for ppc for loading of paras from their callee location to local
+      temps
+
+  Revision 1.187  2004/12/04 21:47:46  jonas
     * modifications to work with the generic code to copy LOC_REFERENCE
       parameters to local temps (fixes tests/test/cg/tmanypara)