llvm: use formaldef rather than undefineddef for llvm_metadata

Better matches the intent, and fixes compilation issues on AArch64
This commit is contained in:
Jonas Maebe 2022-06-12 21:07:35 +02:00
parent 25999ad8ff
commit 3a34fc7be3
4 changed files with 32 additions and 8 deletions

View File

@ -538,9 +538,12 @@ implementation
end;
formaldef :
begin
{ var/const/out x (always treated as "pass by reference" -> don't
add extra "*" here) }
encodedstr:=encodedstr+'i8';
if def<>llvm_metadatatype then
{ var/const/out x (always treated as "pass by reference" -> don't
add extra "*" here) }
encodedstr:=encodedstr+'i8'
else
encodedstr:=encodedstr+'metadata'
end;
arraydef :
begin
@ -674,10 +677,7 @@ implementation
end;
undefineddef:
begin
if def=llvm_metadatatype then
encodedstr:=encodedstr+'metadata'
else
internalerror(2022052301);
internalerror(2022052301);
end;
errordef :
internalerror(2013100604);

View File

@ -45,6 +45,7 @@ unit llvmpara;
architecture-specific code, or whether we will have to integrate parts
into the various tcpuparamanager classes }
tllvmparamanager = class(tcpuparamanager)
function push_addr_param(varspez: tvarspez; def: tdef; calloption: tproccalloption): boolean; override;
procedure getcgtempparaloc(list: TAsmList; pd: tabstractprocdef; nr: longint; var cgpara: tcgpara); override;
function param_use_paraloc(const cgpara: tcgpara): boolean; override;
procedure createtempparaloc(list: TAsmList; calloption: tproccalloption; parasym: tparavarsym; can_use_final_stack_loc: boolean; var cgpara: TCGPara); override;
@ -72,6 +73,17 @@ unit llvmpara;
{ tllvmparamanager }
function tllvmparamanager.push_addr_param(varspez: tvarspez; def: tdef; calloption: tproccalloption): boolean;
begin
if def<>llvm_metadatatype then
begin
result:=inherited;
exit;
end;
result:=false;
end;
procedure tllvmparamanager.getcgtempparaloc(list: TAsmList; pd: tabstractprocdef; nr: longint; var cgpara: tcgpara);
begin
if (nr<1) or (nr>pd.paras.count) then

View File

@ -32,6 +32,7 @@ interface
type
tllvmcallparanode = class(tcgcallparanode)
procedure push_formal_para; override;
end;
tllvmcallnode = class(tcgcallnode)
@ -50,6 +51,16 @@ implementation
aasmbase,aasmdata,aasmllvm,
symconst,symdef;
procedure tllvmcallparanode.push_formal_para;
begin
if parasym.vardef<>llvm_metadatatype then
begin;
inherited;
exit;
end;
push_value_para;
end;
{*****************************************************************************
TLLVMCALLNODE
*****************************************************************************}
@ -131,6 +142,7 @@ implementation
end;
begin
ccallparanode:=tllvmcallparanode;
ccallnode:=tllvmcallnode;
end.

View File

@ -589,7 +589,7 @@ implementation
addtype('$qwordbool',bool64type);
{$ifdef llvm}
addtype('$llvmbool1',llvmbool1type);
llvm_metadatatype:=cundefineddef.create(true);
llvm_metadatatype:=cformaldef.create(false);
{ if this gets renamed, also adjust agllvm so it still writes the identifier of this type as "metadata" }
addtype('$metadata',llvm_metadatatype);
addtype('LLVMMetadata',llvm_metadatatype);