mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 06:29:16 +02:00
* don't emit 0-sized parameters for LLVM: clang doesn't either, and some
LLVM backends (like the AArch64 one) trigger internal errors when encountering them git-svn-id: trunk@40736 -
This commit is contained in:
parent
4d03f3a65e
commit
a72a12eef6
@ -434,6 +434,9 @@ implementation
|
|||||||
callparas:=tfplist.Create;
|
callparas:=tfplist.Create;
|
||||||
for i:=0 to high(paras) do
|
for i:=0 to high(paras) do
|
||||||
begin
|
begin
|
||||||
|
{ skip parameters without data }
|
||||||
|
if paras[i]^.isempty then
|
||||||
|
continue;
|
||||||
paraloc:=paras[i]^.location;
|
paraloc:=paras[i]^.location;
|
||||||
while assigned(paraloc) do
|
while assigned(paraloc) do
|
||||||
begin
|
begin
|
||||||
|
@ -682,9 +682,19 @@ implementation
|
|||||||
exit
|
exit
|
||||||
end;
|
end;
|
||||||
if withparaname then
|
if withparaname then
|
||||||
paraloc:=hp.paraloc[calleeside].location
|
begin
|
||||||
|
{ don't add parameters that don't take up registers or stack space;
|
||||||
|
clang doesn't either and some LLVM backends don't support them }
|
||||||
|
if hp.paraloc[calleeside].isempty then
|
||||||
|
exit;
|
||||||
|
paraloc:=hp.paraloc[calleeside].location
|
||||||
|
end
|
||||||
else
|
else
|
||||||
paraloc:=hp.paraloc[callerside].location;
|
begin
|
||||||
|
if hp.paraloc[callerside].isempty then
|
||||||
|
exit;
|
||||||
|
paraloc:=hp.paraloc[callerside].location;
|
||||||
|
end;
|
||||||
repeat
|
repeat
|
||||||
usedef:=paraloc^.def;
|
usedef:=paraloc^.def;
|
||||||
llvmextractvalueextinfo(hp.vardef,usedef,signext);
|
llvmextractvalueextinfo(hp.vardef,usedef,signext);
|
||||||
|
@ -118,6 +118,7 @@ unit parabase;
|
|||||||
function add_location:pcgparalocation;
|
function add_location:pcgparalocation;
|
||||||
procedure get_location(var newloc:tlocation);
|
procedure get_location(var newloc:tlocation);
|
||||||
function locations_count:integer;
|
function locations_count:integer;
|
||||||
|
function isempty: boolean; { no data, and not varargs para }
|
||||||
|
|
||||||
procedure buildderef;
|
procedure buildderef;
|
||||||
procedure deref;
|
procedure deref;
|
||||||
@ -161,7 +162,7 @@ implementation
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
systems,verbose,
|
systems,verbose,
|
||||||
symsym;
|
symsym,defutil;
|
||||||
|
|
||||||
|
|
||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
@ -317,6 +318,25 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function TCGPara.isempty: boolean;
|
||||||
|
var
|
||||||
|
hlocation: pcgparalocation;
|
||||||
|
begin
|
||||||
|
{ can happen if e.g. [] is passed to a cdecl varargs para }
|
||||||
|
if not assigned(def) then
|
||||||
|
exit(true);
|
||||||
|
if is_array_of_const(def) then
|
||||||
|
exit(false);
|
||||||
|
hlocation:=location;
|
||||||
|
while assigned(hlocation) do
|
||||||
|
begin
|
||||||
|
if hlocation^.Loc<>LOC_VOID then
|
||||||
|
exit(false);
|
||||||
|
hlocation:=hlocation^.next;
|
||||||
|
end;
|
||||||
|
result:=true;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCGPara.buildderef;
|
procedure TCGPara.buildderef;
|
||||||
begin
|
begin
|
||||||
defderef.build(def);
|
defderef.build(def);
|
||||||
|
Loading…
Reference in New Issue
Block a user