mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-17 03:59:28 +02:00
* let the ARM code generator use the generic tcg.a_load_ref_cgpara() instead
of its own buggy version o added support to the generic version to override part of the functionality needed to implement an ARM quirk git-svn-id: trunk@41335 -
This commit is contained in:
parent
e0ada1ced9
commit
d99d1f1f30
@ -42,7 +42,9 @@ unit cgcpu;
|
||||
cgsetflags : boolean;
|
||||
|
||||
procedure a_load_const_cgpara(list : TAsmList;size : tcgsize;a : tcgint;const paraloc : TCGPara);override;
|
||||
procedure a_load_ref_cgpara(list : TAsmList;size : tcgsize;const r : treference;const paraloc : TCGPara);override;
|
||||
protected
|
||||
procedure a_load_ref_cgparalocref(list: TAsmList; sourcesize: tcgsize; sizeleft: tcgint; const ref, paralocref: treference; const cgpara: tcgpara; const location: PCGParaLocation); override;
|
||||
public
|
||||
procedure a_loadaddr_ref_cgpara(list : TAsmList;const r : treference;const paraloc : TCGPara);override;
|
||||
|
||||
procedure a_call_name(list : TAsmList;const s : string; weak: boolean);override;
|
||||
@ -571,52 +573,16 @@ unit cgcpu;
|
||||
end;
|
||||
|
||||
|
||||
procedure tbasecgarm.a_load_ref_cgpara(list : TAsmList;size : tcgsize;const r : treference;const paraloc : TCGPara);
|
||||
var
|
||||
tmpref, ref: treference;
|
||||
location: pcgparalocation;
|
||||
sizeleft: aint;
|
||||
procedure tbasecgarm.a_load_ref_cgparalocref(list: TAsmList; sourcesize: tcgsize; sizeleft: tcgint; const ref, paralocref: treference; const cgpara: tcgpara; const location: PCGParaLocation);
|
||||
begin
|
||||
location := paraloc.location;
|
||||
tmpref := r;
|
||||
sizeleft := paraloc.intsize;
|
||||
while assigned(location) do
|
||||
{ doubles in softemu mode have a strange order of registers and references }
|
||||
if (cgpara.size=OS_F64) and
|
||||
(location^.size=OS_32) then
|
||||
begin
|
||||
paramanager.allocparaloc(list,location);
|
||||
case location^.loc of
|
||||
LOC_REGISTER,LOC_CREGISTER:
|
||||
a_load_ref_reg(list,location^.size,location^.size,tmpref,location^.register);
|
||||
LOC_REFERENCE:
|
||||
begin
|
||||
reference_reset_base(ref,location^.reference.index,location^.reference.offset,ctempposinvalid,paraloc.alignment,[]);
|
||||
{ doubles in softemu mode have a strange order of registers and references }
|
||||
if location^.size=OS_32 then
|
||||
g_concatcopy(list,tmpref,ref,4)
|
||||
else
|
||||
begin
|
||||
g_concatcopy(list,tmpref,ref,sizeleft);
|
||||
if assigned(location^.next) then
|
||||
internalerror(2005010710);
|
||||
end;
|
||||
end;
|
||||
LOC_FPUREGISTER,LOC_CFPUREGISTER:
|
||||
case location^.size of
|
||||
OS_F32, OS_F64:
|
||||
a_loadfpu_ref_reg(list,location^.size,location^.size,tmpref,location^.register);
|
||||
else
|
||||
internalerror(2002072801);
|
||||
end;
|
||||
LOC_VOID:
|
||||
begin
|
||||
// nothing to do
|
||||
end;
|
||||
else
|
||||
internalerror(2002081103);
|
||||
end;
|
||||
inc(tmpref.offset,tcgsize2size[location^.size]);
|
||||
dec(sizeleft,tcgsize2size[location^.size]);
|
||||
location := location^.next;
|
||||
end;
|
||||
g_concatcopy(list,ref,paralocref,4)
|
||||
end
|
||||
else
|
||||
inherited;
|
||||
end;
|
||||
|
||||
|
||||
|
@ -170,6 +170,9 @@ unit cgobj;
|
||||
@param(cgpara where the parameter will be stored)
|
||||
}
|
||||
procedure a_load_ref_cgpara(list : TAsmList;size : tcgsize;const r : treference;const cgpara : TCGPara);virtual;
|
||||
protected
|
||||
procedure a_load_ref_cgparalocref(list: TAsmList; sourcesize: tcgsize; sizeleft: tcgint; const ref, paralocref: treference; const cgpara: tcgpara; const location: PCGParaLocation); virtual;
|
||||
public
|
||||
{# Pass the value of a parameter, which can be located either in a register or memory location,
|
||||
to a routine.
|
||||
|
||||
@ -1129,16 +1132,8 @@ implementation
|
||||
end;
|
||||
LOC_REFERENCE,LOC_CREFERENCE:
|
||||
begin
|
||||
if assigned(location^.next) then
|
||||
internalerror(2010052906);
|
||||
reference_reset_base(ref,location^.reference.index,location^.reference.offset,ctempposinvalid,newalignment(cgpara.alignment,cgpara.intsize-sizeleft),[]);
|
||||
if (size <> OS_NO) and
|
||||
(tcgsize2size[size] <= sizeof(aint)) then
|
||||
a_load_ref_ref(list,size,location^.size,tmpref,ref)
|
||||
else
|
||||
{ use concatcopy, because the parameter can be larger than }
|
||||
{ what the OS_* constants can handle }
|
||||
g_concatcopy(list,tmpref,ref,sizeleft);
|
||||
reference_reset_base(ref,location^.reference.index,location^.reference.offset,ctempposinvalid,newalignment(cgpara.alignment,cgpara.intsize-sizeleft),[]);
|
||||
a_load_ref_cgparalocref(list,size,sizeleft,tmpref,ref,cgpara,location);
|
||||
end;
|
||||
LOC_MMREGISTER,LOC_CMMREGISTER:
|
||||
begin
|
||||
@ -1153,6 +1148,10 @@ implementation
|
||||
else
|
||||
internalerror(2010053101);
|
||||
end;
|
||||
end;
|
||||
LOC_FPUREGISTER,LOC_CFPUREGISTER:
|
||||
begin
|
||||
a_loadfpu_ref_reg(list,size,location^.size,tmpref,location^.register);
|
||||
end
|
||||
else
|
||||
internalerror(2010053111);
|
||||
@ -1163,6 +1162,19 @@ implementation
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure tcg.a_load_ref_cgparalocref(list: TAsmList; sourcesize: tcgsize; sizeleft: tcgint; const ref, paralocref: treference; const cgpara: tcgpara; const location: PCGParaLocation);
|
||||
begin
|
||||
if assigned(location^.next) then
|
||||
internalerror(2010052906);
|
||||
if (sourcesize<>OS_NO) and
|
||||
(tcgsize2size[sourcesize]<=sizeof(aint)) then
|
||||
a_load_ref_ref(list,sourcesize,location^.size,ref,paralocref)
|
||||
else
|
||||
{ use concatcopy, because the parameter can be larger than }
|
||||
{ what the OS_* constants can handle }
|
||||
g_concatcopy(list,ref,paralocref,sizeleft);
|
||||
end;
|
||||
|
||||
|
||||
procedure tcg.a_load_loc_cgpara(list : TAsmList;const l:tlocation;const cgpara : TCGPara);
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user