* don't try to add current_procinfo.got to used_in_proc if it's a

virtual register
  * always add EBX to used_in_proc in case pi_needs_got, because it's
    currently always used due to the geteipasebx call
  * don't explicitly free the PIC register in the exitcode because
    then the assembler optimizer assumes the load restoring it (ebx)
    can be safely removed

git-svn-id: trunk@8683 -
This commit is contained in:
Jonas Maebe 2007-09-29 20:24:51 +00:00
parent 633a902565
commit 3a60a28283

View File

@ -95,8 +95,13 @@ unit cgcpu;
procedure tcg386.do_register_allocation(list:TAsmList;headertai:tai);
begin
if pi_needs_got in current_procinfo.flags then
include(rg[R_INTREGISTER].used_in_proc,getsupreg(current_procinfo.got));
if (pi_needs_got in current_procinfo.flags) then
begin
if getsupreg(current_procinfo.got) < first_int_imreg then
include(rg[R_INTREGISTER].used_in_proc,getsupreg(current_procinfo.got));
{ ebx is currently always used (do to getiepasebx call) }
include(rg[R_INTREGISTER].used_in_proc,RS_EBX);
end;
inherited do_register_allocation(list,headertai);
end;
@ -248,10 +253,6 @@ unit cgcpu;
var
stacksize : longint;
begin
{ Release PIC register }
if cs_create_pic in current_settings.moduleswitches then
list.concat(tai_regalloc.dealloc(NR_PIC_OFFSET_REG,nil));
{ MMX needs to call EMMS }
if assigned(rg[R_MMXREGISTER]) and
(rg[R_MMXREGISTER].uses_registers) then