tllvmcallpara: record whether it's passed to metadata

Sometimes we need the def to store a the original def of the passed parameter,
e.g. for the first argument to llvm.dbg.addr
This commit is contained in:
Jonas Maebe 2022-05-27 21:23:09 +02:00
parent 41a6c5e967
commit a76085e463
3 changed files with 8 additions and 1 deletions

View File

@ -209,7 +209,7 @@ interface
destructor destroy; override;
end;
tllvmcallparaflag = (lcp_byval, lcp_sret);
tllvmcallparaflag = (lcp_byval, lcp_sret, lcp_metadata);
tllvmcallparaflags = set of tllvmcallparaflag;
tllvmcallparaval = record

View File

@ -347,6 +347,11 @@ implementation
if i<>0 then
owner.writer.AsmWrite(', ');
para:=pllvmcallpara(paras[i]);
if (lcp_metadata in para^.flags) and
(para^.def<>llvm_metadatatype) then
begin
owner.writer.AsmWrite('metadata ')
end;
owner.writer.AsmWrite(llvmencodetypename(para^.def));
if para^.valueext<>lve_none then
owner.writer.AsmWrite(llvmvalueextension2str[para^.valueext]);

View File

@ -476,6 +476,8 @@ implementation
while assigned(paraloc) do
begin
new(callpara,init(paraloc^.def,std_param_align,lve_none,[]));
if paras[i]^.def=llvm_metadatatype then
include(callpara^.flags,lcp_metadata);
callpara^.def:=paraloc^.def;
{ if the paraloc doesn't contain the value itself, it's a byval
parameter }