+ added support for typed word/smallint constants, initialized with Seg(symbol) on the i8086

git-svn-id: trunk@32251 -
This commit is contained in:
nickysn 2015-11-05 16:18:47 +00:00
parent 44b04e250e
commit ac97d20249

View File

@ -35,6 +35,7 @@ interface
ti8086typedconstbuilder = class(tasmlisttypedconstbuilder)
protected
procedure tc_emit_orddef(def: torddef; var node: tnode);override;
procedure tc_emit_pointerdef(def: tpointerdef; var node: tnode);override;
end;
@ -42,10 +43,56 @@ interface
implementation
uses
ncon,ncnv,defcmp,defutil,aasmtai,symcpu;
verbose,
ncon,ncnv,ninl,nld,
defcmp,defutil,
aasmtai,
symconst,symtype,symsym,symcpu;
{ ti8086typedconstbuilder }
procedure ti8086typedconstbuilder.tc_emit_orddef(def: torddef; var node: tnode);
var
hp: tnode;
srsym: tsym;
pd: tprocdef;
resourcestrrec: trecorddef;
begin
{ support word/smallint constants, initialized with Seg() }
if (def.ordtype in [u16bit,s16bit]) and (node.nodetype=inlinen) and
(tinlinenode(node).inlinenumber=in_seg_x) then
begin
hp:=tunarynode(node).left;
if hp.nodetype=loadn then
begin
srsym:=tloadnode(hp).symtableentry;
case srsym.typ of
procsym :
begin
pd:=tprocdef(tprocsym(srsym).ProcdefList[0]);
if Tprocsym(srsym).ProcdefList.Count>1 then
Message(parser_e_no_overloaded_procvars);
if po_abstractmethod in pd.procoptions then
Message(type_e_cant_take_address_of_abstract_method)
else
ftcb.emit_tai(Tai_const.Create_seg_name(pd.mangledname),u16inttype);
end;
staticvarsym :
ftcb.emit_tai(Tai_const.Create_seg_name(tstaticvarsym(srsym).mangledname),u16inttype);
labelsym :
ftcb.emit_tai(Tai_const.Create_seg_name(tlabelsym(srsym).mangledname),u16inttype);
else
Message(type_e_variable_id_expected);
end;
end
else
Message(parser_e_illegal_expression);
end
else
inherited;
end;
procedure ti8086typedconstbuilder.tc_emit_pointerdef(def: tpointerdef; var node: tnode);
var
hp: tnode;