* Added virtual method tprocinfo.postprocess_code and moved target-specific processing from base class into target-specific descendant classes (ARM and AVR, other targets still to do).

git-svn-id: trunk@27449 -
This commit is contained in:
sergei 2014-04-02 13:14:06 +00:00
parent f9381ba5a5
commit eeb15fc445
4 changed files with 28 additions and 13 deletions

View File

@ -48,6 +48,7 @@ unit cpupi;
procedure init_framepointer; override; procedure init_framepointer; override;
procedure generate_parameter_info;override; procedure generate_parameter_info;override;
procedure allocate_got_register(list : TAsmList);override; procedure allocate_got_register(list : TAsmList);override;
procedure postprocess_code;override;
end; end;
@ -60,7 +61,8 @@ unit cpupi;
symconst,symtype,symsym,symcpu,paramgr, symconst,symtype,symsym,symcpu,paramgr,
cgutils, cgutils,
cgobj, cgobj,
defutil; defutil,
aasmcpu;
procedure tarmprocinfo.set_first_temp_offset; procedure tarmprocinfo.set_first_temp_offset;
var var
@ -267,6 +269,12 @@ unit cpupi;
end; end;
procedure tarmprocinfo.postprocess_code;
begin
{ because of the limited constant size of the arm, all data access is done pc relative }
finalizearmcode(aktproccode,aktlocaldata);
end;
begin begin
cprocinfo:=tarmprocinfo; cprocinfo:=tarmprocinfo;
end. end.

View File

@ -37,6 +37,7 @@ unit cpupi;
// procedure after_pass1;override; // procedure after_pass1;override;
procedure set_first_temp_offset;override; procedure set_first_temp_offset;override;
function calc_stackframe_size:longint;override; function calc_stackframe_size:longint;override;
procedure postprocess_code;override;
end; end;
@ -49,7 +50,8 @@ unit cpupi;
tgobj, tgobj,
symconst,symsym,paramgr, symconst,symsym,paramgr,
cgbase, cgbase,
cgobj; cgobj,
aasmcpu;
procedure tavrprocinfo.set_first_temp_offset; procedure tavrprocinfo.set_first_temp_offset;
begin begin
@ -67,6 +69,13 @@ unit cpupi;
end; end;
procedure tavrprocinfo.postprocess_code;
begin
{ because of the limited branch distance of cond. branches, they must be replaced
sometimes by normal jmps and an inverse branch }
finalizeavrcode(aktproccode);
end;
begin begin
cprocinfo:=tavrprocinfo; cprocinfo:=tavrprocinfo;
end. end.

View File

@ -178,6 +178,8 @@ unit procinfo;
{ Update the resuired alignment for the current stack frame based { Update the resuired alignment for the current stack frame based
on the current value and the new required alignment } on the current value and the new required alignment }
procedure updatestackalignment(alignment: longint); procedure updatestackalignment(alignment: longint);
{ Specific actions after the code has been generated }
procedure postprocess_code; virtual;
end; end;
tcprocinfo = class of tprocinfo; tcprocinfo = class of tprocinfo;
@ -333,4 +335,9 @@ implementation
end; end;
procedure tprocinfo.postprocess_code;
begin
{ no action by default }
end;
end. end.

View File

@ -1602,17 +1602,8 @@ implementation
end; end;
{$endif NoOpt} {$endif NoOpt}
{ Perform target-specific processing if necessary }
{$ifdef ARM} postprocess_code;
{ because of the limited constant size of the arm, all data access is done pc relative }
finalizearmcode(aktproccode,aktlocaldata);
{$endif ARM}
{$ifdef AVR}
{ because of the limited branch distance of cond. branches, they must be replaced
sometimes by normal jmps and an inverse branch }
finalizeavrcode(aktproccode);
{$endif AVR}
{ Add end symbol and debug info } { Add end symbol and debug info }
{ this must be done after the pcrelativedata is appended else the distance calculation of { this must be done after the pcrelativedata is appended else the distance calculation of