Переглянути джерело

* base compiler patches to improve C parameter passing compatibility on powerpc64/linux

git-svn-id: trunk@1983 -
tom_at_work 19 роки тому
батько
коміт
b53ee04f98
2 змінених файлів з 20 додано та 3 видалено
  1. 8 2
      compiler/ncgutil.pas
  2. 12 1
      compiler/parabase.pas

+ 8 - 2
compiler/ncgutil.pas

@@ -1282,8 +1282,14 @@ implementation
            href : treference;
          begin
             case paraloc.loc of
-              LOC_REGISTER :
-                cg.a_load_reg_ref(list,paraloc.size,paraloc.size,paraloc.register,ref);
+              LOC_REGISTER : 
+                begin
+                  {$IFDEF CPUPOWERPC64}
+                  if (paraloc.shiftval <> 0) then
+                    cg.a_op_const_reg_reg(list, OP_SHL, OS_INT, paraloc.shiftval, paraloc.register, paraloc.register);
+                  {$ENDIF CPUPOWERPC64}
+                  cg.a_load_reg_ref(list,paraloc.size,paraloc.size,paraloc.register,ref);
+                end;
               LOC_MMREGISTER :
                 cg.a_loadmm_reg_ref(list,paraloc.size,paraloc.size,paraloc.register,ref,mms_movescalar);
               LOC_FPUREGISTER :

+ 12 - 1
compiler/parabase.pas

@@ -46,7 +46,18 @@ unit parabase;
            LOC_MMREGISTER,
            LOC_CMMREGISTER,
            LOC_REGISTER,
-           LOC_CREGISTER : (register : tregister);
+           LOC_CREGISTER : (
+             { The number of bits the value in the register must be shifted to the left before
+             it can be stored to memory in the function prolog.
+             This is used for passing OS_NO memory blocks less than register size and of "odd"
+             (3, 5, 6, 7) size on big endian machines, so that small memory blocks passed via
+             registers are properly aligned.
+
+             E.g. the value $5544433 is passed in bits 40-63 of the register (others are zero),
+             but they should actually be stored in the first bits of the stack location reserved
+             for this value. So they have to be shifted left by this amount of bits before. }
+             {$IFDEF CPUPOWERPC64}shiftval : byte;{$ENDIF CPUPOWERPC64}
+             register : tregister);
        end;
 
        TCGPara = object