Browse Source

* synchronized with trunk

git-svn-id: branches/wasm@46804 -
nickysn 5 years ago
parent
commit
12acd8e06d
2 changed files with 12 additions and 12 deletions
  1. 11 1
      compiler/ncgutil.pas
  2. 1 11
      compiler/riscv32/cpupara.pas

+ 11 - 1
compiler/ncgutil.pas

@@ -625,8 +625,18 @@ implementation
           regtype:=getregtype(reg);
           while true do
             begin
-              cg.rg[regtype].set_reg_initial_location(reg,loc.reference);
               regsize:=tcgsize2size[reg_cgsize(reg)];
+{$ifndef x86}
+              { The size of the stack parameter must be not less than
+                the size of the register because the spilling code for
+                most CPU targets spills whole registers.
+                
+                Spilling of sub registers is supported for x86.
+              }
+              if (paraloc<>nil) and (regsize>tcgsize2size[paraloc^.Size]) then
+                break;
+{$endif x86}
+              cg.rg[regtype].set_reg_initial_location(reg,loc.reference);
               dec(size,regsize);
               if size<=0 then
                 break;

+ 1 - 11
compiler/riscv32/cpupara.pas

@@ -93,7 +93,7 @@ unit cpupara;
                if nr=0 then
                  internalerror(200309271);
                loc:=LOC_REGISTER;
-               register:=newreg(R_INTREGISTER,RS_X10+nr,R_SUBWHOLE);
+               register:=newreg(R_INTREGISTER,RS_X10+nr-1,R_SUBWHOLE);
              end
            else
              begin
@@ -419,16 +419,6 @@ unit cpupara;
                           paraloc^.size:=paracgsize;
                           paraloc^.def:=locdef;
                         end;
-                      { aix requires that record data stored in parameter
-                        registers is left-aligned }
-                      if (target_info.system in systems_aix) and
-                         (paradef.typ = recorddef) and
-                         (paralen < sizeof(aint)) then
-                        begin
-                          paraloc^.shiftval := (sizeof(aint)-paralen)*(-8);
-                          paraloc^.size := OS_INT;
-                          paraloc^.def := u32inttype;
-                        end;
                       paraloc^.register:=newreg(R_INTREGISTER,nextintreg,R_SUBNONE);
                       inc(nextintreg);
                       dec(paralen,tcgsize2size[paraloc^.size]);