summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2>2020-04-02 21:21:44 +0000
committerjonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2>2020-04-02 21:21:44 +0000
commit664c237d2c419df5f9cd7e7b60ea99e98a20baf5 (patch)
tree4b65e763924ab253e62d981f30d95f5b45dd3c89
parent064930d3ec8351ace3603d0bb5b3b8fab5a136d8 (diff)
downloadfpc-664c237d2c419df5f9cd7e7b60ea99e98a20baf5.tar.gz
* use typenames in more cases in the generated LLVM IR (results in smaller
IR in textual form) git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@44518 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r--compiler/llvm/llvmdef.pas22
-rw-r--r--compiler/llvm/llvmtype.pas6
2 files changed, 11 insertions, 17 deletions
diff --git a/compiler/llvm/llvmdef.pas b/compiler/llvm/llvmdef.pas
index f5e995f6c6..ef387bb5d6 100644
--- a/compiler/llvm/llvmdef.pas
+++ b/compiler/llvm/llvmdef.pas
@@ -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);
diff --git a/compiler/llvm/llvmtype.pas b/compiler/llvm/llvmtype.pas
index 594aabb430..e38c33ceae 100644
--- a/compiler/llvm/llvmtype.pas
+++ b/compiler/llvm/llvmtype.pas
@@ -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;