mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-24 03:51:39 +02:00
* disable string node optimizations for the moment
This commit is contained in:
parent
7054a48b4d
commit
75394a788e
@ -24,6 +24,12 @@ unit nadd;
|
|||||||
|
|
||||||
{$i fpcdefs.inc}
|
{$i fpcdefs.inc}
|
||||||
|
|
||||||
|
{ define addstringopt}
|
||||||
|
|
||||||
|
{$ifdef callparatemp}
|
||||||
|
{$undef addstringopt}
|
||||||
|
{$endif}
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
@ -777,11 +783,11 @@ implementation
|
|||||||
if not(is_constcharnode(left) and is_constcharnode(right)) then
|
if not(is_constcharnode(left) and is_constcharnode(right)) then
|
||||||
begin
|
begin
|
||||||
inserttypeconv(left,cshortstringtype);
|
inserttypeconv(left,cshortstringtype);
|
||||||
{$ifndef callparatemp}
|
{$ifdef addstringopt}
|
||||||
hp := genaddsstringcharoptnode(self);
|
hp := genaddsstringcharoptnode(self);
|
||||||
result := hp;
|
result := hp;
|
||||||
exit;
|
exit;
|
||||||
{$endif callparatemp}
|
{$endif addstringopt}
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
@ -1776,7 +1782,7 @@ implementation
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
{$ifndef callparatemp}
|
{$ifdef addstringopt}
|
||||||
{ can create a call which isn't handled by callparatemp }
|
{ can create a call which isn't handled by callparatemp }
|
||||||
if canbeaddsstringcharoptnode(self) then
|
if canbeaddsstringcharoptnode(self) then
|
||||||
begin
|
begin
|
||||||
@ -1785,7 +1791,7 @@ implementation
|
|||||||
exit;
|
exit;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
{$endif callparatemp}
|
{$endif addstringopt}
|
||||||
begin
|
begin
|
||||||
{ Fix right to be shortstring }
|
{ Fix right to be shortstring }
|
||||||
if is_char(right.resulttype.def) then
|
if is_char(right.resulttype.def) then
|
||||||
@ -1794,7 +1800,7 @@ implementation
|
|||||||
firstpass(right);
|
firstpass(right);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{$ifndef callparatemp}
|
{$ifdef addstringopt}
|
||||||
{ can create a call which isn't handled by callparatemp }
|
{ can create a call which isn't handled by callparatemp }
|
||||||
if canbeaddsstringcsstringoptnode(self) then
|
if canbeaddsstringcsstringoptnode(self) then
|
||||||
begin
|
begin
|
||||||
@ -1802,7 +1808,7 @@ implementation
|
|||||||
pass_1 := hp;
|
pass_1 := hp;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
{$endif callparatemp}
|
{$endif addstringopt}
|
||||||
end;
|
end;
|
||||||
{ otherwise, let addstring convert everything }
|
{ otherwise, let addstring convert everything }
|
||||||
result := first_addstring;
|
result := first_addstring;
|
||||||
@ -1953,7 +1959,10 @@ begin
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.90 2003-05-26 19:38:28 peter
|
Revision 1.91 2003-05-26 21:15:18 peter
|
||||||
|
* disable string node optimizations for the moment
|
||||||
|
|
||||||
|
Revision 1.90 2003/05/26 19:38:28 peter
|
||||||
* generic fpc_shorstr_concat
|
* generic fpc_shorstr_concat
|
||||||
+ fpc_shortstr_append_shortstr optimization
|
+ fpc_shortstr_append_shortstr optimization
|
||||||
|
|
||||||
|
|||||||
@ -34,10 +34,6 @@ type
|
|||||||
procedure pass_2; override;
|
procedure pass_2; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
tcgaddsstringcsstringoptnode = class(taddsstringcsstringoptnode)
|
|
||||||
{ must be duplicated from ti386addnode :( }
|
|
||||||
procedure pass_2; override;
|
|
||||||
end;
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -200,59 +196,17 @@ begin
|
|||||||
location_copy(location,left.location);
|
location_copy(location,left.location);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure tcgaddsstringcsstringoptnode.pass_2;
|
|
||||||
var
|
|
||||||
href: treference;
|
|
||||||
pushedregs: tpushedsavedint;
|
|
||||||
regstopush: tsupregset;
|
|
||||||
begin
|
|
||||||
{ first, we have to more or less replicate some code from }
|
|
||||||
{ ti386addnode.pass_2 }
|
|
||||||
secondpass(left);
|
|
||||||
if not(tg.istemp(left.location.reference) and
|
|
||||||
(tg.sizeoftemp(exprasmlist,left.location.reference) = 256)) and
|
|
||||||
not(nf_use_strconcat in flags) then
|
|
||||||
begin
|
|
||||||
tg.GetTemp(exprasmlist,256,tt_normal,href);
|
|
||||||
cg.g_copyshortstring(exprasmlist,left.location.reference,href,255,true,false);
|
|
||||||
{ release the registers }
|
|
||||||
location_freetemp(exprasmlist,left.location);
|
|
||||||
{ return temp reference }
|
|
||||||
location_reset(left.location,LOC_REFERENCE,def_cgsize(resulttype.def));
|
|
||||||
left.location.reference:=href;
|
|
||||||
end;
|
|
||||||
secondpass(right);
|
|
||||||
{ on the right we do not need the register anymore too }
|
|
||||||
{ Instead of releasing them already, simply do not }
|
|
||||||
{ push them (so the release is in the right place, }
|
|
||||||
{ because emitpushreferenceaddr doesn't need extra }
|
|
||||||
{ registers) (JM) }
|
|
||||||
regstopush := all_intregisters;
|
|
||||||
remove_non_regvars_from_loc(right.location,regstopush);
|
|
||||||
rg.saveusedintregisters(exprasmlist,pushedregs,regstopush);
|
|
||||||
{ push the maximum possible length of the result }
|
|
||||||
cg.a_paramaddr_ref(exprasmlist,left.location.reference,paramanager.getintparaloc(2));
|
|
||||||
{ the optimizer can more easily put the }
|
|
||||||
{ deallocations in the right place if it happens }
|
|
||||||
{ too early than when it happens too late (if }
|
|
||||||
{ the pushref needs a "lea (..),edi; push edi") }
|
|
||||||
reference_release(exprasmlist,right.location.reference);
|
|
||||||
cg.a_paramaddr_ref(exprasmlist,right.location.reference,paramanager.getintparaloc(1));
|
|
||||||
rg.saveintregvars(exprasmlist,regstopush);
|
|
||||||
cg.a_call_name(exprasmlist,'FPC_SHORTSTR_CONCAT');
|
|
||||||
tg.ungetiftemp(exprasmlist,right.location.reference);
|
|
||||||
rg.restoreusedintregisters(exprasmlist,pushedregs);
|
|
||||||
location_copy(location,left.location);
|
|
||||||
end;
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
caddsstringcharoptnode := tcgaddsstringcharoptnode;
|
caddsstringcharoptnode := tcgaddsstringcharoptnode;
|
||||||
caddsstringcsstringoptnode := tcgaddsstringcsstringoptnode
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.2 2003-04-26 09:12:55 peter
|
Revision 1.3 2003-05-26 21:15:18 peter
|
||||||
|
* disable string node optimizations for the moment
|
||||||
|
|
||||||
|
Revision 1.2 2003/04/26 09:12:55 peter
|
||||||
* add string returns in LOC_REFERENCE
|
* add string returns in LOC_REFERENCE
|
||||||
|
|
||||||
Revision 1.1 2003/04/24 11:20:06 florian
|
Revision 1.1 2003/04/24 11:20:06 florian
|
||||||
|
|||||||
@ -67,6 +67,7 @@ type
|
|||||||
{ add a constant string to a short string }
|
{ add a constant string to a short string }
|
||||||
taddsstringcsstringoptnode = class(taddsstringoptnode)
|
taddsstringcsstringoptnode = class(taddsstringoptnode)
|
||||||
constructor create(l,r : tnode); virtual;
|
constructor create(l,r : tnode); virtual;
|
||||||
|
function pass_1: tnode; override;
|
||||||
end;
|
end;
|
||||||
taddsstringcsstringoptnodeclass = class of taddsstringcsstringoptnode;
|
taddsstringcsstringoptnodeclass = class of taddsstringcsstringoptnode;
|
||||||
|
|
||||||
@ -84,7 +85,7 @@ var
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses cutils, htypechk, defutil, defcmp, globtype, globals, cpubase, ncnv, ncon,
|
uses cutils, htypechk, defutil, defcmp, globtype, globals, cpubase, ncnv, ncon,ncal,
|
||||||
verbose, symdef, cginfo,cgbase;
|
verbose, symdef, cginfo,cgbase;
|
||||||
|
|
||||||
|
|
||||||
@ -224,6 +225,17 @@ begin
|
|||||||
inherited create(addsstringcsstringoptn,l,r);
|
inherited create(addsstringcsstringoptn,l,r);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function taddsstringcsstringoptnode.pass_1: tnode;
|
||||||
|
begin
|
||||||
|
{ create the call to the concat routine both strings as arguments }
|
||||||
|
result := ccallnode.createintern('fpc_shortstr_append_shortstr',
|
||||||
|
ccallparanode.create(left,ccallparanode.create(right,nil)));
|
||||||
|
left:=nil;
|
||||||
|
right:=nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{*****************************************************************************
|
{*****************************************************************************
|
||||||
HELPERS
|
HELPERS
|
||||||
*****************************************************************************}
|
*****************************************************************************}
|
||||||
@ -278,7 +290,10 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.15 2003-04-27 11:21:33 peter
|
Revision 1.16 2003-05-26 21:15:18 peter
|
||||||
|
* disable string node optimizations for the moment
|
||||||
|
|
||||||
|
Revision 1.15 2003/04/27 11:21:33 peter
|
||||||
* aktprocdef renamed to current_procdef
|
* aktprocdef renamed to current_procdef
|
||||||
* procinfo renamed to current_procinfo
|
* procinfo renamed to current_procinfo
|
||||||
* procinfo will now be stored in current_module so it can be
|
* procinfo will now be stored in current_module so it can be
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user