mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-13 01:54:59 +01:00
* converted emitting pwidechar typed constants to the typed constant builder
git-svn-id: branches/hlcgllvm@28141 -
This commit is contained in:
parent
8afffdb176
commit
b94a524556
@ -393,7 +393,8 @@ implementation
|
|||||||
maybe_new_object_file(prelist);
|
maybe_new_object_file(prelist);
|
||||||
{ only now add items based on the symbolname, because it may be
|
{ only now add items based on the symbolname, because it may be
|
||||||
modified by the "section" specifier in case of a typed constant }
|
modified by the "section" specifier in case of a typed constant }
|
||||||
new_section(prelist,section,secname,const_align(alignment));
|
if section<>sec_none then
|
||||||
|
new_section(prelist,section,secname,const_align(alignment));
|
||||||
if not lab then
|
if not lab then
|
||||||
if sym.bind=AB_GLOBAL then
|
if sym.bind=AB_GLOBAL then
|
||||||
prelist.concat(tai_symbol.Create_Global(sym,0))
|
prelist.concat(tai_symbol.Create_Global(sym,0))
|
||||||
|
|||||||
@ -884,22 +884,38 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
|
|||||||
if is_widechar(def.pointeddef) and
|
if is_widechar(def.pointeddef) and
|
||||||
(node.nodetype<>addrn) then
|
(node.nodetype<>addrn) then
|
||||||
begin
|
begin
|
||||||
current_asmdata.getdatalabel(ll);
|
|
||||||
ftcb.emit_tai(Tai_const.Create_sym(ll),def);
|
|
||||||
current_asmdata.asmlists[al_typedconsts].concat(tai_align.create(const_align(sizeof(pint))));
|
|
||||||
current_asmdata.asmlists[al_typedconsts].concat(Tai_label.Create(ll));
|
|
||||||
if (node.nodetype in [stringconstn,ordconstn]) then
|
if (node.nodetype in [stringconstn,ordconstn]) then
|
||||||
begin
|
begin
|
||||||
|
current_asmdata.getdatalabel(ll);
|
||||||
{ convert to unicodestring stringconstn }
|
{ convert to unicodestring stringconstn }
|
||||||
inserttypeconv(node,cunicodestringtype);
|
inserttypeconv(node,cunicodestringtype);
|
||||||
if (node.nodetype=stringconstn) and
|
if (node.nodetype=stringconstn) and
|
||||||
(tstringconstnode(node).cst_type in [cst_widestring,cst_unicodestring]) then
|
(tstringconstnode(node).cst_type in [cst_widestring,cst_unicodestring]) then
|
||||||
begin
|
begin
|
||||||
|
{ create a tcb for the string data (it's placed in a separate
|
||||||
|
asmlist) }
|
||||||
|
datatcb:=ctai_typedconstbuilder.create;
|
||||||
pw:=pcompilerwidestring(tstringconstnode(node).value_str);
|
pw:=pcompilerwidestring(tstringconstnode(node).value_str);
|
||||||
|
{ include terminating #0 }
|
||||||
|
datadef:=getarraydef(cwidechartype,tstringconstnode(node).len+1);
|
||||||
|
datatcb.maybe_begin_aggregate(datadef);
|
||||||
for i:=0 to tstringconstnode(node).len-1 do
|
for i:=0 to tstringconstnode(node).len-1 do
|
||||||
current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_16bit(pw^.data[i]));
|
datatcb.emit_tai(Tai_const.Create_16bit(pw^.data[i]),cwidechartype);
|
||||||
{ ending #0 }
|
{ ending #0 }
|
||||||
current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_16bit(0))
|
datatcb.emit_tai(Tai_const.Create_16bit(0),cwidechartype);
|
||||||
|
datatcb.maybe_end_aggregate(datadef);
|
||||||
|
{ concat add the string data to the al_const asmlist }
|
||||||
|
current_asmdata.asmlists[al_const].concatlist(datatcb.get_final_asmlist(ll,datadef,sec_rodata,ll.name,const_align(sizeof(pint)),true));
|
||||||
|
datatcb.free;
|
||||||
|
{ we now emit the address of the first element of the array
|
||||||
|
containing the string data }
|
||||||
|
ftcb.queue_init(def);
|
||||||
|
{ address of ... }
|
||||||
|
ftcb.queue_addrn(def.pointeddef,def);
|
||||||
|
{ ... the first element ... }
|
||||||
|
ftcb.queue_vecn(datadef,0);
|
||||||
|
{ ... of the string array }
|
||||||
|
ftcb.queue_emit_asmsym(ll,datadef);
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user