mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-15 17:39:25 +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
|
||||
{ typed const: integer/floating point/string/pointer/... const along with
|
||||
tdef info; tck_simple_procvar2proc is to indicate that we mean the
|
||||
procdef corresponding to the procvar rather than the tmethod-like
|
||||
struct in case of a complex procvar }
|
||||
ttypedconstkind = (tck_simple, tck_simple_procvar2proc, tck_array, tck_record);
|
||||
tdef info }
|
||||
ttypedconstkind = (tck_simple, tck_array, tck_record);
|
||||
|
||||
{ the type of the element and its def }
|
||||
tai_abstracttypedconst = class abstract (tai)
|
||||
@ -770,7 +768,7 @@ implementation
|
||||
|
||||
procedure ttai_lowleveltypedconstbuilder.queue_emit_proc(pd: tprocdef);
|
||||
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);
|
||||
end;
|
||||
|
||||
|
@ -669,13 +669,7 @@ implementation
|
||||
defstr: TSymStr;
|
||||
first, gotstring: boolean;
|
||||
begin
|
||||
{ special case: tck_simple_procvar2proc; this means that we want the
|
||||
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);
|
||||
defstr:=llvmencodetype(hp.def);
|
||||
{ write the struct, array or simple type }
|
||||
case hp.adetyp of
|
||||
tck_record:
|
||||
@ -727,8 +721,7 @@ implementation
|
||||
if not gotstring then
|
||||
AsmWrite(']');
|
||||
end;
|
||||
tck_simple,
|
||||
tck_simple_procvar2proc:
|
||||
tck_simple:
|
||||
begin
|
||||
pval:=tai_simpletypedconst(hp).val;
|
||||
if pval.typ<>ait_string then
|
||||
|
@ -51,7 +51,7 @@ interface
|
||||
newindex indicates which operand is empty and can be filled with the
|
||||
next queued tai }
|
||||
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;
|
||||
procedure begin_aggregate_intern(tck: ttypedconstkind; def: tdef);
|
||||
public
|
||||
@ -131,7 +131,7 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
procedure tllvmtai_typedconstbuilder.emit_tai_intern(p: tai; def: tdef; procvar2procdef: boolean);
|
||||
procedure tllvmtai_typedconstbuilder.emit_tai_intern(p: tai; def: tdef);
|
||||
var
|
||||
ai: tai;
|
||||
stc: tai_abstracttypedconst;
|
||||
@ -139,10 +139,7 @@ implementation
|
||||
begin
|
||||
if assigned(fqueued_tai) then
|
||||
begin
|
||||
if not procvar2procdef then
|
||||
kind:=tck_simple
|
||||
else
|
||||
kind:=tck_simple_procvar2proc;
|
||||
kind:=tck_simple;
|
||||
{ finalise the queued expression }
|
||||
ai:=tai_simpletypedconst.create(kind,def,p);
|
||||
{ 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);
|
||||
{ these elements can be aggregates themselves, e.g. a shortstring can
|
||||
be emitted as a series of bytes and string data arrays }
|
||||
if not procvar2procdef then
|
||||
kind:=aggregate_kind(def)
|
||||
else
|
||||
kind:=tck_simple_procvar2proc;
|
||||
if not(kind in [tck_simple,tck_simple_procvar2proc]) and
|
||||
kind:=aggregate_kind(def);
|
||||
if (kind<>tck_simple) and
|
||||
(not assigned(faggregates) or
|
||||
(faggregates.count=0) or
|
||||
(tai_aggregatetypedconst(faggregates[faggregates.count-1]).adetyp<>kind)) then
|
||||
@ -216,13 +210,15 @@ implementation
|
||||
|
||||
procedure tllvmtai_typedconstbuilder.emit_tai(p: tai; def: tdef);
|
||||
begin
|
||||
emit_tai_intern(p,def,false);
|
||||
emit_tai_intern(p,def);
|
||||
end;
|
||||
|
||||
|
||||
procedure tllvmtai_typedconstbuilder.emit_tai_procvar2procdef(p: tai; pvdef: tprocvardef);
|
||||
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;
|
||||
|
||||
|
||||
@ -381,6 +377,11 @@ implementation
|
||||
secondop: tllvmop;
|
||||
begin
|
||||
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);
|
||||
case op of
|
||||
la_ptrtoint_to_x,
|
||||
|
Loading…
Reference in New Issue
Block a user