mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 05:09:19 +02:00
* changed llvmgettemprecorddef() to take an open array instead of a tfplist
as list of defs to be stored in the record, so we don't need to create and free a class instance every time we call this routine git-svn-id: trunk@35155 -
This commit is contained in:
parent
5850963ea9
commit
7503c2bd3e
@ -68,7 +68,7 @@ interface
|
|||||||
record consisting of 4 longints must be returned as a record consisting of
|
record consisting of 4 longints must be returned as a record consisting of
|
||||||
two int64's on x86-64. This function is used to create (and reuse)
|
two int64's on x86-64. This function is used to create (and reuse)
|
||||||
temporary recorddefs for such purposes.}
|
temporary recorddefs for such purposes.}
|
||||||
function llvmgettemprecorddef(fieldtypes: tfplist; packrecords, recordalignmin, maxcrecordalign: shortint): trecorddef;
|
function llvmgettemprecorddef(fieldtypes: array of tdef; packrecords, recordalignmin, maxcrecordalign: shortint): trecorddef;
|
||||||
|
|
||||||
{ get the llvm type corresponding to a parameter, e.g. a record containing
|
{ get the llvm type corresponding to a parameter, e.g. a record containing
|
||||||
two integer int64 for an arbitrary record split over two individual int64
|
two integer int64 for an arbitrary record split over two individual int64
|
||||||
@ -804,7 +804,7 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function llvmgettemprecorddef(fieldtypes: tfplist; packrecords, recordalignmin, maxcrecordalign: shortint): trecorddef;
|
function llvmgettemprecorddef(fieldtypes: array of tdef; packrecords, recordalignmin, maxcrecordalign: shortint): trecorddef;
|
||||||
var
|
var
|
||||||
i: longint;
|
i: longint;
|
||||||
res: PHashSetItem;
|
res: PHashSetItem;
|
||||||
@ -816,9 +816,9 @@ implementation
|
|||||||
typename: string;
|
typename: string;
|
||||||
begin
|
begin
|
||||||
typename:=internaltypeprefixName[itp_llvmstruct];
|
typename:=internaltypeprefixName[itp_llvmstruct];
|
||||||
for i:=0 to fieldtypes.count-1 do
|
for i:=low(fieldtypes) to high(fieldtypes) do
|
||||||
begin
|
begin
|
||||||
hdef:=tdef(fieldtypes[i]);
|
hdef:=fieldtypes[i];
|
||||||
case hdef.typ of
|
case hdef.typ of
|
||||||
orddef:
|
orddef:
|
||||||
case torddef(hdef).ordtype of
|
case torddef(hdef).ordtype of
|
||||||
@ -859,8 +859,8 @@ implementation
|
|||||||
begin
|
begin
|
||||||
res^.Data:=crecorddef.create_global_internal(typename,packrecords,
|
res^.Data:=crecorddef.create_global_internal(typename,packrecords,
|
||||||
recordalignmin,maxcrecordalign);
|
recordalignmin,maxcrecordalign);
|
||||||
for i:=0 to fieldtypes.count-1 do
|
for i:=low(fieldtypes) to high(fieldtypes) do
|
||||||
trecorddef(res^.Data).add_field_by_def('F'+tostr(i),tdef(fieldtypes[i]));
|
trecorddef(res^.Data).add_field_by_def('F'+tostr(i),fieldtypes[i]);
|
||||||
end;
|
end;
|
||||||
trecordsymtable(trecorddef(res^.Data).symtable).addalignmentpadding;
|
trecordsymtable(trecorddef(res^.Data).symtable).addalignmentpadding;
|
||||||
result:=trecorddef(res^.Data);
|
result:=trecorddef(res^.Data);
|
||||||
@ -869,10 +869,11 @@ implementation
|
|||||||
|
|
||||||
function llvmgetcgparadef(const cgpara: tcgpara; beforevalueext: boolean): tdef;
|
function llvmgetcgparadef(const cgpara: tcgpara; beforevalueext: boolean): tdef;
|
||||||
var
|
var
|
||||||
retdeflist: tfplist;
|
retdeflist: array[0..9] of tdef;
|
||||||
retloc: pcgparalocation;
|
retloc: pcgparalocation;
|
||||||
usedef: tdef;
|
usedef: tdef;
|
||||||
valueext: tllvmvalueextension;
|
valueext: tllvmvalueextension;
|
||||||
|
i: longint;
|
||||||
begin
|
begin
|
||||||
{ single location }
|
{ single location }
|
||||||
if not assigned(cgpara.location^.next) then
|
if not assigned(cgpara.location^.next) then
|
||||||
@ -898,13 +899,16 @@ implementation
|
|||||||
exit
|
exit
|
||||||
end;
|
end;
|
||||||
{ multiple locations -> create temp record }
|
{ multiple locations -> create temp record }
|
||||||
retdeflist:=tfplist.create;
|
|
||||||
retloc:=cgpara.location;
|
retloc:=cgpara.location;
|
||||||
|
i:=0;
|
||||||
repeat
|
repeat
|
||||||
retdeflist.add(retloc^.def);
|
if i>high(retdeflist) then
|
||||||
|
internalerror(2016121801);
|
||||||
|
retdeflist[i]:=retloc^.def;
|
||||||
|
inc(i);
|
||||||
retloc:=retloc^.next;
|
retloc:=retloc^.next;
|
||||||
until not assigned(retloc);
|
until not assigned(retloc);
|
||||||
result:=llvmgettemprecorddef(retdeflist,C_alignment,
|
result:=llvmgettemprecorddef(slice(retdeflist,i),C_alignment,
|
||||||
targetinfos[target_info.system]^.alignment.recordalignmin,
|
targetinfos[target_info.system]^.alignment.recordalignmin,
|
||||||
targetinfos[target_info.system]^.alignment.maxCrecordalign);
|
targetinfos[target_info.system]^.alignment.maxCrecordalign);
|
||||||
include(result.defoptions,df_llvm_no_struct_packing);
|
include(result.defoptions,df_llvm_no_struct_packing);
|
||||||
|
Loading…
Reference in New Issue
Block a user