mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-19 14:19:31 +02:00
* set null-pointer-is-valid attribute on functions, so that LLVM does not
optimise provable accesses to null as undefined behaviour (requires LLVM/Clang 7.0 or later) git-svn-id: branches/debug_eh@42055 -
This commit is contained in:
parent
6d597e1286
commit
d74b0843df
@ -1004,6 +1004,7 @@ implementation
|
||||
|
||||
procedure WriteFunctionFlags(pd: tprocdef);
|
||||
begin
|
||||
{ function attributes }
|
||||
if (pos('FPC_SETJMP',upper(pd.mangledname))<>0) or
|
||||
(pd.mangledname=(target_info.cprefix+'setjmp')) then
|
||||
writer.AsmWrite(' returns_twice');
|
||||
@ -1019,6 +1020,8 @@ implementation
|
||||
writer.AsmWrite(' nobuiltin');
|
||||
if po_noreturn in pd.procoptions then
|
||||
writer.AsmWrite(' noreturn');
|
||||
if llvmflag_null_pointer_valid in llvmversion_properties[current_settings.llvmversion] then
|
||||
writer.AsmWrite(' "null-pointer-is-valid"="true"');
|
||||
end;
|
||||
|
||||
|
||||
|
@ -73,7 +73,8 @@ type
|
||||
llvmflag_call_no_ptr, { with direct calls, the function type is not a function pointer }
|
||||
llvmflag_alias_double_type, { with "alias" declarations, have to print both aliasee and aliasee* types }
|
||||
llvmflag_fembed_bitcode, { support embedding bitcode in object files }
|
||||
llvmflag_memcpy_indiv_align { memcpy intrinsic supports separate alignment for source and dest }
|
||||
llvmflag_memcpy_indiv_align, { memcpy intrinsic supports separate alignment for source and dest }
|
||||
llvmflag_null_pointer_valid { supports "llvmflag_null_pointer_valid" attribute, which indicates access to nil should not be optimized as undefined behaviour }
|
||||
);
|
||||
tllvmversionflags = set of tllvmversionflag;
|
||||
|
||||
@ -136,9 +137,9 @@ Const
|
||||
{ llvmver_6_0 } [llvmflag_load_getelptr_type,llvmflag_call_no_ptr,llvmflag_alias_double_type,llvmflag_fembed_bitcode],
|
||||
{ llvmver_xc_10_0 } [llvmflag_load_getelptr_type,llvmflag_call_no_ptr,llvmflag_alias_double_type,llvmflag_fembed_bitcode],
|
||||
{ llvmver_xc_10_1 } [llvmflag_load_getelptr_type,llvmflag_call_no_ptr,llvmflag_alias_double_type,llvmflag_fembed_bitcode],
|
||||
{ llvmver_7_0 } [llvmflag_load_getelptr_type,llvmflag_call_no_ptr,llvmflag_alias_double_type,llvmflag_fembed_bitcode,llvmflag_memcpy_indiv_align],
|
||||
{ llvmver_7_1 } [llvmflag_load_getelptr_type,llvmflag_call_no_ptr,llvmflag_alias_double_type,llvmflag_fembed_bitcode,llvmflag_memcpy_indiv_align],
|
||||
{ llvmver_8_0 } [llvmflag_load_getelptr_type,llvmflag_call_no_ptr,llvmflag_alias_double_type,llvmflag_fembed_bitcode,llvmflag_memcpy_indiv_align]
|
||||
{ llvmver_7_0 } [llvmflag_load_getelptr_type,llvmflag_call_no_ptr,llvmflag_alias_double_type,llvmflag_fembed_bitcode,llvmflag_memcpy_indiv_align,llvmflag_null_pointer_valid],
|
||||
{ llvmver_7_1 } [llvmflag_load_getelptr_type,llvmflag_call_no_ptr,llvmflag_alias_double_type,llvmflag_fembed_bitcode,llvmflag_memcpy_indiv_align,llvmflag_null_pointer_valid],
|
||||
{ llvmver_8_0 } [llvmflag_load_getelptr_type,llvmflag_call_no_ptr,llvmflag_alias_double_type,llvmflag_fembed_bitcode,llvmflag_memcpy_indiv_align,llvmflag_null_pointer_valid]
|
||||
);
|
||||
|
||||
{ Supported optimizations, only used for information }
|
||||
|
Loading…
Reference in New Issue
Block a user