mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-13 12:49:20 +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);
|
||||
|
||||
{ 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
|
||||
only for tabstractrecorddef descendantds and complex procvars }
|
||||
allows naming struct types) -- only supported for tabstractrecorddef
|
||||
descendantds and complex procvars }
|
||||
function llvmtypeidentifier(def: tdef): TSymStr;
|
||||
|
||||
{ encode a type into the internal format used by LLVM (for a type
|
||||
@ -130,9 +130,10 @@ implementation
|
||||
|
||||
function llvmtypeidentifier(def: tdef): TSymStr;
|
||||
begin
|
||||
if not assigned(def.typesym) then
|
||||
internalerror(2015041901);
|
||||
result:='%"typ.'+def.fullownerhierarchyname(false)+def.typesym.realname+'"'
|
||||
if assigned(def.typesym) then
|
||||
result:='%"typ.'+def.fullownerhierarchyname(false)+def.typesym.realname+'"'
|
||||
else
|
||||
result:='%"typ.'+def.fullownerhierarchyname(false)+def.unique_id_str+'"';
|
||||
end;
|
||||
|
||||
|
||||
@ -444,9 +445,7 @@ implementation
|
||||
recorddef :
|
||||
begin
|
||||
{ avoid endlessly recursive definitions }
|
||||
if assigned(def.typesym) and
|
||||
((lef_inaggregate in flags) or
|
||||
not(lef_typedecl in flags)) then
|
||||
if not(lef_typedecl in flags) then
|
||||
encodedstr:=encodedstr+llvmtypeidentifier(def)
|
||||
else
|
||||
llvmaddencodedabstractrecordtype(trecorddef(def),encodedstr);
|
||||
@ -537,9 +536,7 @@ implementation
|
||||
if def.typ=procvardef then
|
||||
encodedstr:=encodedstr+'*';
|
||||
end
|
||||
else if ((lef_inaggregate in flags) or
|
||||
not(lef_typedecl in flags)) and
|
||||
assigned(tprocvardef(def).typesym) then
|
||||
else if not(lef_typedecl in flags) then
|
||||
begin
|
||||
{ in case the procvardef recursively references itself, e.g.
|
||||
via a pointer }
|
||||
@ -569,8 +566,7 @@ implementation
|
||||
odt_object,
|
||||
odt_cppclass:
|
||||
begin
|
||||
if not(lef_typedecl in flags) and
|
||||
assigned(def.typesym) then
|
||||
if not(lef_typedecl in flags) then
|
||||
encodedstr:=encodedstr+llvmtypeidentifier(def)
|
||||
else
|
||||
llvmaddencodedabstractrecordtype(tabstractrecorddef(def),encodedstr);
|
||||
|
@ -574,8 +574,7 @@ implementation
|
||||
symdeflist:=tabstractrecordsymtable(def.symtable).llvmst.symdeflist;
|
||||
for i:=0 to symdeflist.Count-1 do
|
||||
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;
|
||||
|
||||
|
||||
@ -605,8 +604,7 @@ implementation
|
||||
for i:=0 to def.paras.count-1 do
|
||||
appenddef(list,llvmgetcgparadef(tparavarsym(def.paras[i]).paraloc[callerside],true,calleeside));
|
||||
appenddef(list,llvmgetcgparadef(def.funcretloc[callerside],true,calleeside));
|
||||
if assigned(def.typesym) and
|
||||
not def.is_addressonly then
|
||||
if not def.is_addressonly then
|
||||
list.concat(taillvm.op_size(LA_TYPE,record_def(def)));
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user