mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-23 19:29:33 +02:00
* moved gen_entry_code/gen_exit_code from ncgutil to hlcgobj,
and overrode both with empty stubs for the JVM git-svn-id: branches/jvmbackend@18506 -
This commit is contained in:
parent
f20e347c7e
commit
e775e2d9ae
compiler
@ -449,6 +449,10 @@ unit hlcgobj;
|
||||
|
||||
procedure gen_initialize_code(list:TAsmList);virtual;
|
||||
procedure gen_finalize_code(list:TAsmList);virtual;
|
||||
|
||||
procedure gen_entry_code(list:TAsmList);virtual;
|
||||
procedure gen_exit_code(list:TAsmList);virtual;
|
||||
|
||||
protected
|
||||
{ helpers called by gen_initialize_code/gen_finalize_code }
|
||||
procedure inittempvariables(list:TAsmList);virtual;
|
||||
@ -2010,6 +2014,56 @@ implementation
|
||||
current_procinfo.procdef.parast.SymList.ForEachCall(@final_paras,list);
|
||||
end;
|
||||
|
||||
procedure thlcgobj.gen_entry_code(list: TAsmList);
|
||||
begin
|
||||
{ the actual profile code can clobber some registers,
|
||||
therefore if the context must be saved, do it before
|
||||
the actual call to the profile code
|
||||
}
|
||||
if (cs_profile in current_settings.moduleswitches) and
|
||||
not(po_assembler in current_procinfo.procdef.procoptions) then
|
||||
begin
|
||||
{ non-win32 can call mcout even in main }
|
||||
if not (target_info.system in [system_i386_win32,system_i386_wdosx]) or
|
||||
not (current_procinfo.procdef.proctypeoption=potype_proginit) then
|
||||
begin
|
||||
g_profilecode(list);
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TODO: create high level version (create compilerprocs in system unit,
|
||||
look up procdef, use hlcgobj.a_call_name()) }
|
||||
|
||||
{ call startup helpers from main program }
|
||||
if (current_procinfo.procdef.proctypeoption=potype_proginit) then
|
||||
begin
|
||||
{ initialize units }
|
||||
cg.allocallcpuregisters(list);
|
||||
if not(current_module.islibrary) then
|
||||
cg.a_call_name(list,'FPC_INITIALIZEUNITS',false)
|
||||
else
|
||||
cg.a_call_name(list,'FPC_LIBINITIALIZEUNITS',false);
|
||||
cg.deallocallcpuregisters(list);
|
||||
end;
|
||||
|
||||
list.concat(Tai_force_line.Create);
|
||||
|
||||
{$ifdef OLDREGVARS}
|
||||
load_regvars(list,nil);
|
||||
{$endif OLDREGVARS}
|
||||
end;
|
||||
|
||||
procedure thlcgobj.gen_exit_code(list: TAsmList);
|
||||
begin
|
||||
{ TODO: create high level version (create compilerproc in system unit,
|
||||
look up procdef, use hlcgobj.a_call_name()) }
|
||||
|
||||
{ call __EXIT for main program }
|
||||
if (not DLLsource) and
|
||||
(current_procinfo.procdef.proctypeoption=potype_proginit) then
|
||||
cg.a_call_name(list,'FPC_DO_EXIT',false);
|
||||
end;
|
||||
|
||||
procedure thlcgobj.inittempvariables(list: TAsmList);
|
||||
var
|
||||
hp : ptemprecord;
|
||||
|
@ -100,6 +100,9 @@ uses
|
||||
|
||||
procedure gen_initialize_code(list: TAsmList); override;
|
||||
|
||||
procedure gen_entry_code(list: TAsmList); override;
|
||||
procedure gen_exit_code(list: TAsmList); override;
|
||||
|
||||
{ JVM-specific routines }
|
||||
|
||||
procedure a_load_stack_reg(list : TAsmList;size: tdef;reg: tregister);
|
||||
@ -1473,6 +1476,16 @@ implementation
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure thlcgjvm.gen_entry_code(list: TAsmList);
|
||||
begin
|
||||
list.concat(Tai_force_line.Create);
|
||||
end;
|
||||
|
||||
procedure thlcgjvm.gen_exit_code(list: TAsmList);
|
||||
begin
|
||||
{ nothing }
|
||||
end;
|
||||
|
||||
procedure thlcgjvm.a_load_stack_reg(list: TAsmList; size: tdef; reg: tregister);
|
||||
var
|
||||
opc: tasmop;
|
||||
|
@ -90,8 +90,6 @@ interface
|
||||
procedure gen_stack_check_call(list:TAsmList);
|
||||
procedure gen_save_used_regs(list:TAsmList);
|
||||
procedure gen_restore_used_regs(list:TAsmList);
|
||||
procedure gen_entry_code(list:TAsmList);
|
||||
procedure gen_exit_code(list:TAsmList);
|
||||
procedure gen_load_para_value(list:TAsmList);
|
||||
|
||||
procedure gen_external_stub(list:TAsmList;pd:tprocdef;const externalname:string);
|
||||
@ -1840,52 +1838,6 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
procedure gen_entry_code(list:TAsmList);
|
||||
begin
|
||||
{ the actual profile code can clobber some registers,
|
||||
therefore if the context must be saved, do it before
|
||||
the actual call to the profile code
|
||||
}
|
||||
if (cs_profile in current_settings.moduleswitches) and
|
||||
not(po_assembler in current_procinfo.procdef.procoptions) then
|
||||
begin
|
||||
{ non-win32 can call mcout even in main }
|
||||
if not (target_info.system in [system_i386_win32,system_i386_wdosx]) or
|
||||
not (current_procinfo.procdef.proctypeoption=potype_proginit) then
|
||||
begin
|
||||
cg.g_profilecode(list);
|
||||
end;
|
||||
end;
|
||||
|
||||
{ call startup helpers from main program }
|
||||
if (current_procinfo.procdef.proctypeoption=potype_proginit) then
|
||||
begin
|
||||
{ initialize units }
|
||||
cg.allocallcpuregisters(list);
|
||||
if not(current_module.islibrary) then
|
||||
cg.a_call_name(list,'FPC_INITIALIZEUNITS',false)
|
||||
else
|
||||
cg.a_call_name(list,'FPC_LIBINITIALIZEUNITS',false);
|
||||
cg.deallocallcpuregisters(list);
|
||||
end;
|
||||
|
||||
list.concat(Tai_force_line.Create);
|
||||
|
||||
{$ifdef OLDREGVARS}
|
||||
load_regvars(list,nil);
|
||||
{$endif OLDREGVARS}
|
||||
end;
|
||||
|
||||
|
||||
procedure gen_exit_code(list:TAsmList);
|
||||
begin
|
||||
{ call __EXIT for main program }
|
||||
if (not DLLsource) and
|
||||
(current_procinfo.procdef.proctypeoption=potype_proginit) then
|
||||
cg.a_call_name(list,'FPC_DO_EXIT',false);
|
||||
end;
|
||||
|
||||
|
||||
{****************************************************************************
|
||||
Entry/Exit
|
||||
****************************************************************************}
|
||||
|
@ -1080,7 +1080,7 @@ implementation
|
||||
|
||||
cg.set_regalloc_live_range_direction(rad_backwards);
|
||||
|
||||
gen_entry_code(templist);
|
||||
hlcg.gen_entry_code(templist);
|
||||
aktproccode.insertlistafter(entry_asmnode.currenttai,templist);
|
||||
hlcg.gen_initialize_code(templist);
|
||||
aktproccode.insertlistafter(init_asmnode.currenttai,templist);
|
||||
@ -1107,7 +1107,7 @@ implementation
|
||||
else
|
||||
aktproccode.concatlist(templist);
|
||||
{ exit code }
|
||||
gen_exit_code(templist);
|
||||
hlcg.gen_exit_code(templist);
|
||||
aktproccode.concatlist(templist);
|
||||
|
||||
{$ifdef OLDREGVARS}
|
||||
|
Loading…
Reference in New Issue
Block a user