llvm: replaced boolean fields in tllvmcallpara with a set

This commit is contained in:
Jonas Maebe 2022-05-22 22:07:51 +02:00
parent 573b2554f4
commit aa43441ac9
4 changed files with 12 additions and 11 deletions

View File

@ -209,14 +209,16 @@ interface
destructor destroy; override; destructor destroy; override;
end; end;
tllvmcallparaflag = (lcp_byval, lcp_sret);
tllvmcallparaflags = set of tllvmcallparaflag;
{ parameter to an llvm call instruction } { parameter to an llvm call instruction }
pllvmcallpara = ^tllvmcallpara; pllvmcallpara = ^tllvmcallpara;
tllvmcallpara = record tllvmcallpara = record
def: tdef; def: tdef;
alignment: shortint; alignment: shortint;
valueext: tllvmvalueextension; valueext: tllvmvalueextension;
byval, flags: tllvmcallparaflags;
sret: boolean;
case typ: toptype of case typ: toptype of
top_none: (); top_none: ();
top_reg: (register: tregister); top_reg: (register: tregister);

View File

@ -350,9 +350,9 @@ implementation
owner.writer.AsmWrite(llvmencodetypename(para^.def)); owner.writer.AsmWrite(llvmencodetypename(para^.def));
if para^.valueext<>lve_none then if para^.valueext<>lve_none then
owner.writer.AsmWrite(llvmvalueextension2str[para^.valueext]); owner.writer.AsmWrite(llvmvalueextension2str[para^.valueext]);
if para^.byval then if lcp_byval in para^.flags then
owner.writer.AsmWrite(llvmparatypeattr(' byval',para^.def,true)); owner.writer.AsmWrite(llvmparatypeattr(' byval',para^.def,true));
if para^.sret then if lcp_sret in para^.flags then
owner.writer.AsmWrite(llvmparatypeattr(' sret',para^.def,true)); owner.writer.AsmWrite(llvmparatypeattr(' sret',para^.def,true));
if asmblock and if asmblock and
(llvmflag_opaque_ptr_transition in llvmversion_properties[current_settings.llvmversion]) and (llvmflag_opaque_ptr_transition in llvmversion_properties[current_settings.llvmversion]) and

View File

@ -476,21 +476,21 @@ implementation
while assigned(paraloc) do while assigned(paraloc) do
begin begin
new(callpara); new(callpara);
callpara^.flags:=[];
callpara^.def:=paraloc^.def; callpara^.def:=paraloc^.def;
{ if the paraloc doesn't contain the value itself, it's a byval { if the paraloc doesn't contain the value itself, it's a byval
parameter } parameter }
if paraloc^.retvalloc then if paraloc^.retvalloc then
begin begin
callpara^.sret:=true; include(callpara^.flags,lcp_sret);
callpara^.byval:=false;
end end
else else
begin begin
callpara^.sret:=false; if not paraloc^.llvmvalueloc then
callpara^.byval:=not paraloc^.llvmvalueloc; include(callpara^.flags,lcp_byval);
end; end;
if firstparaloc and if firstparaloc and
callpara^.byval then (lcp_byval in callpara^.flags) then
callpara^.alignment:=paras[i]^.Alignment callpara^.alignment:=paras[i]^.Alignment
else else
callpara^.alignment:=std_param_align; callpara^.alignment:=std_param_align;

View File

@ -89,8 +89,7 @@ interface
if (sym.typ=paravarsym) and if (sym.typ=paravarsym) and
paramanager.push_addr_param(sym.varspez,sym.vardef,current_procinfo.procdef.proccalloption) then paramanager.push_addr_param(sym.varspez,sym.vardef,current_procinfo.procdef.proccalloption) then
callpara^.def:=cpointerdef.getreusable(callpara^.def); callpara^.def:=cpointerdef.getreusable(callpara^.def);
callpara^.sret:=false; callpara^.flags:=[];
callpara^.byval:=false;
callpara^.valueext:=lve_none; callpara^.valueext:=lve_none;
callpara^.typ:=top_reg; callpara^.typ:=top_reg;
{ address must be a temp register } { address must be a temp register }