Explorar o código

* MIPS: pi_needs_got is necessary when doing unsigned to float conversions (it uses a global constant) and also if procedure does any calls in PIC mode.

git-svn-id: trunk@24822 -
sergei %!s(int64=12) %!d(string=hai) anos
pai
achega
86637a9ff9
Modificáronse 2 ficheiros con 13 adicións e 7 borrados
  1. 8 4
      compiler/mips/cpupi.pas
  2. 5 3
      compiler/mips/ncpucnv.pas

+ 8 - 4
compiler/mips/cpupi.pas

@@ -129,10 +129,14 @@ implementation
 
     procedure TMIPSProcInfo.allocate_got_register(list:tasmlist);
       begin
-        if (cs_create_pic in current_settings.moduleswitches) and
-           (pi_needs_got in flags) and
-           not (po_nostackframe in procdef.procoptions) then
-          tg.gettemp(list,sizeof(aint),sizeof(aint),tt_noreuse,save_gp_ref);
+        if (cs_create_pic in current_settings.moduleswitches) then
+          begin
+            if (pi_do_call in flags) then
+              include(flags,pi_needs_got);
+            if (pi_needs_got in flags) and
+               not (po_nostackframe in procdef.procoptions) then
+              tg.gettemp(list,sizeof(aint),sizeof(aint),tt_noreuse,save_gp_ref);
+          end;
       end;
 
 

+ 5 - 3
compiler/mips/ncpucnv.pas

@@ -71,8 +71,6 @@ uses
 *****************************************************************************}
 
 function tmipseltypeconvnode.first_int_to_real: tnode;
-var
-  fname: string[19];
 begin
   { converting a 64bit integer to a float requires a helper }
   if is_64bitint(left.resultdef) or
@@ -87,7 +85,11 @@ begin
       if is_signed(left.resultdef) then
         inserttypeconv(left,s32inttype)
       else
-        inserttypeconv(left,u32inttype);
+        begin
+          inserttypeconv(left,u32inttype);
+          if (cs_create_pic in current_settings.moduleswitches) then
+            include(current_procinfo.flags,pi_needs_got);
+        end;
       firstpass(left);
     end;
   result := nil;