LLVM: remove flags used to support older LLVM versions

This commit is contained in:
Jonas Maebe 2024-01-07 15:23:15 +01:00
parent 2eaa6c5ced
commit 60e77de115
3 changed files with 34 additions and 53 deletions

View File

@ -1047,10 +1047,10 @@ implementation
writer.AsmWrite(' noreturn');
if pio_thunk in pd.implprocoptions then
writer.AsmWrite(' "thunk"');
if llvmflag_null_pointer_valid in llvmversion_properties[current_settings.llvmversion] then
writer.AsmWrite(' "null-pointer-is-valid"="true"')
else if llvmflag_null_pointer_valid_new in llvmversion_properties[current_settings.llvmversion] then
writer.AsmWrite(' null_pointer_is_valid');
if llvmflag_null_pointer_valid_new in llvmversion_properties[current_settings.llvmversion] then
writer.AsmWrite(' null_pointer_is_valid')
else
writer.AsmWrite(' "null-pointer-is-valid"="true"');
if not(pio_fastmath in pd.implprocoptions) then
writer.AsmWrite(' strictfp');
if cs_sanitize_address in current_settings.moduleswitches then

View File

@ -1271,7 +1271,6 @@ implementation
pd: tprocdef;
sourcepara, destpara, sizepara, alignpara, volatilepara: tcgpara;
maxalign: longint;
indivalign: boolean;
begin
{ perform small copies directly; not larger ones, because then llvm
will try to load the entire large datastructure into registers and
@ -1282,11 +1281,7 @@ implementation
a_load_ref_ref(list,size,size,source,dest);
exit;
end;
indivalign:=llvmflag_memcpy_indiv_align in llvmversion_properties[current_settings.llvmversion];
if indivalign then
pd:=search_system_proc('llvm_memcpy64_indivalign')
else
pd:=search_system_proc('llvm_memcpy64');
pd:=search_system_proc('llvm_memcpy64_indivalign');
sourcepara.init;
destpara.init;
sizepara.init;
@ -1295,27 +1290,14 @@ implementation
paramanager.getcgtempparaloc(list,pd,1,destpara);
paramanager.getcgtempparaloc(list,pd,2,sourcepara);
paramanager.getcgtempparaloc(list,pd,3,sizepara);
if indivalign then
begin
paramanager.getcgtempparaloc(list,pd,4,volatilepara);
destpara.Alignment:=-dest.alignment;
sourcepara.Alignment:=-source.alignment;
end
else
begin
paramanager.getcgtempparaloc(list,pd,4,alignpara);
paramanager.getcgtempparaloc(list,pd,5,volatilepara);
maxalign:=newalignment(max(source.alignment,dest.alignment),min(source.alignment,dest.alignment));
a_load_const_cgpara(list,u32inttype,maxalign,alignpara);
end;
paramanager.getcgtempparaloc(list,pd,4,volatilepara);
destpara.Alignment:=-dest.alignment;
sourcepara.Alignment:=-source.alignment;
a_loadaddr_ref_cgpara(list,size,dest,destpara);
a_loadaddr_ref_cgpara(list,size,source,sourcepara);
a_load_const_cgpara(list,u64inttype,size.size,sizepara);
a_load_const_cgpara(list,llvmbool1type,ord((vol_read in source.volatility) or (vol_write in dest.volatility)),volatilepara);
if indivalign then
g_call_system_proc(list,pd,[@destpara,@sourcepara,@sizepara,@volatilepara],nil).resetiftemp
else
g_call_system_proc(list,pd,[@destpara,@sourcepara,@sizepara,@alignpara,@volatilepara],nil).resetiftemp;
g_call_system_proc(list,pd,[@destpara,@sourcepara,@sizepara,@volatilepara],nil).resetiftemp;
sourcepara.done;
destpara.done;
sizepara.done;

View File

@ -64,12 +64,10 @@ Type
type
tllvmversionflag = (
llvmflag_memcpy_indiv_align, { memcpy intrinsic supports separate alignment for source and dest }
llvmflag_null_pointer_valid, { supports "null-pointer-is-valid" attribute, which indicates access to nil should not be optimized as undefined behaviour }
llvmflag_constrained_fptrunc_fpext, { supports constrained fptrunc and fpext intrinsics }
llvmflag_constrained_fptoi_itofp, { supports constrained fptosi/fptoui/uitofp/sitofp instrinsics }
llvmflag_generic_constrained_si64tofp, { supports sitofp for 64 bit signed integers on all targets }
llvmflag_null_pointer_valid_new, { new syntax for the null pointer valid attribute: null_pointer_is_valid }
llvmflag_null_pointer_valid_new, { new syntax for the null pointer valid attribute: null_pointer_is_valid (which indicates access to nil should not be optimized as undefined behaviour) }
llvmflag_array_datalocation, { arrays debug info supports a dataLocation attribute to specify how to obtain the array data based on the array variable }
llvmflag_NoDISPFlags, { no DI sub program flags, but separate fields }
llvmflag_NoDISPFlagMainSubprogram, { MainSubprogram still in DIFlags instead of DISPFlags }
@ -78,7 +76,8 @@ type
llvmflag_opaque_ptr, { only opaque pointers }
llvmflag_sanitizer_attributes, { can use attributes to exclude symbols from sanitizers }
llvmflag_no_freeze, { lacks the freeze opcode to clear undefined/poison values }
llvmflag_old_function_memory_attributes { old-style memory attributes for functions (not currently generated by FPC) }
llvmflag_old_function_memory_attributes, { old-style memory attributes for functions (not currently generated by FPC) }
llvmflag_no_threadlocal_address { no intrinsic to get threadlocal address }
);
tllvmversionflags = set of tllvmversionflag;
@ -138,28 +137,28 @@ Const
llvmversion_properties: array[tllvmversion] of tllvmversionflags =
(
{ invalid } [],
{ llvmver_7_0 } [llvmflag_memcpy_indiv_align,llvmflag_null_pointer_valid,llvmflag_NoDISPFlags,llvmflag_no_freeze, llvmflag_old_function_memory_attributes],
{ llvmver_7_1 } [llvmflag_memcpy_indiv_align,llvmflag_null_pointer_valid,llvmflag_NoDISPFlags,llvmflag_no_freeze, llvmflag_old_function_memory_attributes],
{ llvmver_8_0 } [llvmflag_memcpy_indiv_align,llvmflag_null_pointer_valid,llvmflag_NoDISPFlagMainSubprogram,llvmflag_no_freeze, llvmflag_old_function_memory_attributes],
{ llvmver_xc_11 } [llvmflag_memcpy_indiv_align,llvmflag_null_pointer_valid,llvmflag_NoDISPFlagMainSubprogram,llvmflag_no_freeze, llvmflag_old_function_memory_attributes],
{ llvmver_9_0 } [llvmflag_memcpy_indiv_align,llvmflag_null_pointer_valid,llvmflag_constrained_fptrunc_fpext,llvmflag_no_freeze, llvmflag_old_function_memory_attributes],
{ llvmver_xc_11_4 } [llvmflag_memcpy_indiv_align,llvmflag_null_pointer_valid,llvmflag_constrained_fptrunc_fpext,llvmflag_no_freeze, llvmflag_old_function_memory_attributes],
{ llvmver_10_0 } [llvmflag_memcpy_indiv_align,llvmflag_null_pointer_valid,llvmflag_constrained_fptrunc_fpext,llvmflag_constrained_fptoi_itofp, llvmflag_old_function_memory_attributes],
{ llvmver_xc_12_0 } [llvmflag_memcpy_indiv_align,llvmflag_null_pointer_valid,llvmflag_constrained_fptrunc_fpext,llvmflag_constrained_fptoi_itofp, llvmflag_old_function_memory_attributes],
{ llvmver_11_0 } [llvmflag_memcpy_indiv_align,llvmflag_null_pointer_valid_new,llvmflag_constrained_fptrunc_fpext,llvmflag_constrained_fptoi_itofp,llvmflag_array_datalocation, llvmflag_old_function_memory_attributes],
{ llvmver_11_1 } [llvmflag_memcpy_indiv_align,llvmflag_null_pointer_valid_new,llvmflag_constrained_fptrunc_fpext,llvmflag_constrained_fptoi_itofp,llvmflag_array_datalocation, llvmflag_old_function_memory_attributes],
{ llvmver_xc_12_5 } [llvmflag_memcpy_indiv_align,llvmflag_null_pointer_valid_new,llvmflag_constrained_fptrunc_fpext,llvmflag_constrained_fptoi_itofp,llvmflag_array_datalocation, llvmflag_old_function_memory_attributes],
{ llvmver_12_0 } [llvmflag_memcpy_indiv_align,llvmflag_null_pointer_valid_new,llvmflag_constrained_fptrunc_fpext,llvmflag_constrained_fptoi_itofp,llvmflag_array_datalocation,llvmflag_para_attr_type, llvmflag_old_function_memory_attributes],
{ llvmver_xc_13_0 } [llvmflag_memcpy_indiv_align,llvmflag_null_pointer_valid_new,llvmflag_constrained_fptrunc_fpext,llvmflag_constrained_fptoi_itofp,llvmflag_array_datalocation,llvmflag_para_attr_type, llvmflag_old_function_memory_attributes],
{ llvmver_13_0 } [llvmflag_memcpy_indiv_align,llvmflag_null_pointer_valid_new,llvmflag_constrained_fptrunc_fpext,llvmflag_constrained_fptoi_itofp,llvmflag_array_datalocation,llvmflag_para_attr_type, llvmflag_old_function_memory_attributes],
{ llvmver_xc_13_3 } [llvmflag_memcpy_indiv_align,llvmflag_null_pointer_valid_new,llvmflag_constrained_fptrunc_fpext,llvmflag_constrained_fptoi_itofp,llvmflag_array_datalocation,llvmflag_para_attr_type, llvmflag_old_function_memory_attributes],
{ llvmver_xc_14_0 } [llvmflag_memcpy_indiv_align,llvmflag_null_pointer_valid_new,llvmflag_constrained_fptrunc_fpext,llvmflag_constrained_fptoi_itofp,llvmflag_array_datalocation,llvmflag_para_attr_type,llvmflag_old_function_memory_attributes],
{ llvmver_14_0 } [llvmflag_memcpy_indiv_align,llvmflag_null_pointer_valid_new,llvmflag_constrained_fptrunc_fpext,llvmflag_constrained_fptoi_itofp,llvmflag_array_datalocation,llvmflag_para_attr_type,llvmflag_opaque_ptr_transition, llvmflag_old_function_memory_attributes],
{ llvmver_xc_14_3 } [llvmflag_memcpy_indiv_align,llvmflag_null_pointer_valid_new,llvmflag_constrained_fptrunc_fpext,llvmflag_constrained_fptoi_itofp,llvmflag_array_datalocation,llvmflag_para_attr_type,llvmflag_opaque_ptr,llvmflag_sanitizer_attributes, llvmflag_old_function_memory_attributes],
{ llvmver_15_0 } [llvmflag_memcpy_indiv_align,llvmflag_null_pointer_valid_new,llvmflag_constrained_fptrunc_fpext,llvmflag_constrained_fptoi_itofp,llvmflag_array_datalocation,llvmflag_para_attr_type,llvmflag_opaque_ptr,llvmflag_sanitizer_attributes, llvmflag_old_function_memory_attributes],
{ llvmver_16_0 } [llvmflag_memcpy_indiv_align,llvmflag_null_pointer_valid_new,llvmflag_constrained_fptrunc_fpext,llvmflag_constrained_fptoi_itofp,llvmflag_array_datalocation,llvmflag_para_attr_type,llvmflag_opaque_ptr,llvmflag_sanitizer_attributes],
{ llvmver_xc_15 } [llvmflag_memcpy_indiv_align,llvmflag_null_pointer_valid_new,llvmflag_constrained_fptrunc_fpext,llvmflag_constrained_fptoi_itofp,llvmflag_array_datalocation,llvmflag_para_attr_type,llvmflag_opaque_ptr,llvmflag_sanitizer_attributes],
{ llvmver_17_0 } [llvmflag_memcpy_indiv_align,llvmflag_null_pointer_valid_new,llvmflag_constrained_fptrunc_fpext,llvmflag_constrained_fptoi_itofp,llvmflag_array_datalocation,llvmflag_para_attr_type,llvmflag_opaque_ptr,llvmflag_sanitizer_attributes]
{ llvmver_7_0 } [llvmflag_NoDISPFlags,llvmflag_no_freeze, llvmflag_old_function_memory_attributes],
{ llvmver_7_1 } [llvmflag_NoDISPFlags,llvmflag_no_freeze, llvmflag_old_function_memory_attributes],
{ llvmver_8_0 } [llvmflag_NoDISPFlagMainSubprogram,llvmflag_no_freeze, llvmflag_old_function_memory_attributes],
{ llvmver_xc_11 } [llvmflag_NoDISPFlagMainSubprogram,llvmflag_no_freeze, llvmflag_old_function_memory_attributes],
{ llvmver_9_0 } [llvmflag_constrained_fptrunc_fpext,llvmflag_no_freeze, llvmflag_old_function_memory_attributes],
{ llvmver_xc_11_4 } [llvmflag_constrained_fptrunc_fpext,llvmflag_no_freeze, llvmflag_old_function_memory_attributes],
{ llvmver_10_0 } [llvmflag_constrained_fptrunc_fpext,llvmflag_constrained_fptoi_itofp, llvmflag_old_function_memory_attributes],
{ llvmver_xc_12_0 } [llvmflag_constrained_fptrunc_fpext,llvmflag_constrained_fptoi_itofp, llvmflag_old_function_memory_attributes],
{ llvmver_11_0 } [llvmflag_null_pointer_valid_new,llvmflag_constrained_fptrunc_fpext,llvmflag_constrained_fptoi_itofp,llvmflag_array_datalocation, llvmflag_old_function_memory_attributes],
{ llvmver_11_1 } [llvmflag_null_pointer_valid_new,llvmflag_constrained_fptrunc_fpext,llvmflag_constrained_fptoi_itofp,llvmflag_array_datalocation, llvmflag_old_function_memory_attributes],
{ llvmver_xc_12_5 } [llvmflag_null_pointer_valid_new,llvmflag_constrained_fptrunc_fpext,llvmflag_constrained_fptoi_itofp,llvmflag_array_datalocation, llvmflag_old_function_memory_attributes],
{ llvmver_12_0 } [llvmflag_null_pointer_valid_new,llvmflag_constrained_fptrunc_fpext,llvmflag_constrained_fptoi_itofp,llvmflag_array_datalocation,llvmflag_para_attr_type, llvmflag_old_function_memory_attributes],
{ llvmver_xc_13_0 } [llvmflag_null_pointer_valid_new,llvmflag_constrained_fptrunc_fpext,llvmflag_constrained_fptoi_itofp,llvmflag_array_datalocation,llvmflag_para_attr_type, llvmflag_old_function_memory_attributes],
{ llvmver_13_0 } [llvmflag_null_pointer_valid_new,llvmflag_constrained_fptrunc_fpext,llvmflag_constrained_fptoi_itofp,llvmflag_array_datalocation,llvmflag_para_attr_type, llvmflag_old_function_memory_attributes],
{ llvmver_xc_13_3 } [llvmflag_null_pointer_valid_new,llvmflag_constrained_fptrunc_fpext,llvmflag_constrained_fptoi_itofp,llvmflag_array_datalocation,llvmflag_para_attr_type, llvmflag_old_function_memory_attributes],
{ llvmver_xc_14_0 } [llvmflag_null_pointer_valid_new,llvmflag_constrained_fptrunc_fpext,llvmflag_constrained_fptoi_itofp,llvmflag_array_datalocation,llvmflag_para_attr_type,llvmflag_old_function_memory_attributes],
{ llvmver_14_0 } [llvmflag_null_pointer_valid_new,llvmflag_constrained_fptrunc_fpext,llvmflag_constrained_fptoi_itofp,llvmflag_array_datalocation,llvmflag_para_attr_type,llvmflag_opaque_ptr_transition, llvmflag_old_function_memory_attributes],
{ llvmver_xc_14_3 } [llvmflag_null_pointer_valid_new,llvmflag_constrained_fptrunc_fpext,llvmflag_constrained_fptoi_itofp,llvmflag_array_datalocation,llvmflag_para_attr_type,llvmflag_opaque_ptr,llvmflag_sanitizer_attributes, llvmflag_old_function_memory_attributes],
{ llvmver_15_0 } [llvmflag_null_pointer_valid_new,llvmflag_constrained_fptrunc_fpext,llvmflag_constrained_fptoi_itofp,llvmflag_array_datalocation,llvmflag_para_attr_type,llvmflag_opaque_ptr,llvmflag_sanitizer_attributes, llvmflag_old_function_memory_attributes],
{ llvmver_16_0 } [llvmflag_null_pointer_valid_new,llvmflag_constrained_fptrunc_fpext,llvmflag_constrained_fptoi_itofp,llvmflag_array_datalocation,llvmflag_para_attr_type,llvmflag_opaque_ptr,llvmflag_sanitizer_attributes],
{ llvmver_xc_15 } [llvmflag_null_pointer_valid_new,llvmflag_constrained_fptrunc_fpext,llvmflag_constrained_fptoi_itofp,llvmflag_array_datalocation,llvmflag_para_attr_type,llvmflag_opaque_ptr,llvmflag_sanitizer_attributes],
{ llvmver_17_0 } [llvmflag_null_pointer_valid_new,llvmflag_constrained_fptrunc_fpext,llvmflag_constrained_fptoi_itofp,llvmflag_array_datalocation,llvmflag_para_attr_type,llvmflag_opaque_ptr,llvmflag_sanitizer_attributes]
);
{ Supported optimizations, only used for information }