mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-15 10:51:08 +02:00
* use typenames in more cases in the generated LLVM IR (results in smaller
IR in textual form) git-svn-id: trunk@44518 -
This commit is contained in:
parent
afd0ae44ee
commit
d5de84c6c5
@ -48,8 +48,8 @@ interface
|
|||||||
tllvmprocdefdecltype = (lpd_def,lpd_decl,lpd_alias,lpd_procvar);
|
tllvmprocdefdecltype = (lpd_def,lpd_decl,lpd_alias,lpd_procvar);
|
||||||
|
|
||||||
{ returns the identifier to use as typename for a def in llvm (llvm only
|
{ returns the identifier to use as typename for a def in llvm (llvm only
|
||||||
allows naming struct types) -- only supported for defs with a typesym, and
|
allows naming struct types) -- only supported for tabstractrecorddef
|
||||||
only for tabstractrecorddef descendantds and complex procvars }
|
descendantds and complex procvars }
|
||||||
function llvmtypeidentifier(def: tdef): TSymStr;
|
function llvmtypeidentifier(def: tdef): TSymStr;
|
||||||
|
|
||||||
{ encode a type into the internal format used by LLVM (for a type
|
{ encode a type into the internal format used by LLVM (for a type
|
||||||
@ -130,9 +130,10 @@ implementation
|
|||||||
|
|
||||||
function llvmtypeidentifier(def: tdef): TSymStr;
|
function llvmtypeidentifier(def: tdef): TSymStr;
|
||||||
begin
|
begin
|
||||||
if not assigned(def.typesym) then
|
if assigned(def.typesym) then
|
||||||
internalerror(2015041901);
|
result:='%"typ.'+def.fullownerhierarchyname(false)+def.typesym.realname+'"'
|
||||||
result:='%"typ.'+def.fullownerhierarchyname(false)+def.typesym.realname+'"'
|
else
|
||||||
|
result:='%"typ.'+def.fullownerhierarchyname(false)+def.unique_id_str+'"';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -444,9 +445,7 @@ implementation
|
|||||||
recorddef :
|
recorddef :
|
||||||
begin
|
begin
|
||||||
{ avoid endlessly recursive definitions }
|
{ avoid endlessly recursive definitions }
|
||||||
if assigned(def.typesym) and
|
if not(lef_typedecl in flags) then
|
||||||
((lef_inaggregate in flags) or
|
|
||||||
not(lef_typedecl in flags)) then
|
|
||||||
encodedstr:=encodedstr+llvmtypeidentifier(def)
|
encodedstr:=encodedstr+llvmtypeidentifier(def)
|
||||||
else
|
else
|
||||||
llvmaddencodedabstractrecordtype(trecorddef(def),encodedstr);
|
llvmaddencodedabstractrecordtype(trecorddef(def),encodedstr);
|
||||||
@ -537,9 +536,7 @@ implementation
|
|||||||
if def.typ=procvardef then
|
if def.typ=procvardef then
|
||||||
encodedstr:=encodedstr+'*';
|
encodedstr:=encodedstr+'*';
|
||||||
end
|
end
|
||||||
else if ((lef_inaggregate in flags) or
|
else if not(lef_typedecl in flags) then
|
||||||
not(lef_typedecl in flags)) and
|
|
||||||
assigned(tprocvardef(def).typesym) then
|
|
||||||
begin
|
begin
|
||||||
{ in case the procvardef recursively references itself, e.g.
|
{ in case the procvardef recursively references itself, e.g.
|
||||||
via a pointer }
|
via a pointer }
|
||||||
@ -569,8 +566,7 @@ implementation
|
|||||||
odt_object,
|
odt_object,
|
||||||
odt_cppclass:
|
odt_cppclass:
|
||||||
begin
|
begin
|
||||||
if not(lef_typedecl in flags) and
|
if not(lef_typedecl in flags) then
|
||||||
assigned(def.typesym) then
|
|
||||||
encodedstr:=encodedstr+llvmtypeidentifier(def)
|
encodedstr:=encodedstr+llvmtypeidentifier(def)
|
||||||
else
|
else
|
||||||
llvmaddencodedabstractrecordtype(tabstractrecorddef(def),encodedstr);
|
llvmaddencodedabstractrecordtype(tabstractrecorddef(def),encodedstr);
|
||||||
|
@ -574,8 +574,7 @@ implementation
|
|||||||
symdeflist:=tabstractrecordsymtable(def.symtable).llvmst.symdeflist;
|
symdeflist:=tabstractrecordsymtable(def.symtable).llvmst.symdeflist;
|
||||||
for i:=0 to symdeflist.Count-1 do
|
for i:=0 to symdeflist.Count-1 do
|
||||||
record_def(tllvmshadowsymtableentry(symdeflist[i]).def);
|
record_def(tllvmshadowsymtableentry(symdeflist[i]).def);
|
||||||
if assigned(def.typesym) then
|
list.concat(taillvm.op_size(LA_TYPE,record_def(def)));
|
||||||
list.concat(taillvm.op_size(LA_TYPE,record_def(def)));
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -605,8 +604,7 @@ implementation
|
|||||||
for i:=0 to def.paras.count-1 do
|
for i:=0 to def.paras.count-1 do
|
||||||
appenddef(list,llvmgetcgparadef(tparavarsym(def.paras[i]).paraloc[callerside],true,calleeside));
|
appenddef(list,llvmgetcgparadef(tparavarsym(def.paras[i]).paraloc[callerside],true,calleeside));
|
||||||
appenddef(list,llvmgetcgparadef(def.funcretloc[callerside],true,calleeside));
|
appenddef(list,llvmgetcgparadef(def.funcretloc[callerside],true,calleeside));
|
||||||
if assigned(def.typesym) and
|
if not def.is_addressonly then
|
||||||
not def.is_addressonly then
|
|
||||||
list.concat(taillvm.op_size(LA_TYPE,record_def(def)));
|
list.concat(taillvm.op_size(LA_TYPE,record_def(def)));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user