mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-24 01:19:18 +02:00
* made the allocation of labels for internal data in typed const builders
overridable, and implement those routines for llvm git-svn-id: branches/hlcgllvm@30348 -
This commit is contained in:
parent
e12bd99b59
commit
f631430775
@ -233,6 +233,13 @@ type
|
|||||||
section of type typ. Returns -1 if there is no such info yet }
|
section of type typ. Returns -1 if there is no such info yet }
|
||||||
function get_internal_data_section_index(typ: TAsmSectiontype): longint;
|
function get_internal_data_section_index(typ: TAsmSectiontype): longint;
|
||||||
|
|
||||||
|
{ get a start label for an internal data section (at the start of a
|
||||||
|
potentially dead-strippable part) }
|
||||||
|
function get_internal_data_section_start_label: tasmlabel; virtual;
|
||||||
|
{ get a label in the middle of an internal data section (no dead
|
||||||
|
stripping) }
|
||||||
|
function get_internal_data_section_internal_label: tasmlabel; virtual;
|
||||||
|
|
||||||
{ easy access to the top level aggregate information instance }
|
{ easy access to the top level aggregate information instance }
|
||||||
property curagginfo: taggregateinformation read getcurragginfo;
|
property curagginfo: taggregateinformation read getcurragginfo;
|
||||||
public
|
public
|
||||||
@ -700,6 +707,31 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function ttai_typedconstbuilder.get_internal_data_section_start_label: tasmlabel;
|
||||||
|
begin
|
||||||
|
{ on Darwin, dead code/data stripping happens based on non-temporary
|
||||||
|
labels (any label that doesn't start with "L" -- it doesn't have
|
||||||
|
to be global) }
|
||||||
|
if target_info.system in systems_darwin then
|
||||||
|
current_asmdata.getstaticdatalabel(result)
|
||||||
|
else if create_smartlink_library then
|
||||||
|
current_asmdata.getglobaldatalabel(result)
|
||||||
|
else
|
||||||
|
current_asmdata.getlocaldatalabel(result);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function ttai_typedconstbuilder.get_internal_data_section_internal_label: tasmlabel;
|
||||||
|
begin
|
||||||
|
if create_smartlink_library then
|
||||||
|
{ all labels need to be global in case they're in another object }
|
||||||
|
current_asmdata.getglobaldatalabel(result)
|
||||||
|
else
|
||||||
|
{ no special requirement for the label -> just get a local one }
|
||||||
|
current_asmdata.getlocaldatalabel(result);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function ttai_typedconstbuilder.aggregate_kind(def: tdef): ttypedconstkind;
|
function ttai_typedconstbuilder.aggregate_kind(def: tdef): ttypedconstkind;
|
||||||
begin
|
begin
|
||||||
if (def.typ in [recorddef,filedef,variantdef]) or
|
if (def.typ in [recorddef,filedef,variantdef]) or
|
||||||
@ -873,7 +905,7 @@ implementation
|
|||||||
doesn't have to be global) -> add a non-temporary lobel at the
|
doesn't have to be global) -> add a non-temporary lobel at the
|
||||||
start of every kind of subsection created in this builder }
|
start of every kind of subsection created in this builder }
|
||||||
if target_info.system in systems_darwin then
|
if target_info.system in systems_darwin then
|
||||||
current_asmdata.getstaticdatalabel(l)
|
l:=get_internal_data_section_start_label;
|
||||||
end;
|
end;
|
||||||
foundsec:=length(finternal_data_section_info);
|
foundsec:=length(finternal_data_section_info);
|
||||||
setlength(finternal_data_section_info,foundsec+1);
|
setlength(finternal_data_section_info,foundsec+1);
|
||||||
@ -882,13 +914,7 @@ implementation
|
|||||||
if not assigned(finternal_data_asmlist) and
|
if not assigned(finternal_data_asmlist) and
|
||||||
(cs_create_smart in current_settings.moduleswitches) then
|
(cs_create_smart in current_settings.moduleswitches) then
|
||||||
begin
|
begin
|
||||||
{ on Darwin, dead code/data stripping happens based on non-temporary
|
l:=get_internal_data_section_start_label;
|
||||||
labels (any label that doesn't start with "L" -- it doesn't have
|
|
||||||
to be global) }
|
|
||||||
if target_info.system in systems_darwin then
|
|
||||||
current_asmdata.getstaticdatalabel(l)
|
|
||||||
else if create_smartlink_library then
|
|
||||||
current_asmdata.getglobaldatalabel(l);
|
|
||||||
{ the internal data list should only be assigned by this routine,
|
{ the internal data list should only be assigned by this routine,
|
||||||
the first time that an internal data block is started }
|
the first time that an internal data block is started }
|
||||||
if not assigned(list) or
|
if not assigned(list) or
|
||||||
@ -906,12 +932,7 @@ implementation
|
|||||||
internalerror(2015032101);
|
internalerror(2015032101);
|
||||||
finternal_data_asmlist:=list;
|
finternal_data_asmlist:=list;
|
||||||
if not assigned(l) then
|
if not assigned(l) then
|
||||||
if create_smartlink_library then
|
l:=get_internal_data_section_internal_label;
|
||||||
{ all labels need to be global in case they're in another object }
|
|
||||||
current_asmdata.getglobaldatalabel(l)
|
|
||||||
else
|
|
||||||
{ no special requirement for the label -> just get a local one }
|
|
||||||
current_asmdata.getlocaldatalabel(l);
|
|
||||||
{ first section of this kind -> set name }
|
{ first section of this kind -> set name }
|
||||||
if finternal_data_section_info[foundsec].secname='' then
|
if finternal_data_section_info[foundsec].secname='' then
|
||||||
if secname='' then
|
if secname='' then
|
||||||
|
@ -68,6 +68,9 @@ interface
|
|||||||
procedure insert_marked_aggregate_alignment(def: tdef); override;
|
procedure insert_marked_aggregate_alignment(def: tdef); override;
|
||||||
procedure begin_aggregate_internal(def: tdef; anonymous: boolean); override;
|
procedure begin_aggregate_internal(def: tdef; anonymous: boolean); override;
|
||||||
procedure end_aggregate_internal(def: tdef; anonymous: boolean); override;
|
procedure end_aggregate_internal(def: tdef; anonymous: boolean); override;
|
||||||
|
|
||||||
|
function get_internal_data_section_start_label: tasmlabel; override;
|
||||||
|
function get_internal_data_section_internal_label: tasmlabel; override;
|
||||||
public
|
public
|
||||||
destructor destroy; override;
|
destructor destroy; override;
|
||||||
procedure emit_tai_procvar2procdef(p: tai; pvdef: tprocvardef); override;
|
procedure emit_tai_procvar2procdef(p: tai; pvdef: tprocvardef); override;
|
||||||
@ -325,6 +328,20 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function tllvmtai_typedconstbuilder.get_internal_data_section_start_label: tasmlabel;
|
||||||
|
begin
|
||||||
|
{ let llvm take care of everything by creating internal nameless
|
||||||
|
constants }
|
||||||
|
current_asmdata.getlocaldatalabel(result);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function tllvmtai_typedconstbuilder.get_internal_data_section_internal_label: tasmlabel;
|
||||||
|
begin
|
||||||
|
current_asmdata.getlocaldatalabel(result);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure tllvmtai_typedconstbuilder.queue_init(todef: tdef);
|
procedure tllvmtai_typedconstbuilder.queue_init(todef: tdef);
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
Loading…
Reference in New Issue
Block a user