mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-11 08:18:28 +02:00
ppc64: fix rtoc handling
Save on procedure entry if it performs a call, rather than (only) before every indirect call
This commit is contained in:
parent
6dd5b63e2d
commit
83c18df69a
@ -337,10 +337,6 @@ begin
|
|||||||
reference_reset_base(tmpref, reg, 0, ctempposinvalid, sizeof(pint), []);
|
reference_reset_base(tmpref, reg, 0, ctempposinvalid, sizeof(pint), []);
|
||||||
a_load_ref_reg(list, OS_ADDR, OS_ADDR, tmpref, tempreg);
|
a_load_ref_reg(list, OS_ADDR, OS_ADDR, tmpref, tempreg);
|
||||||
|
|
||||||
{ save TOC pointer in stackframe }
|
|
||||||
reference_reset_base(tmpref, NR_STACK_POINTER_REG, get_rtoc_offset, ctempposinvalid, 8, []);
|
|
||||||
a_load_reg_ref(list, OS_ADDR, OS_ADDR, NR_RTOC, tmpref);
|
|
||||||
|
|
||||||
{ move actual function pointer to CTR register }
|
{ move actual function pointer to CTR register }
|
||||||
list.concat(taicpu.op_reg(A_MTCTR, tempreg));
|
list.concat(taicpu.op_reg(A_MTCTR, tempreg));
|
||||||
|
|
||||||
@ -1273,6 +1269,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ save current RTOC for restoration after calls if necessary }
|
||||||
|
if pi_do_call in current_procinfo.flags then
|
||||||
|
begin
|
||||||
|
reference_reset_base(href,NR_STACK_POINTER_REG,get_rtoc_offset,ctempposinvalid,target_info.stackalign,[]);
|
||||||
|
a_load_reg_ref(list,OS_ADDR,OS_ADDR,NR_RTOC,href);
|
||||||
|
end;
|
||||||
|
|
||||||
{ CR register not used by FPC atm }
|
{ CR register not used by FPC atm }
|
||||||
|
|
||||||
{ keep R1 allocated??? }
|
{ keep R1 allocated??? }
|
||||||
|
Loading…
Reference in New Issue
Block a user