mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 00:09:26 +02:00
- removed tck_simple_procvar2proc, instead use
procdef.getcopyas(procvardef,pc_address_only) as the def if we want to specify that we're interested in the address of a procedure/procvar of object git-svn-id: branches/hlcgllvm@28476 -
This commit is contained in:
parent
904a033ba2
commit
cc4482d6f8
@ -33,10 +33,8 @@ uses
|
|||||||
|
|
||||||
type
|
type
|
||||||
{ typed const: integer/floating point/string/pointer/... const along with
|
{ typed const: integer/floating point/string/pointer/... const along with
|
||||||
tdef info; tck_simple_procvar2proc is to indicate that we mean the
|
tdef info }
|
||||||
procdef corresponding to the procvar rather than the tmethod-like
|
ttypedconstkind = (tck_simple, tck_array, tck_record);
|
||||||
struct in case of a complex procvar }
|
|
||||||
ttypedconstkind = (tck_simple, tck_simple_procvar2proc, tck_array, tck_record);
|
|
||||||
|
|
||||||
{ the type of the element and its def }
|
{ the type of the element and its def }
|
||||||
tai_abstracttypedconst = class abstract (tai)
|
tai_abstracttypedconst = class abstract (tai)
|
||||||
@ -770,7 +768,7 @@ implementation
|
|||||||
|
|
||||||
procedure ttai_lowleveltypedconstbuilder.queue_emit_proc(pd: tprocdef);
|
procedure ttai_lowleveltypedconstbuilder.queue_emit_proc(pd: tprocdef);
|
||||||
begin
|
begin
|
||||||
emit_tai(Tai_const.Createname(pd.mangledname,fqueue_offset),pd);
|
emit_tai(Tai_const.Createname(pd.mangledname,fqueue_offset),pd.getcopyas(procvardef,pc_address_only));
|
||||||
fqueue_offset:=low(fqueue_offset);
|
fqueue_offset:=low(fqueue_offset);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -669,13 +669,7 @@ implementation
|
|||||||
defstr: TSymStr;
|
defstr: TSymStr;
|
||||||
first, gotstring: boolean;
|
first, gotstring: boolean;
|
||||||
begin
|
begin
|
||||||
{ special case: tck_simple_procvar2proc; this means that we want the
|
defstr:=llvmencodetype(hp.def);
|
||||||
procdef of the procvardef, rather than both the procdef and the
|
|
||||||
method/nestedfp/... pointers }
|
|
||||||
if hp.adetyp<>tck_simple_procvar2proc then
|
|
||||||
defstr:=llvmencodetype(hp.def)
|
|
||||||
else
|
|
||||||
defstr:=llvmencodeproctype(tabstractprocdef(hp.def),'',lpd_procvar);
|
|
||||||
{ write the struct, array or simple type }
|
{ write the struct, array or simple type }
|
||||||
case hp.adetyp of
|
case hp.adetyp of
|
||||||
tck_record:
|
tck_record:
|
||||||
@ -727,8 +721,7 @@ implementation
|
|||||||
if not gotstring then
|
if not gotstring then
|
||||||
AsmWrite(']');
|
AsmWrite(']');
|
||||||
end;
|
end;
|
||||||
tck_simple,
|
tck_simple:
|
||||||
tck_simple_procvar2proc:
|
|
||||||
begin
|
begin
|
||||||
pval:=tai_simpletypedconst(hp).val;
|
pval:=tai_simpletypedconst(hp).val;
|
||||||
if pval.typ<>ait_string then
|
if pval.typ<>ait_string then
|
||||||
|
@ -51,7 +51,7 @@ interface
|
|||||||
newindex indicates which operand is empty and can be filled with the
|
newindex indicates which operand is empty and can be filled with the
|
||||||
next queued tai }
|
next queued tai }
|
||||||
procedure update_queued_tai(resdef: tdef; outerai, innerai: tai; newindex: longint);
|
procedure update_queued_tai(resdef: tdef; outerai, innerai: tai; newindex: longint);
|
||||||
procedure emit_tai_intern(p: tai; def: tdef; procvar2procdef: boolean);
|
procedure emit_tai_intern(p: tai; def: tdef);
|
||||||
function wrap_with_type(p: tai; def: tdef): tai;
|
function wrap_with_type(p: tai; def: tdef): tai;
|
||||||
procedure begin_aggregate_intern(tck: ttypedconstkind; def: tdef);
|
procedure begin_aggregate_intern(tck: ttypedconstkind; def: tdef);
|
||||||
public
|
public
|
||||||
@ -131,7 +131,7 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure tllvmtai_typedconstbuilder.emit_tai_intern(p: tai; def: tdef; procvar2procdef: boolean);
|
procedure tllvmtai_typedconstbuilder.emit_tai_intern(p: tai; def: tdef);
|
||||||
var
|
var
|
||||||
ai: tai;
|
ai: tai;
|
||||||
stc: tai_abstracttypedconst;
|
stc: tai_abstracttypedconst;
|
||||||
@ -139,10 +139,7 @@ implementation
|
|||||||
begin
|
begin
|
||||||
if assigned(fqueued_tai) then
|
if assigned(fqueued_tai) then
|
||||||
begin
|
begin
|
||||||
if not procvar2procdef then
|
kind:=tck_simple;
|
||||||
kind:=tck_simple
|
|
||||||
else
|
|
||||||
kind:=tck_simple_procvar2proc;
|
|
||||||
{ finalise the queued expression }
|
{ finalise the queued expression }
|
||||||
ai:=tai_simpletypedconst.create(kind,def,p);
|
ai:=tai_simpletypedconst.create(kind,def,p);
|
||||||
{ set the new index to -1, so we internalerror should we try to
|
{ set the new index to -1, so we internalerror should we try to
|
||||||
@ -158,11 +155,8 @@ implementation
|
|||||||
stc:=tai_simpletypedconst.create(tck_simple,def,p);
|
stc:=tai_simpletypedconst.create(tck_simple,def,p);
|
||||||
{ these elements can be aggregates themselves, e.g. a shortstring can
|
{ these elements can be aggregates themselves, e.g. a shortstring can
|
||||||
be emitted as a series of bytes and string data arrays }
|
be emitted as a series of bytes and string data arrays }
|
||||||
if not procvar2procdef then
|
kind:=aggregate_kind(def);
|
||||||
kind:=aggregate_kind(def)
|
if (kind<>tck_simple) and
|
||||||
else
|
|
||||||
kind:=tck_simple_procvar2proc;
|
|
||||||
if not(kind in [tck_simple,tck_simple_procvar2proc]) and
|
|
||||||
(not assigned(faggregates) or
|
(not assigned(faggregates) or
|
||||||
(faggregates.count=0) or
|
(faggregates.count=0) or
|
||||||
(tai_aggregatetypedconst(faggregates[faggregates.count-1]).adetyp<>kind)) then
|
(tai_aggregatetypedconst(faggregates[faggregates.count-1]).adetyp<>kind)) then
|
||||||
@ -216,13 +210,15 @@ implementation
|
|||||||
|
|
||||||
procedure tllvmtai_typedconstbuilder.emit_tai(p: tai; def: tdef);
|
procedure tllvmtai_typedconstbuilder.emit_tai(p: tai; def: tdef);
|
||||||
begin
|
begin
|
||||||
emit_tai_intern(p,def,false);
|
emit_tai_intern(p,def);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure tllvmtai_typedconstbuilder.emit_tai_procvar2procdef(p: tai; pvdef: tprocvardef);
|
procedure tllvmtai_typedconstbuilder.emit_tai_procvar2procdef(p: tai; pvdef: tprocvardef);
|
||||||
begin
|
begin
|
||||||
emit_tai_intern(p,pvdef,true);
|
if not pvdef.is_addressonly then
|
||||||
|
pvdef:=tprocvardef(pvdef.getcopyas(procvardef,pc_address_only));
|
||||||
|
emit_tai_intern(p,pvdef);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -381,6 +377,11 @@ implementation
|
|||||||
secondop: tllvmop;
|
secondop: tllvmop;
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
{ special case: procdef -> procvardef/pointerdef: must take address of
|
||||||
|
the procdef }
|
||||||
|
if (fromdef.typ=procdef) and
|
||||||
|
(todef.typ<>procdef) then
|
||||||
|
fromdef:=tprocdef(fromdef).getcopyas(procvardef,pc_address_only);
|
||||||
op:=llvmconvop(fromdef,todef);
|
op:=llvmconvop(fromdef,todef);
|
||||||
case op of
|
case op of
|
||||||
la_ptrtoint_to_x,
|
la_ptrtoint_to_x,
|
||||||
|
Loading…
Reference in New Issue
Block a user