mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 02:26:20 +02:00
* add some llvm function flags
o in particular, mark fpc_setjmp as "returns_twice" so calls to it are never converted into tail calls git-svn-id: trunk@31659 -
This commit is contained in:
parent
faf4a9cb38
commit
75012405fa
@ -713,6 +713,24 @@ implementation
|
|||||||
|
|
||||||
procedure TLLVMAssember.WriteTai(const replaceforbidden: boolean; const do_line: boolean; var InlineLevel: cardinal; var asmblock: boolean; var hp: tai);
|
procedure TLLVMAssember.WriteTai(const replaceforbidden: boolean; const do_line: boolean; var InlineLevel: cardinal; var asmblock: boolean; var hp: tai);
|
||||||
|
|
||||||
|
procedure WriteFunctionFlags(pd: tprocdef);
|
||||||
|
begin
|
||||||
|
if (pos('FPC_SETJMP',upper(pd.mangledname))<>0) or
|
||||||
|
(pd.mangledname=(target_info.cprefix+'setjmp')) then
|
||||||
|
writer.AsmWrite(' returns_twice');
|
||||||
|
if po_inline in pd.procoptions then
|
||||||
|
writer.AsmWrite(' inlinehint');
|
||||||
|
{ ensure that functions that happen to have the same name as a
|
||||||
|
standard C library function, but which are implemented in Pascal,
|
||||||
|
are not considered to have the same semantics as the C function with
|
||||||
|
the same name }
|
||||||
|
if not(po_external in pd.procoptions) then
|
||||||
|
writer.AsmWrite(' nobuiltin');
|
||||||
|
if po_noreturn in pd.procoptions then
|
||||||
|
writer.AsmWrite(' noreturn');
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure WriteTypedConstData(hp: tai_abstracttypedconst);
|
procedure WriteTypedConstData(hp: tai_abstracttypedconst);
|
||||||
var
|
var
|
||||||
p: tai_abstracttypedconst;
|
p: tai_abstracttypedconst;
|
||||||
@ -918,12 +936,15 @@ implementation
|
|||||||
if not(ldf_definition in taillvmdecl(hp).flags) then
|
if not(ldf_definition in taillvmdecl(hp).flags) then
|
||||||
begin
|
begin
|
||||||
writer.AsmWrite('declare');
|
writer.AsmWrite('declare');
|
||||||
writer.AsmWriteln(llvmencodeproctype(tprocdef(taillvmdecl(hp).def), taillvmdecl(hp).namesym.name, lpd_decl));
|
writer.AsmWrite(llvmencodeproctype(tprocdef(taillvmdecl(hp).def), taillvmdecl(hp).namesym.name, lpd_decl));
|
||||||
|
WriteFunctionFlags(tprocdef(taillvmdecl(hp).def));
|
||||||
|
writer.AsmLn;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
writer.AsmWrite('define');
|
writer.AsmWrite('define');
|
||||||
writer.AsmWrite(llvmencodeproctype(tprocdef(taillvmdecl(hp).def), '', lpd_decl));
|
writer.AsmWrite(llvmencodeproctype(tprocdef(taillvmdecl(hp).def), '', lpd_decl));
|
||||||
|
WriteFunctionFlags(tprocdef(taillvmdecl(hp).def));
|
||||||
writer.AsmWriteln(' {');
|
writer.AsmWriteln(' {');
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user