From 43e0eb3cfd03e2505bf951075b1287da9de9deed Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Thu, 6 Mar 2014 21:40:36 +0000 Subject: [PATCH] + llvmaggregatetype() helper that returns whether a def is represented by an aggregate type in llvm git-svn-id: branches/hlcgllvm@26986 - --- compiler/llvm/llvmdef.pas | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/compiler/llvm/llvmdef.pas b/compiler/llvm/llvmdef.pas index cdbc7268d1..26adc41df4 100644 --- a/compiler/llvm/llvmdef.pas +++ b/compiler/llvm/llvmdef.pas @@ -41,6 +41,10 @@ interface function llvmencodeproctype(def: tabstractprocdef; withprocname, withparanames: boolean): TSymStr; procedure llvmaddencodedproctype(def: tabstractprocdef; withprocname, withparanames: boolean; var encodedstr: TSymStr); + { returns whether a def is representated by an aggregate type in llvm + (struct, array) } + function llvmaggregatetype(def: tdef): boolean; + implementation @@ -56,6 +60,20 @@ implementation Type encoding *******************************************************************} + function llvmaggregatetype(def: tdef): boolean; + begin + result:= + (def.typ in [recorddef,filedef,variantdef]) or + ((def.typ=arraydef) and + not is_dynamic_array(def)) or + ((def.typ=setdef) and + not is_smallset(def)) or + is_shortstring(def) or + is_object(def) or + ((def.typ=procvardef) and + not tprocvardef(def).is_addressonly) + end; + procedure llvmaddencodedtype(def: tdef; inaggregate: boolean; var encodedstr: TSymStr); begin