mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 06:49:23 +02:00
* factored out emitting a guid const
git-svn-id: branches/hlcgllvm@28773 -
This commit is contained in:
parent
8fa4c69f1f
commit
e07933212b
@ -228,6 +228,8 @@ type
|
|||||||
class function emit_unicodestring_const(list: TAsmList; data: pointer; encoding: tstringencoding; winlike: boolean):tasmlabofs;
|
class function emit_unicodestring_const(list: TAsmList; data: pointer; encoding: tstringencoding; winlike: boolean):tasmlabofs;
|
||||||
{ emit a shortstring constant, and return its def }
|
{ emit a shortstring constant, and return its def }
|
||||||
function emit_shortstring_const(const str: shortstring): tdef;
|
function emit_shortstring_const(const str: shortstring): tdef;
|
||||||
|
{ emit a guid constant }
|
||||||
|
procedure emit_guid_const(const guid: tguid);
|
||||||
|
|
||||||
{ begin a potential aggregate type. Must be called for any type
|
{ begin a potential aggregate type. Must be called for any type
|
||||||
that consists of multiple tai constant data entries, or that
|
that consists of multiple tai constant data entries, or that
|
||||||
@ -1027,6 +1029,28 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure ttai_typedconstbuilder.emit_guid_const(const guid: tguid);
|
||||||
|
var
|
||||||
|
i: longint;
|
||||||
|
begin
|
||||||
|
maybe_begin_aggregate(rec_tguid);
|
||||||
|
{ variant record -> must specify which fields get initialised }
|
||||||
|
next_field:=tfieldvarsym(rec_tguid.symtable.symlist[0]);
|
||||||
|
emit_tai(Tai_const.Create_32bit(longint(guid.D1)),u32inttype);
|
||||||
|
next_field:=tfieldvarsym(rec_tguid.symtable.symlist[1]);
|
||||||
|
emit_tai(Tai_const.Create_16bit(guid.D2),u16inttype);
|
||||||
|
next_field:=tfieldvarsym(rec_tguid.symtable.symlist[2]);
|
||||||
|
emit_tai(Tai_const.Create_16bit(guid.D3),u16inttype);
|
||||||
|
next_field:=tfieldvarsym(rec_tguid.symtable.symlist[3]);
|
||||||
|
{ the array }
|
||||||
|
maybe_begin_aggregate(tfieldvarsym(rec_tguid.symtable.symlist[3]).vardef);
|
||||||
|
for i:=Low(guid.D4) to High(guid.D4) do
|
||||||
|
emit_tai(Tai_const.Create_8bit(guid.D4[i]),u8inttype);
|
||||||
|
maybe_end_aggregate(tfieldvarsym(rec_tguid.symtable.symlist[3]).vardef);
|
||||||
|
maybe_end_aggregate(rec_tguid);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure ttai_typedconstbuilder.maybe_begin_aggregate(def: tdef);
|
procedure ttai_typedconstbuilder.maybe_begin_aggregate(def: tdef);
|
||||||
begin
|
begin
|
||||||
begin_aggregate_internal(def,false);
|
begin_aggregate_internal(def,false);
|
||||||
|
@ -1415,25 +1415,10 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
|
|||||||
startoffset: aint;
|
startoffset: aint;
|
||||||
|
|
||||||
procedure handle_stringconstn;
|
procedure handle_stringconstn;
|
||||||
var
|
|
||||||
i : longint;
|
|
||||||
begin
|
begin
|
||||||
hs:=strpas(tstringconstnode(n).value_str);
|
hs:=strpas(tstringconstnode(n).value_str);
|
||||||
if string2guid(hs,tmpguid) then
|
if string2guid(hs,tmpguid) then
|
||||||
begin
|
ftcb.emit_guid_const(tmpguid)
|
||||||
ftcb.maybe_begin_aggregate(rec_tguid);
|
|
||||||
{ variant record -> must specify which fields get initialised }
|
|
||||||
ftcb.next_field:=tfieldvarsym(rec_tguid.symtable.symlist[0]);
|
|
||||||
ftcb.emit_tai(Tai_const.Create_32bit(longint(tmpguid.D1)),u32inttype);
|
|
||||||
ftcb.next_field:=tfieldvarsym(rec_tguid.symtable.symlist[1]);
|
|
||||||
ftcb.emit_tai(Tai_const.Create_16bit(tmpguid.D2),u16inttype);
|
|
||||||
ftcb.next_field:=tfieldvarsym(rec_tguid.symtable.symlist[2]);
|
|
||||||
ftcb.emit_tai(Tai_const.Create_16bit(tmpguid.D3),u16inttype);
|
|
||||||
ftcb.next_field:=tfieldvarsym(rec_tguid.symtable.symlist[3]);
|
|
||||||
for i:=Low(tmpguid.D4) to High(tmpguid.D4) do
|
|
||||||
ftcb.emit_tai(Tai_const.Create_8bit(tmpguid.D4[i]),u8inttype);
|
|
||||||
ftcb.maybe_end_aggregate(rec_tguid);
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
Message(parser_e_improper_guid_syntax);
|
Message(parser_e_improper_guid_syntax);
|
||||||
end;
|
end;
|
||||||
@ -1452,21 +1437,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
|
|||||||
begin
|
begin
|
||||||
inserttypeconv(n,rec_tguid);
|
inserttypeconv(n,rec_tguid);
|
||||||
if n.nodetype=guidconstn then
|
if n.nodetype=guidconstn then
|
||||||
begin
|
ftcb.emit_guid_const(tguidconstnode(n).value)
|
||||||
ftcb.maybe_begin_aggregate(rec_tguid);
|
|
||||||
tmpguid:=tguidconstnode(n).value;
|
|
||||||
{ variant record -> must specify which fields get initialised }
|
|
||||||
ftcb.next_field:=tfieldvarsym(rec_tguid.symtable.symlist[0]);
|
|
||||||
ftcb.emit_tai(Tai_const.Create_32bit(longint(tmpguid.D1)),u32inttype);
|
|
||||||
ftcb.next_field:=tfieldvarsym(rec_tguid.symtable.symlist[1]);
|
|
||||||
ftcb.emit_tai(Tai_const.Create_16bit(tmpguid.D2),u16inttype);
|
|
||||||
ftcb.next_field:=tfieldvarsym(rec_tguid.symtable.symlist[2]);
|
|
||||||
ftcb.emit_tai(Tai_const.Create_16bit(tmpguid.D3),u16inttype);
|
|
||||||
ftcb.next_field:=tfieldvarsym(rec_tguid.symtable.symlist[3]);
|
|
||||||
for i:=Low(tmpguid.D4) to High(tmpguid.D4) do
|
|
||||||
ftcb.emit_tai(Tai_const.Create_8bit(tmpguid.D4[i]),u8inttype);
|
|
||||||
ftcb.maybe_end_aggregate(rec_tguid);
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
Message(parser_e_illegal_expression);
|
Message(parser_e_illegal_expression);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user