mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-22 19:29:24 +02:00
* implemented emitting items in a vectorized dead strippable section to
high level typed constant builder * converted resource string emission to this system git-svn-id: trunk@32395 -
This commit is contained in:
parent
96b529072a
commit
91abc54314
@ -249,7 +249,7 @@ type
|
||||
{ finalize the asmlist: add the necessary symbols etc }
|
||||
procedure finalize_asmlist(sym: tasmsymbol; def: tdef; section: TAsmSectiontype; const secname: TSymStr; alignment: shortint; const options: ttcasmlistoptions); virtual;
|
||||
{ functionality of the above for vectorized dead strippable sections }
|
||||
procedure finalize_vectorized_dead_strip_asmlist(def: tdef; const basename: string; st: tsymtable; alignment: shortint; options: ttcasmlistoptions); virtual;
|
||||
procedure finalize_vectorized_dead_strip_asmlist(def: tdef; const basename, itemname: TSymStr; st: tsymtable; alignment: shortint; options: ttcasmlistoptions); virtual;
|
||||
|
||||
{ called by the public emit_tai() routines to actually add the typed
|
||||
constant data; the public ones also take care of adding extra padding
|
||||
@ -408,7 +408,7 @@ type
|
||||
contents to another list first. This property should only be accessed
|
||||
once all data has been added. }
|
||||
function get_final_asmlist(sym: tasmsymbol; def: tdef; section: TAsmSectiontype; const secname: TSymStr; alignment: longint): tasmlist;
|
||||
function get_final_asmlist_vectorized_dead_strip(def: tdef; const basename: string; st: TSymtable; alignment: longint): tasmlist;
|
||||
function get_final_asmlist_vectorized_dead_strip(def: tdef; const basename, itemname: TSymStr; st: TSymtable; alignment: longint): tasmlist;
|
||||
|
||||
{ returns the offset of the string data relative to ansi/unicode/widestring
|
||||
constant labels. On most platforms, this is 0 (with the header at a
|
||||
@ -939,7 +939,7 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
procedure ttai_typedconstbuilder.finalize_vectorized_dead_strip_asmlist(def: tdef; const basename: string; st: tsymtable; alignment: shortint; options: ttcasmlistoptions);
|
||||
procedure ttai_typedconstbuilder.finalize_vectorized_dead_strip_asmlist(def: tdef; const basename, itemname: TSymStr; st: tsymtable; alignment: shortint; options: ttcasmlistoptions);
|
||||
var
|
||||
sym: tasmsymbol;
|
||||
secname: TSymStr;
|
||||
@ -949,18 +949,27 @@ implementation
|
||||
secend:=false;
|
||||
if tcalo_vectorized_dead_strip_start in options then
|
||||
begin
|
||||
{ the start and end names are predefined }
|
||||
if itemname<>'' then
|
||||
internalerror(2015110801);
|
||||
sym:=get_vectorized_dead_strip_section_symbol_start(basename,st,true);
|
||||
secname:=make_mangledname(basename,st,'1_START');
|
||||
end
|
||||
else if tcalo_vectorized_dead_strip_end in options then
|
||||
begin
|
||||
{ the start and end names are predefined }
|
||||
if itemname<>'' then
|
||||
internalerror(2015110802);
|
||||
sym:=get_vectorized_dead_strip_section_symbol_end(basename,st,true);
|
||||
make_mangledname(basename,st,'3_END');
|
||||
secend:=true;
|
||||
end
|
||||
else if tcalo_vectorized_dead_strip_item in options then
|
||||
{ todo }
|
||||
internalerror(2015110601);
|
||||
begin
|
||||
sym:=current_asmdata.DefineAsmSymbol(make_mangledname(basename,st,itemname),AB_GLOBAL,AT_DATA);
|
||||
secname:=make_mangledname(basename,st,'2_'+itemname);
|
||||
exclude(options,tcalo_vectorized_dead_strip_item);
|
||||
end;
|
||||
finalize_asmlist(sym,def,sec_data,secname,alignment,options);
|
||||
{ The darwin/ppc64 assembler or linker seems to have trouble }
|
||||
{ if a section ends with a global label without any data after it. }
|
||||
@ -995,11 +1004,11 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
function ttai_typedconstbuilder.get_final_asmlist_vectorized_dead_strip(def: tdef; const basename: string; st: TSymtable; alignment: longint): tasmlist;
|
||||
function ttai_typedconstbuilder.get_final_asmlist_vectorized_dead_strip(def: tdef; const basename, itemname: TSymStr; st: TSymtable; alignment: longint): tasmlist;
|
||||
begin
|
||||
if not fasmlist_finalized then
|
||||
begin
|
||||
finalize_vectorized_dead_strip_asmlist(def,basename,st,alignment,foptions);
|
||||
finalize_vectorized_dead_strip_asmlist(def,basename,itemname,st,alignment,foptions);
|
||||
fasmlist_finalized:=true;
|
||||
end;
|
||||
result:=fasmlist;
|
||||
|
@ -136,8 +136,7 @@ uses
|
||||
resstrlab : tasmsymbol;
|
||||
R : TResourceStringItem;
|
||||
resstrdef: tdef;
|
||||
tcb,
|
||||
datatcb : ttai_typedconstbuilder;
|
||||
tcb : ttai_typedconstbuilder;
|
||||
begin
|
||||
resstrdef:=search_system_type('TRESOURCESTRINGRECORD').typedef;
|
||||
|
||||
@ -155,7 +154,7 @@ uses
|
||||
tcb.maybe_end_aggregate(resstrdef);
|
||||
current_asmdata.asmlists[al_resourcestrings].concatList(
|
||||
tcb.get_final_asmlist_vectorized_dead_strip(
|
||||
resstrdef,'RESSTR',current_module.localsymtable,sizeof(pint)
|
||||
resstrdef,'RESSTR','',current_module.localsymtable,sizeof(pint)
|
||||
)
|
||||
);
|
||||
tcb.free;
|
||||
@ -164,19 +163,16 @@ uses
|
||||
R:=TResourceStringItem(List.First);
|
||||
while assigned(R) do
|
||||
begin
|
||||
datatcb:=ctai_typedconstbuilder.create([tcalo_make_dead_strippable,tcalo_new_section]);
|
||||
{ Write default value }
|
||||
tcb:=ctai_typedconstbuilder.create([tcalo_new_section,tcalo_vectorized_dead_strip_item]);
|
||||
if assigned(R.value) and (R.len<>0) then
|
||||
valuelab:=datatcb.emit_ansistring_const(current_asmdata.asmlists[al_const],R.Value,R.Len,getansistringcodepage)
|
||||
valuelab:=tcb.emit_ansistring_const(current_asmdata.asmlists[al_const],R.Value,R.Len,getansistringcodepage)
|
||||
else
|
||||
begin
|
||||
valuelab.lab:=nil;
|
||||
valuelab.ofs:=0;
|
||||
end;
|
||||
{ Append the name as a ansistring. }
|
||||
current_asmdata.asmlists[al_const].concat(cai_align.Create(const_align(sizeof(pint))));
|
||||
namelab:=datatcb.emit_ansistring_const(current_asmdata.asmlists[al_const],@R.Name[1],length(R.name),getansistringcodepage);
|
||||
|
||||
namelab:=tcb.emit_ansistring_const(current_asmdata.asmlists[al_const],@R.Name[1],length(R.name),getansistringcodepage);
|
||||
{
|
||||
Resourcestring index:
|
||||
TResourceStringRecord = Packed Record
|
||||
@ -186,20 +182,18 @@ uses
|
||||
HashValue : LongWord;
|
||||
end;
|
||||
}
|
||||
new_section(current_asmdata.asmlists[al_resourcestrings],sec_data,make_mangledname('RESSTR',current_module.localsymtable,'2_'+r.name),sizeof(pint));
|
||||
resstrlab:=current_asmdata.DefineAsmSymbol(make_mangledname('RESSTR',R.Sym.owner,R.Sym.name),AB_GLOBAL,AT_DATA);
|
||||
current_asmdata.asmlists[al_resourcestrings].concat(tai_symbol.Create_global(resstrlab,0));
|
||||
current_asmdata.asmlists[al_resourcestrings].concat(tai_const.Create_sym_offset(namelab.lab,namelab.ofs));
|
||||
current_asmdata.asmlists[al_resourcestrings].concat(tai_const.Create_sym_offset(valuelab.lab,valuelab.ofs));
|
||||
current_asmdata.asmlists[al_resourcestrings].concat(tai_const.Create_sym_offset(valuelab.lab,valuelab.ofs));
|
||||
current_asmdata.asmlists[al_resourcestrings].concat(tai_const.create_32bit(longint(R.Hash)));
|
||||
{$ifdef cpu64bitaddr}
|
||||
current_asmdata.asmlists[al_resourcestrings].concat(tai_const.create_32bit(0));
|
||||
{$endif cpu64bitaddr}
|
||||
current_asmdata.asmlists[al_resourcestrings].concat(tai_symbol_end.create(resstrlab));
|
||||
tcb.maybe_begin_aggregate(resstrdef);
|
||||
tcb.emit_string_offset(namelab,length(current_module.localsymtable.name^),st_ansistring,false,charpointertype);
|
||||
tcb.emit_string_offset(valuelab,R.Len,st_ansistring,false,charpointertype);
|
||||
tcb.emit_string_offset(valuelab,R.Len,st_ansistring,false,charpointertype);
|
||||
tcb.emit_ord_const(R.hash,u32inttype);
|
||||
tcb.maybe_end_aggregate(resstrdef);
|
||||
current_asmdata.asmlists[al_resourcestrings].concatList(
|
||||
tcb.get_final_asmlist_vectorized_dead_strip(
|
||||
resstrdef,'RESSTR',R.Sym.Name,R.Sym.Owner,sizeof(pint))
|
||||
);
|
||||
R:=TResourceStringItem(R.Next);
|
||||
{ nothing has been emited to the datatcb itself }
|
||||
datatcb.free;
|
||||
tcb.free;
|
||||
end;
|
||||
tcb:=ctai_typedconstbuilder.create([tcalo_new_section,tcalo_vectorized_dead_strip_end]);
|
||||
tcb.begin_anonymous_record(internaltypeprefixName[itp_emptyrec],
|
||||
@ -208,7 +202,7 @@ uses
|
||||
targetinfos[target_info.system]^.alignment.maxCrecordalign);
|
||||
current_asmdata.AsmLists[al_resourcestrings].concatList(
|
||||
tcb.get_final_asmlist_vectorized_dead_strip(
|
||||
tcb.end_anonymous_record,'RESSTR',current_module.localsymtable,sizeof(pint)
|
||||
tcb.end_anonymous_record,'RESSTR','',current_module.localsymtable,sizeof(pint)
|
||||
)
|
||||
);
|
||||
tcb.free;
|
||||
|
Loading…
Reference in New Issue
Block a user