mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-09 20:47:24 +02:00
* remove obsolete pass2inline code
git-svn-id: trunk@1198 -
This commit is contained in:
parent
2f0fdd1847
commit
a720145fd1
@ -86,10 +86,6 @@ interface
|
||||
methodpointerinit,
|
||||
methodpointerdone : tblocknode;
|
||||
methodpointer : tnode;
|
||||
{$ifdef PASS2INLINE}
|
||||
{ inline function body }
|
||||
inlinecode : tnode;
|
||||
{$endif PASS2INLINE}
|
||||
{ varargs parasyms }
|
||||
varargsparas : tvarargsparalist;
|
||||
{ node that specifies where the result should be put for calls }
|
||||
@ -751,9 +747,6 @@ type
|
||||
methodpointerdone:=nil;
|
||||
procdefinition:=nil;
|
||||
_funcretnode:=nil;
|
||||
{$ifdef PASS2INLINE}
|
||||
inlinecode:=nil;
|
||||
{$endif PASS2INLINE}
|
||||
paralength:=-1;
|
||||
varargsparas:=nil;
|
||||
end;
|
||||
@ -770,9 +763,6 @@ type
|
||||
procdefinition:=nil;
|
||||
callnodeflags:=[cnf_return_value_used];
|
||||
_funcretnode:=nil;
|
||||
{$ifdef PASS2INLINE}
|
||||
inlinecode:=nil;
|
||||
{$endif PASS2INLINE}
|
||||
paralength:=-1;
|
||||
varargsparas:=nil;
|
||||
end;
|
||||
@ -866,9 +856,6 @@ type
|
||||
methodpointerinit.free;
|
||||
methodpointerdone.free;
|
||||
_funcretnode.free;
|
||||
{$ifdef PASS2INLINE}
|
||||
inlinecode.free;
|
||||
{$endif PASS2INLINE}
|
||||
if assigned(varargsparas) then
|
||||
begin
|
||||
for i:=0 to varargsparas.count-1 do
|
||||
@ -893,9 +880,6 @@ type
|
||||
methodpointerinit:=tblocknode(ppuloadnode(ppufile));
|
||||
methodpointerdone:=tblocknode(ppuloadnode(ppufile));
|
||||
_funcretnode:=ppuloadnode(ppufile);
|
||||
{$ifdef PASS2INLINE}
|
||||
inlinecode:=ppuloadnode(ppufile);
|
||||
{$endif PASS2INLINE}
|
||||
end;
|
||||
|
||||
|
||||
@ -909,9 +893,6 @@ type
|
||||
ppuwritenode(ppufile,methodpointerinit);
|
||||
ppuwritenode(ppufile,methodpointerdone);
|
||||
ppuwritenode(ppufile,_funcretnode);
|
||||
{$ifdef PASS2INLINE}
|
||||
ppuwritenode(ppufile,inlinecode);
|
||||
{$endif PASS2INLINE}
|
||||
end;
|
||||
|
||||
|
||||
@ -928,10 +909,6 @@ type
|
||||
methodpointerdone.buildderefimpl;
|
||||
if assigned(_funcretnode) then
|
||||
_funcretnode.buildderefimpl;
|
||||
{$ifdef PASS2INLINE}
|
||||
if assigned(inlinecode) then
|
||||
inlinecode.buildderefimpl;
|
||||
{$endif PASS2INLINE}
|
||||
end;
|
||||
|
||||
|
||||
@ -953,10 +930,6 @@ type
|
||||
methodpointerdone.derefimpl;
|
||||
if assigned(_funcretnode) then
|
||||
_funcretnode.derefimpl;
|
||||
{$ifdef PASS2INLINE}
|
||||
if assigned(inlinecode) then
|
||||
inlinecode.derefimpl;
|
||||
{$endif PASS2INLINE}
|
||||
{ Connect parasyms }
|
||||
pt:=tcallparanode(left);
|
||||
while assigned(pt) and
|
||||
@ -1015,12 +988,7 @@ type
|
||||
n._funcretnode:=_funcretnode._getcopy
|
||||
else
|
||||
n._funcretnode:=nil;
|
||||
{$ifdef PASS2INLINE}
|
||||
if assigned(inlinecode) then
|
||||
n.inlinecode:=inlinecode._getcopy
|
||||
else
|
||||
n.inlinecode:=nil;
|
||||
{$endif PASS2INLINE}
|
||||
|
||||
if assigned(varargsparas) then
|
||||
begin
|
||||
n.varargsparas:=tvarargsparalist.create;
|
||||
@ -2317,53 +2285,10 @@ type
|
||||
|
||||
{ procedure variable ? }
|
||||
if assigned(right) then
|
||||
begin
|
||||
firstpass(right);
|
||||
firstpass(right);
|
||||
|
||||
{ procedure does a call }
|
||||
if not (block_type in [bt_const,bt_type]) then
|
||||
include(current_procinfo.flags,pi_do_call);
|
||||
end
|
||||
else
|
||||
{ not a procedure variable }
|
||||
begin
|
||||
if procdefinition.deftype<>procdef then
|
||||
internalerror(200411071);
|
||||
{$ifdef PASS2INLINE}
|
||||
{ calc the correture value for the register }
|
||||
{ handle predefined procedures }
|
||||
if (po_inline in procdefinition.procoptions) then
|
||||
begin
|
||||
{ inherit flags }
|
||||
current_procinfo.flags := current_procinfo.flags + (tprocdef(procdefinition).inlininginfo^.flags*inherited_inlining_flags);
|
||||
|
||||
if assigned(methodpointer) then
|
||||
CGMessage(cg_e_unable_inline_object_methods);
|
||||
if assigned(right) then
|
||||
CGMessage(cg_e_unable_inline_procvar);
|
||||
if not assigned(inlinecode) then
|
||||
begin
|
||||
if assigned(tprocdef(procdefinition).inlininginfo^.code) then
|
||||
inlinecode:=tprocdef(procdefinition).inlininginfo^.code.getcopy
|
||||
else
|
||||
CGMessage(cg_e_no_code_for_inline_stored);
|
||||
if assigned(inlinecode) then
|
||||
begin
|
||||
{ consider it has not inlined if called
|
||||
again inside the args }
|
||||
procdefinition.proccalloption:=pocall_default;
|
||||
firstpass(inlinecode);
|
||||
end;
|
||||
end;
|
||||
end
|
||||
else
|
||||
{$endif PASS2INLINE}
|
||||
begin
|
||||
if not (block_type in [bt_const,bt_type]) then
|
||||
include(current_procinfo.flags,pi_do_call);
|
||||
end;
|
||||
|
||||
end;
|
||||
if not (block_type in [bt_const,bt_type]) then
|
||||
include(current_procinfo.flags,pi_do_call);
|
||||
|
||||
{ implicit finally needed ? }
|
||||
if resulttype.def.needs_inittable and
|
||||
@ -2466,18 +2391,6 @@ type
|
||||
end;
|
||||
end;
|
||||
|
||||
{$ifdef PASS2INLINE}
|
||||
{ determine the registers of the procedure variable }
|
||||
{ is this OK for inlined procs also ?? (PM) }
|
||||
if assigned(inlinecode) then
|
||||
begin
|
||||
registersfpu:=max(inlinecode.registersfpu,registersfpu);
|
||||
registersint:=max(inlinecode.registersint,registersint);
|
||||
{$ifdef SUPPORT_MMX}
|
||||
registersmmx:=max(inlinecode.registersmmx,registersmmx);
|
||||
{$endif SUPPORT_MMX}
|
||||
end;
|
||||
{$endif PASS2INLINE}
|
||||
{ determine the registers of the procedure variable }
|
||||
{ is this OK for inlined procs also ?? (PM) }
|
||||
if assigned(right) then
|
||||
@ -2497,10 +2410,6 @@ type
|
||||
registersmmx:=max(left.registersmmx,registersmmx);
|
||||
{$endif SUPPORT_MMX}
|
||||
end;
|
||||
{$ifdef PASS2INLINE}
|
||||
if assigned(inlinecode) then
|
||||
include(procdefinition.procoptions,po_inline);
|
||||
{$endif PASS2INLINE}
|
||||
end;
|
||||
|
||||
{$ifdef state_tracking}
|
||||
|
@ -46,10 +46,6 @@ interface
|
||||
tcgcallnode = class(tcallnode)
|
||||
private
|
||||
procedure release_para_temps;
|
||||
procedure normal_pass_2;
|
||||
{$ifdef PASS2INLINE}
|
||||
procedure inlined_pass_2;
|
||||
{$endif PASS2INLINE}
|
||||
procedure pushparas;
|
||||
procedure freeparas;
|
||||
protected
|
||||
@ -81,10 +77,6 @@ implementation
|
||||
systems,
|
||||
cutils,verbose,globals,
|
||||
symconst,symtable,defutil,paramgr,
|
||||
{$ifdef GDB}
|
||||
strings,
|
||||
gdb,
|
||||
{$endif GDB}
|
||||
cgbase,pass_2,
|
||||
aasmbase,aasmtai,
|
||||
nbas,nmem,nld,ncnv,nutils,
|
||||
@ -337,12 +329,7 @@ implementation
|
||||
cg.g_decrrefcount(exprasmlist,left.resulttype.def,href);
|
||||
end;
|
||||
|
||||
{$ifdef PASS2INLINE}
|
||||
if assigned(aktcallnode.inlinecode) then
|
||||
paramanager.duplicateparaloc(exprasmlist,aktcallnode.procdefinition.proccalloption,parasym,tempcgpara)
|
||||
else
|
||||
{$endif PASS2INLINE}
|
||||
paramanager.createtempparaloc(exprasmlist,aktcallnode.procdefinition.proccalloption,parasym,tempcgpara);
|
||||
paramanager.createtempparaloc(exprasmlist,aktcallnode.procdefinition.proccalloption,parasym,tempcgpara);
|
||||
|
||||
{ handle varargs first, because parasym is not valid }
|
||||
if (cpf_varargs_para in callparaflags) then
|
||||
@ -675,10 +662,7 @@ implementation
|
||||
{ better check for the real location of the parameter here, when stack passed parameters
|
||||
are saved temporary in registers, checking for the tmpparaloc.loc is wrong
|
||||
}
|
||||
{$ifdef PASS2INLINE}
|
||||
if not assigned(inlinecode) then
|
||||
{$endif PASS2INLINE}
|
||||
paramanager.freeparaloc(exprasmlist,ppn.tempcgpara);
|
||||
paramanager.freeparaloc(exprasmlist,ppn.tempcgpara);
|
||||
tmpparaloc:=ppn.tempcgpara.location;
|
||||
sizeleft:=ppn.tempcgpara.intsize;
|
||||
callerparaloc:=ppn.parasym.paraloc[callerside].location;
|
||||
@ -718,42 +702,37 @@ implementation
|
||||
end;
|
||||
LOC_REFERENCE:
|
||||
begin
|
||||
{$ifdef PASS2INLINE}
|
||||
if not assigned(inlinecode) then
|
||||
{$endif PASS2INLINE}
|
||||
begin
|
||||
{$ifdef cputargethasfixedstack}
|
||||
{ Can't have a data copied to the stack, every location
|
||||
must contain a valid size field }
|
||||
{ Can't have a data copied to the stack, every location
|
||||
must contain a valid size field }
|
||||
|
||||
if (ppn.tempcgpara.size=OS_NO) and
|
||||
((tmpparaloc^.loc<>LOC_REFERENCE) or
|
||||
assigned(tmpparaloc^.next)) then
|
||||
internalerror(200501281);
|
||||
reference_reset_base(href,callerparaloc^.reference.index,callerparaloc^.reference.offset);
|
||||
{ copy parameters in case they were moved to a temp. location because we've a fixed stack }
|
||||
case tmpparaloc^.loc of
|
||||
LOC_REFERENCE:
|
||||
begin
|
||||
reference_reset_base(htempref,tmpparaloc^.reference.index,tmpparaloc^.reference.offset);
|
||||
{ use concatcopy, because it can also be a float which fails when
|
||||
load_ref_ref is used }
|
||||
if (ppn.tempcgpara.size <> OS_NO) then
|
||||
cg.g_concatcopy(exprasmlist,htempref,href,tcgsize2size[tmpparaloc^.size])
|
||||
else
|
||||
cg.g_concatcopy(exprasmlist,htempref,href,sizeleft)
|
||||
end;
|
||||
LOC_REGISTER:
|
||||
cg.a_load_reg_ref(exprasmlist,tmpparaloc^.size,tmpparaloc^.size,tmpparaloc^.register,href);
|
||||
LOC_FPUREGISTER:
|
||||
cg.a_loadfpu_reg_ref(exprasmlist,tmpparaloc^.size,tmpparaloc^.register,href);
|
||||
LOC_MMREGISTER:
|
||||
cg.a_loadmm_reg_ref(exprasmlist,tmpparaloc^.size,tmpparaloc^.size,tmpparaloc^.register,href,mms_movescalar);
|
||||
else
|
||||
internalerror(200402081);
|
||||
end;
|
||||
if (ppn.tempcgpara.size=OS_NO) and
|
||||
((tmpparaloc^.loc<>LOC_REFERENCE) or
|
||||
assigned(tmpparaloc^.next)) then
|
||||
internalerror(200501281);
|
||||
reference_reset_base(href,callerparaloc^.reference.index,callerparaloc^.reference.offset);
|
||||
{ copy parameters in case they were moved to a temp. location because we've a fixed stack }
|
||||
case tmpparaloc^.loc of
|
||||
LOC_REFERENCE:
|
||||
begin
|
||||
reference_reset_base(htempref,tmpparaloc^.reference.index,tmpparaloc^.reference.offset);
|
||||
{ use concatcopy, because it can also be a float which fails when
|
||||
load_ref_ref is used }
|
||||
if (ppn.tempcgpara.size <> OS_NO) then
|
||||
cg.g_concatcopy(exprasmlist,htempref,href,tcgsize2size[tmpparaloc^.size])
|
||||
else
|
||||
cg.g_concatcopy(exprasmlist,htempref,href,sizeleft)
|
||||
end;
|
||||
LOC_REGISTER:
|
||||
cg.a_load_reg_ref(exprasmlist,tmpparaloc^.size,tmpparaloc^.size,tmpparaloc^.register,href);
|
||||
LOC_FPUREGISTER:
|
||||
cg.a_loadfpu_reg_ref(exprasmlist,tmpparaloc^.size,tmpparaloc^.register,href);
|
||||
LOC_MMREGISTER:
|
||||
cg.a_loadmm_reg_ref(exprasmlist,tmpparaloc^.size,tmpparaloc^.size,tmpparaloc^.register,href,mms_movescalar);
|
||||
else
|
||||
internalerror(200402081);
|
||||
end;
|
||||
{$endif cputargethasfixedstack}
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
dec(sizeleft,tcgsize2size[tmpparaloc^.size]);
|
||||
@ -776,11 +755,7 @@ implementation
|
||||
begin
|
||||
if (ppn.left.nodetype<>nothingn) then
|
||||
begin
|
||||
if
|
||||
{$ifdef PASS2INLINE}
|
||||
not assigned(inlinecode) or
|
||||
{$endif PASS2INLINE}
|
||||
(ppn.parasym.paraloc[callerside].location^.loc <> LOC_REFERENCE) then
|
||||
if (ppn.parasym.paraloc[callerside].location^.loc <> LOC_REFERENCE) then
|
||||
paramanager.freeparaloc(exprasmlist,ppn.parasym.paraloc[callerside]);
|
||||
end;
|
||||
ppn:=tcgcallparanode(ppn.right);
|
||||
@ -789,7 +764,7 @@ implementation
|
||||
|
||||
|
||||
|
||||
procedure tcgcallnode.normal_pass_2;
|
||||
procedure tcgcallnode.pass_2;
|
||||
var
|
||||
regs_to_save_int,
|
||||
regs_to_save_fpu,
|
||||
@ -804,6 +779,9 @@ implementation
|
||||
not procdefinition.has_paraloc_info then
|
||||
internalerror(200305264);
|
||||
|
||||
if assigned(methodpointerinit) then
|
||||
secondpass(methodpointerinit);
|
||||
|
||||
if resulttype.def.needs_inittable and
|
||||
not paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption) and
|
||||
not assigned(funcretnode) then
|
||||
@ -1039,221 +1017,10 @@ implementation
|
||||
|
||||
{ release temps of paras }
|
||||
release_para_temps;
|
||||
end;
|
||||
|
||||
|
||||
{$ifdef PASS2INLINE}
|
||||
procedure tcgcallnode.inlined_pass_2;
|
||||
var
|
||||
oldaktcallnode : tcallnode;
|
||||
oldprocinfo : tprocinfo;
|
||||
oldinlining_procedure : boolean;
|
||||
inlineentrycode,inlineexitcode : TAAsmoutput;
|
||||
{$ifdef GDB}
|
||||
startlabel,endlabel : tasmlabel;
|
||||
pp : pchar;
|
||||
mangled_length : longint;
|
||||
{$endif GDB}
|
||||
begin
|
||||
if not(assigned(procdefinition) and (procdefinition.deftype=procdef)) then
|
||||
internalerror(200305262);
|
||||
|
||||
oldinlining_procedure:=inlining_procedure;
|
||||
oldprocinfo:=current_procinfo;
|
||||
{ we're inlining a procedure }
|
||||
inlining_procedure:=true;
|
||||
|
||||
{ Add inling start }
|
||||
{$ifdef GDB}
|
||||
exprasmlist.concat(Tai_force_line.Create);
|
||||
{$endif GDB}
|
||||
exprasmList.concat(Tai_Marker.Create(InlineStart));
|
||||
{$ifdef extdebug}
|
||||
exprasmList.concat(tai_comment.Create(strpnew('Start of inlined proc '+tprocdef(procdefinition).procsym.name)));
|
||||
{$endif extdebug}
|
||||
|
||||
{ calculate registers to pass the parameters }
|
||||
paramanager.create_inline_paraloc_info(procdefinition);
|
||||
|
||||
{ Allocate parameters and locals }
|
||||
gen_alloc_inline_parast(exprasmlist,tprocdef(procdefinition));
|
||||
gen_alloc_inline_funcret(exprasmlist,tprocdef(procdefinition));
|
||||
gen_alloc_symtable(exprasmlist,tprocdef(procdefinition).localst);
|
||||
|
||||
{ if we allocate the temp. location for ansi- or widestrings }
|
||||
{ already here, we avoid later a push/pop }
|
||||
if resulttype.def.needs_inittable and
|
||||
not paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption) then
|
||||
begin
|
||||
tg.gettemptyped(exprasmlist,resulttype.def,tt_normal,refcountedtemp);
|
||||
cg.g_decrrefcount(exprasmlist,resulttype.def,refcountedtemp);
|
||||
end;
|
||||
|
||||
{ Push parameters, still use the old current_procinfo. This
|
||||
is required that have the correct information available like
|
||||
_class and nested procedure }
|
||||
oldaktcallnode:=aktcallnode;
|
||||
aktcallnode:=self;
|
||||
if assigned(left) then
|
||||
begin
|
||||
tcallparanode(left).secondcallparan;
|
||||
pushparas;
|
||||
end;
|
||||
aktcallnode:=oldaktcallnode;
|
||||
|
||||
{ create temp procinfo that will be used for the inlinecode tree }
|
||||
current_procinfo:=cprocinfo.create(nil);
|
||||
current_procinfo.procdef:=tprocdef(procdefinition);
|
||||
current_procinfo.flags:=oldprocinfo.flags;
|
||||
current_procinfo.aktlocaldata.destroy;
|
||||
current_procinfo.aktlocaldata:=oldprocinfo.aktlocaldata;
|
||||
|
||||
{ when the oldprocinfo is also being inlined reuse the
|
||||
inlining_procinfo }
|
||||
if assigned(oldprocinfo.inlining_procinfo) then
|
||||
current_procinfo.inlining_procinfo:=oldprocinfo.inlining_procinfo
|
||||
else
|
||||
current_procinfo.inlining_procinfo:=oldprocinfo;
|
||||
|
||||
{ takes care of local data initialization }
|
||||
inlineentrycode:=TAAsmoutput.Create;
|
||||
inlineexitcode:=TAAsmoutput.Create;
|
||||
|
||||
{$ifdef GDB}
|
||||
if (cs_debuginfo in aktmoduleswitches) and
|
||||
not(cs_gdb_valgrind in aktglobalswitches) then
|
||||
begin
|
||||
objectlibrary.getaddrlabel(startlabel);
|
||||
objectlibrary.getaddrlabel(endlabel);
|
||||
cg.a_label(exprasmlist,startlabel);
|
||||
|
||||
{ Here we must include the para and local symtable info }
|
||||
procdefinition.concatstabto(al_withdebug);
|
||||
|
||||
mangled_length:=length(current_procinfo.inlining_procinfo.procdef.mangledname);
|
||||
getmem(pp,mangled_length+50);
|
||||
strpcopy(pp,'192,0,0,'+startlabel.name);
|
||||
if (target_info.use_function_relative_addresses) then
|
||||
begin
|
||||
strpcopy(strend(pp),'-');
|
||||
strpcopy(strend(pp),current_procinfo.inlining_procinfo.procdef.mangledname);
|
||||
end;
|
||||
al_withdebug.concat(Tai_stabn.Create(strnew(pp)));
|
||||
end;
|
||||
{$endif GDB}
|
||||
|
||||
gen_load_para_value(inlineentrycode);
|
||||
{ now that we've loaded the para's, free them }
|
||||
if assigned(left) then
|
||||
freeparas;
|
||||
gen_initialize_code(inlineentrycode);
|
||||
if po_assembler in current_procinfo.procdef.procoptions then
|
||||
inlineentrycode.insert(Tai_marker.Create(asmblockstart));
|
||||
exprasmList.concatlist(inlineentrycode);
|
||||
|
||||
{ process the inline code }
|
||||
secondpass(inlinecode);
|
||||
|
||||
cg.a_label(exprasmlist,current_procinfo.aktexitlabel);
|
||||
gen_finalize_code(inlineexitcode);
|
||||
gen_load_return_value(inlineexitcode);
|
||||
if po_assembler in current_procinfo.procdef.procoptions then
|
||||
inlineexitcode.concat(Tai_marker.Create(asmblockend));
|
||||
exprasmlist.concatlist(inlineexitcode);
|
||||
|
||||
inlineentrycode.free;
|
||||
inlineexitcode.free;
|
||||
{$ifdef extdebug}
|
||||
exprasmList.concat(tai_comment.Create(strpnew('End of inlined proc')));
|
||||
{$endif extdebug}
|
||||
exprasmList.concat(Tai_Marker.Create(InlineEnd));
|
||||
|
||||
{ handle function results }
|
||||
if (not is_void(resulttype.def)) then
|
||||
handle_return_value
|
||||
else
|
||||
location_reset(location,LOC_VOID,OS_NO);
|
||||
|
||||
{ perhaps i/o check ? }
|
||||
if (cs_check_io in aktlocalswitches) and
|
||||
(po_iocheck in procdefinition.procoptions) and
|
||||
not(po_iocheck in current_procinfo.procdef.procoptions) and
|
||||
{ no IO check for methods and procedure variables }
|
||||
(right=nil) and
|
||||
not(po_virtualmethod in procdefinition.procoptions) then
|
||||
begin
|
||||
cg.allocallcpuregisters(exprasmlist);
|
||||
cg.a_call_name(exprasmlist,'FPC_IOCHECK');
|
||||
cg.deallocallcpuregisters(exprasmlist);
|
||||
end;
|
||||
|
||||
{ release temps of paras }
|
||||
release_para_temps;
|
||||
|
||||
{ if return value is not used }
|
||||
if (not is_void(resulttype.def)) and
|
||||
(not(cnf_return_value_used in callnodeflags)) then
|
||||
begin
|
||||
if location.loc in [LOC_CREFERENCE,LOC_REFERENCE] then
|
||||
begin
|
||||
{ data which must be finalized ? }
|
||||
if (resulttype.def.needs_inittable) then
|
||||
cg.g_finalize(exprasmlist,resulttype.def,location.reference);
|
||||
{ release unused temp }
|
||||
tg.ungetiftemp(exprasmlist,location.reference)
|
||||
end
|
||||
else if location.loc=LOC_FPUREGISTER then
|
||||
begin
|
||||
{$ifdef x86}
|
||||
{ release FPU stack }
|
||||
emit_reg(A_FSTP,S_NO,NR_FPU_RESULT_REG);
|
||||
{$endif x86}
|
||||
end;
|
||||
end;
|
||||
|
||||
{ Release parameters and locals }
|
||||
gen_free_symtable(exprasmlist,tparasymtable(current_procinfo.procdef.parast));
|
||||
gen_free_symtable(exprasmlist,tlocalsymtable(current_procinfo.procdef.localst));
|
||||
|
||||
{$ifdef GDB}
|
||||
if (cs_debuginfo in aktmoduleswitches) and
|
||||
not(cs_gdb_valgrind in aktglobalswitches) then
|
||||
begin
|
||||
cg.a_label(exprasmlist,endlabel);
|
||||
strpcopy(pp,'224,0,0,'+endlabel.name);
|
||||
if (target_info.use_function_relative_addresses) then
|
||||
begin
|
||||
strpcopy(strend(pp),'-');
|
||||
strpcopy(strend(pp),current_procinfo.inlining_procinfo.procdef.mangledname);
|
||||
end;
|
||||
al_withdebug.concat(Tai_stabn.Create(strnew(pp)));
|
||||
freemem(pp,mangled_length+50);
|
||||
end;
|
||||
{$endif GDB}
|
||||
|
||||
{ restore }
|
||||
current_procinfo.aktlocaldata:=nil;
|
||||
current_procinfo.destroy;
|
||||
current_procinfo:=oldprocinfo;
|
||||
inlining_procedure:=oldinlining_procedure;
|
||||
end;
|
||||
{$endif PASS2INLINE}
|
||||
|
||||
|
||||
procedure tcgcallnode.pass_2;
|
||||
begin
|
||||
if assigned(methodpointerinit) then
|
||||
secondpass(methodpointerinit);
|
||||
|
||||
{$ifdef PASS2INLINE}
|
||||
if assigned(inlinecode) then
|
||||
inlined_pass_2
|
||||
else
|
||||
{$endif PASS2INLINE}
|
||||
normal_pass_2;
|
||||
|
||||
if assigned(methodpointerdone) then
|
||||
secondpass(methodpointerdone);
|
||||
if assigned(methodpointerdone) then
|
||||
secondpass(methodpointerdone);
|
||||
end;
|
||||
|
||||
|
||||
|
@ -108,10 +108,6 @@ interface
|
||||
|
||||
procedure gen_alloc_symtable(list:TAAsmoutput;st:tsymtable);
|
||||
procedure gen_free_symtable(list:TAAsmoutput;st:tsymtable);
|
||||
{$ifdef PASS2INLINE}
|
||||
procedure gen_alloc_inline_parast(list:TAAsmoutput;pd:tprocdef);
|
||||
procedure gen_alloc_inline_funcret(list:TAAsmoutput;pd:tprocdef);
|
||||
{$endif PASS2INLINE}
|
||||
|
||||
{ rtti and init/final }
|
||||
procedure generate_rtti(p:Ttypesym);
|
||||
@ -2144,139 +2140,6 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
{$ifdef PASS2INLINE}
|
||||
procedure gen_alloc_inline_parast(list:TAAsmoutput;pd:tprocdef);
|
||||
var
|
||||
sym : tsym;
|
||||
calleeparaloc,
|
||||
callerparaloc : pcgparalocation;
|
||||
begin
|
||||
if (po_assembler in pd.procoptions) then
|
||||
exit;
|
||||
sym:=tsym(pd.parast.symindex.first);
|
||||
while assigned(sym) do
|
||||
begin
|
||||
if sym.typ=paravarsym then
|
||||
begin
|
||||
with tparavarsym(sym) do
|
||||
begin
|
||||
{ for localloc <> LOC_REFERENCE, we need regvar support inside inlined procedures }
|
||||
localloc.loc:=LOC_REFERENCE;
|
||||
localloc.size:=int_cgsize(paramanager.push_size(varspez,vartype.def,pd.proccalloption));
|
||||
tg.GetLocal(list,tcgsize2size[localloc.size],vartype.def,localloc.reference);
|
||||
calleeparaloc:=paraloc[calleeside].location;
|
||||
callerparaloc:=paraloc[callerside].location;
|
||||
while assigned(calleeparaloc) do
|
||||
begin
|
||||
if not assigned(callerparaloc) then
|
||||
internalerror(200408281);
|
||||
if calleeparaloc^.loc<>callerparaloc^.loc then
|
||||
internalerror(200408282);
|
||||
case calleeparaloc^.loc of
|
||||
LOC_FPUREGISTER:
|
||||
begin
|
||||
calleeparaloc^.register:=cg.getfpuregister(list,calleeparaloc^.size);
|
||||
callerparaloc^.register:=calleeparaloc^.register;
|
||||
end;
|
||||
LOC_REGISTER:
|
||||
begin
|
||||
calleeparaloc^.register:=cg.getintregister(list,calleeparaloc^.size);
|
||||
callerparaloc^.register:=calleeparaloc^.register;
|
||||
end;
|
||||
LOC_MMREGISTER:
|
||||
begin
|
||||
calleeparaloc^.register:=cg.getmmregister(list,calleeparaloc^.size);
|
||||
callerparaloc^.register:=calleeparaloc^.register;
|
||||
end;
|
||||
LOC_REFERENCE:
|
||||
begin
|
||||
calleeparaloc^.reference.offset := localloc.reference.offset;
|
||||
calleeparaloc^.reference.index := localloc.reference.base;
|
||||
callerparaloc^.reference.offset := localloc.reference.offset;
|
||||
callerparaloc^.reference.index := localloc.reference.base;
|
||||
end;
|
||||
end;
|
||||
calleeparaloc:=calleeparaloc^.next;
|
||||
callerparaloc:=callerparaloc^.next;
|
||||
end;
|
||||
if cs_asm_source in aktglobalswitches then
|
||||
begin
|
||||
case localloc.loc of
|
||||
LOC_REFERENCE :
|
||||
list.concat(Tai_comment.Create(strpnew('Para '+realname+' allocated at '+
|
||||
std_regname(localloc.reference.base)+tostr_with_plus(localloc.reference.offset))));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
sym:=tsym(sym.indexnext);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure gen_alloc_inline_funcret(list:TAAsmoutput;pd:tprocdef);
|
||||
var
|
||||
callerparaloc : tlocation;
|
||||
begin
|
||||
if not assigned(pd.funcretsym) or
|
||||
(po_assembler in pd.procoptions) then
|
||||
exit;
|
||||
{ for localloc <> LOC_REFERENCE, we need regvar support inside inlined procedures }
|
||||
with tabstractnormalvarsym(pd.funcretsym) do
|
||||
begin
|
||||
localloc.loc:=LOC_REFERENCE;
|
||||
localloc.size:=int_cgsize(paramanager.push_size(varspez,vartype.def,pd.proccalloption));
|
||||
tg.GetLocal(list,tcgsize2size[localloc.size],vartype.def,localloc.reference);
|
||||
callerparaloc:=pd.funcretloc[callerside];
|
||||
case pd.funcretloc[calleeside].loc of
|
||||
LOC_FPUREGISTER:
|
||||
begin
|
||||
pd.funcretloc[calleeside].register:=cg.getfpuregister(list,pd.funcretloc[calleeside].size);
|
||||
pd.funcretloc[callerside].register:=pd.funcretloc[calleeside].register;
|
||||
end;
|
||||
LOC_REGISTER:
|
||||
begin
|
||||
{$ifndef cpu64bit}
|
||||
if callerparaloc.size in [OS_64,OS_S64] then
|
||||
begin
|
||||
end
|
||||
else
|
||||
{$endif cpu64bit}
|
||||
begin
|
||||
pd.funcretloc[calleeside].register:=cg.getintregister(list,pd.funcretloc[calleeside].size);
|
||||
pd.funcretloc[callerside].register:=pd.funcretloc[calleeside].register;
|
||||
end;
|
||||
end;
|
||||
LOC_MMREGISTER:
|
||||
begin
|
||||
pd.funcretloc[calleeside].register:=cg.getmmregister(list,pd.funcretloc[calleeside].size);
|
||||
pd.funcretloc[callerside].register:=pd.funcretloc[calleeside].register;
|
||||
end;
|
||||
LOC_REFERENCE:
|
||||
begin
|
||||
pd.funcretloc[calleeside].reference.offset := localloc.reference.offset;
|
||||
pd.funcretloc[calleeside].reference.index := localloc.reference.base;
|
||||
pd.funcretloc[callerside].reference.offset := localloc.reference.offset;
|
||||
pd.funcretloc[callerside].reference.index := localloc.reference.base;
|
||||
end;
|
||||
LOC_VOID:
|
||||
;
|
||||
else
|
||||
internalerror(200411191);
|
||||
end;
|
||||
if cs_asm_source in aktglobalswitches then
|
||||
begin
|
||||
case localloc.loc of
|
||||
LOC_REFERENCE :
|
||||
list.concat(Tai_comment.Create(strpnew('Funcret '+realname+' allocated at '+
|
||||
std_regname(localloc.reference.base)+tostr_with_plus(localloc.reference.offset))));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
{$endif PASS2INLINE}
|
||||
|
||||
|
||||
{ persistent rtti generation }
|
||||
procedure generate_rtti(p:Ttypesym);
|
||||
var
|
||||
|
@ -111,9 +111,6 @@ implementation
|
||||
begin
|
||||
{ not in one statement, won't work because of b- }
|
||||
result := foreachnode(tcallnode(n).methodpointer,f,arg) or result;
|
||||
{$ifdef PASS2INLINE}
|
||||
result := foreachnode(tcallnode(n).inlinecode,f,arg) or result;
|
||||
{$endif PASS2INLINE}
|
||||
end;
|
||||
ifn, whilerepeatn, forn:
|
||||
begin
|
||||
@ -152,9 +149,6 @@ implementation
|
||||
calln:
|
||||
begin
|
||||
result := foreachnodestatic(procmethod,tcallnode(n).methodpointer,f,arg) or result;
|
||||
{$ifdef PASS2INLINE}
|
||||
result := foreachnodestatic(procmethod,tcallnode(n).inlinecode,f,arg) or result;
|
||||
{$endif PASS2INLINE}
|
||||
end;
|
||||
ifn, whilerepeatn, forn:
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user