+ implemented/fixed docompare() mathods for all nodes (not tested)

+ nopt.pas, nadd.pas, i386/n386opt.pas: optimized nodes for adding strings
    and constant strings/chars together
  * n386add.pas: don't copy temp strings (of size 256) to another temp string
    when adding
This commit is contained in:
Jonas Maebe 2000-12-31 11:14:10 +00:00
parent 6fa8b40f74
commit 4c8ca9774f
13 changed files with 399 additions and 48 deletions

View File

@ -30,12 +30,19 @@ unit cpunode;
uses
n386bas,n386ld,n386add,n386cal,n386con,n386flw,n386mat,n386mem,
n386set,n386inl;
n386set,n386inl,n386opt;
end.
{
$Log$
Revision 1.1 2000-10-15 09:39:37 peter
Revision 1.2 2000-12-31 11:14:11 jonas
+ implemented/fixed docompare() mathods for all nodes (not tested)
+ nopt.pas, nadd.pas, i386/n386opt.pas: optimized nodes for adding strings
and constant strings/chars together
* n386add.pas: don't copy temp strings (of size 256) to another temp string
when adding
Revision 1.1 2000/10/15 09:39:37 peter
* moved cpu*.pas to i386/
* renamed n386 to common cpunode

View File

@ -267,8 +267,13 @@ interface
secondpass(left);
{ if str_concat is set in expr
s:=s+ ... no need to create a temp string (PM) }
{ the tempstring can also come from a typeconversion }
{ or a function result, so simply check for a }
{ temp of 256 bytes(JM) }
if (left.nodetype<>addn) and not(nf_use_strconcat in flags) then
if not(istemp(left.location.reference) and
(getsizeoftemp(left.location.reference) = 256)) and
not(nf_use_strconcat in flags) then
begin
{ can only reference be }
@ -2289,7 +2294,14 @@ begin
end.
{
$Log$
Revision 1.8 2000-12-25 00:07:32 peter
Revision 1.9 2000-12-31 11:14:11 jonas
+ implemented/fixed docompare() mathods for all nodes (not tested)
+ nopt.pas, nadd.pas, i386/n386opt.pas: optimized nodes for adding strings
and constant strings/chars together
* n386add.pas: don't copy temp strings (of size 256) to another temp string
when adding
Revision 1.8 2000/12/25 00:07:32 peter
+ new tlinkedlist class (merge of old tstringqueue,tcontainer and
tlinkedlist objects)

View File

@ -55,7 +55,7 @@ implementation
hcodegen,
{$endif newcg}
htypechk,pass_1,
nmat,ncnv,nld,ncon,nset,
nmat,ncnv,nld,ncon,nset,nopt,
cpubase;
@ -428,13 +428,11 @@ implementation
if nodetype=addn then
begin
left:=gentypeconvnode(left,cshortstringdef);
right:=gentypeconvnode(right,cshortstringdef);
firstpass(left);
firstpass(right);
{ here we call STRCOPY }
procinfo^.flags:=procinfo^.flags or pi_do_call;
calcregisters(self,0,0,0);
location.loc:=LOC_MEM;
hp := genaddsstringcharoptnode(self);
firstpass(hp);
pass_1 := hp;
exit;
end
else
calcregisters(self,1,0,0);
@ -770,19 +768,25 @@ implementation
end
else
begin
if not(is_shortstring(rd))
{$ifdef newoptimizations2}
{$ifdef i386}
{ shortstring + char handled seperately (JM) }
and (not(cs_optimize in aktglobalswitches) or
(nodetype <> addn) or not(is_char(rd)))
{$endif i386}
{$endif newoptimizations2}
then
right:=gentypeconvnode(right,cshortstringdef);
if canbeaddsstringcharoptnode(self) then
begin
hp := genaddsstringcharoptnode(self);
firstpass(hp);
pass_1 := hp;
exit;
end;
if canbeaddsstringcsstringoptnode(self) then
begin
hp := genaddsstringcsstringoptnode(self);
firstpass(hp);
pass_1 := hp;
exit;
end;
if not(is_shortstring(ld)) then
left:=gentypeconvnode(left,cshortstringdef);
resulttype:=cshortstringdef;
if not(is_shortstring(rd)) then
right:=gentypeconvnode(right,cshortstringdef);
resulttype:=left.resulttype;
{ this is only for add, the comparisaion is handled later }
location.loc:=LOC_MEM;
end;
@ -798,14 +802,6 @@ implementation
calcregisters(self,0,0,0)
else
calcregisters(self,1,0,0);
{$ifdef newoptimizations2}
{$ifdef i386}
{ not always necessary, only if it is not a constant char and }
{ not a regvar, but don't know how to check this here (JM) }
if is_char(rd) then
inc(registers32);
{$endif i386}
{$endif newoptimizations2}
convdone:=true;
end
else
@ -1213,7 +1209,14 @@ begin
end.
{
$Log$
Revision 1.19 2000-12-16 15:55:32 jonas
Revision 1.20 2000-12-31 11:14:10 jonas
+ implemented/fixed docompare() mathods for all nodes (not tested)
+ nopt.pas, nadd.pas, i386/n386opt.pas: optimized nodes for adding strings
and constant strings/chars together
* n386add.pas: don't copy temp strings (of size 256) to another temp string
when adding
Revision 1.19 2000/12/16 15:55:32 jonas
+ warning when there is a chance to get a range check error because of
automatic type conversion to u32bit
* arithmetic operations with a cardinal and a signed operand are carried

View File

@ -47,6 +47,7 @@ interface
destructor destroy;override;
function getcopy : tnode;override;
function pass_1 : tnode;override;
function docompare(p: tnode): boolean; override;
end;
tstatementnode = class(tbinarynode)
@ -329,6 +330,12 @@ implementation
procinfo^.flags:=procinfo^.flags or pi_uses_asm;
end;
function tasmnode.docompare(p: tnode): boolean;
begin
{ comparing of asmlists is not implemented (JM) }
docompare := false;
end;
begin
cnothingnode:=tnothingnode;
cerrornode:=terrornode;
@ -338,7 +345,14 @@ begin
end.
{
$Log$
Revision 1.6 2000-12-25 00:07:26 peter
Revision 1.7 2000-12-31 11:14:10 jonas
+ implemented/fixed docompare() mathods for all nodes (not tested)
+ nopt.pas, nadd.pas, i386/n386opt.pas: optimized nodes for adding strings
and constant strings/chars together
* n386add.pas: don't copy temp strings (of size 256) to another temp string
when adding
Revision 1.6 2000/12/25 00:07:26 peter
+ new tlinkedlist class (merge of old tstringqueue,tcontainer and
tlinkedlist objects)

View File

@ -48,6 +48,7 @@ interface
function getcopy : tnode;override;
procedure insertintolist(l : tnodelist);override;
function pass_1 : tnode;override;
function docompare(p: tnode): boolean; override;
end;
tcallparaflags = (
@ -74,6 +75,7 @@ interface
procedure secondcallparan(defcoll : tparaitem;
push_from_left_to_right,inlined,is_cdecl : boolean;
para_alignment,para_offset : longint);virtual;abstract;
function docompare(p: tnode): boolean; override;
end;
tprocinlinenode = class(tnode)
@ -85,6 +87,7 @@ interface
function getcopy : tnode;override;
procedure insertintolist(l : tnodelist);override;
function pass_1 : tnode;override;
function docompare(p: tnode): boolean; override;
end;
function gencallparanode(expr,next : tnode) : tnode;
@ -486,6 +489,15 @@ interface
firstpass(hightree);
end;
function tcallparanode.docompare(p: tnode): boolean;
begin
docompare :=
inherited docompare(p) and
(callparaflags = tcallparanode(p).callparaflags) and
hightree.isequal(tcallparanode(p).hightree);
end;
{****************************************************************************
TCALLNODE
****************************************************************************}
@ -1463,6 +1475,16 @@ interface
aktcallprocsym:=oldcallprocsym;
end;
function tcallnode.docompare(p: tnode): boolean;
begin
docompare :=
inherited docompare(p) and
(symtableprocentry = tcallnode(p).symtableprocentry) and
(symtableproc = tcallnode(p).symtableproc) and
(procdefinition = tcallnode(p).procdefinition) and
(methodpointer = tcallnode(p).methodpointer);
end;
{****************************************************************************
TPROCINLINENODE
****************************************************************************}
@ -1528,6 +1550,14 @@ interface
{ might be required later if we change the arg handling !! }
end;
function tprocinlinenode.docompare(p: tnode): boolean;
begin
docompare :=
inherited docompare(p) and
inlinetree.isequal(tprocinlinenode(p).inlinetree) and
(inlineprocsym = tprocinlinenode(p).inlineprocsym);
end;
begin
ccallnode:=tcallnode;
ccallparanode:=tcallparanode;
@ -1535,7 +1565,14 @@ begin
end.
{
$Log$
Revision 1.20 2000-12-25 00:07:26 peter
Revision 1.21 2000-12-31 11:14:10 jonas
+ implemented/fixed docompare() mathods for all nodes (not tested)
+ nopt.pas, nadd.pas, i386/n386opt.pas: optimized nodes for adding strings
and constant strings/chars together
* n386add.pas: don't copy temp strings (of size 256) to another temp string
when adding
Revision 1.20 2000/12/25 00:07:26 peter
+ new tlinkedlist class (merge of old tstringqueue,tcontainer and
tlinkedlist objects)

View File

@ -63,6 +63,7 @@ interface
function first_arrayconstructor_to_set : tnode;virtual;
function first_class_to_intf : tnode;virtual;
function first_call_helper(c : tconverttype) : tnode;
function docompare(p: tnode) : boolean; override;
end;
tasnode = class(tbinarynode)
@ -1188,6 +1189,12 @@ implementation
resulttype:=pclassrefdef(right.resulttype)^.pointertype.def;
end;
function ttypeconvnode.docompare(p: tnode) : boolean;
begin
docompare :=
inherited docompare(p) and
(convtype = ttypeconvnode(p).convtype);
end;
begin
ctypeconvnode:=ttypeconvnode;
@ -1196,7 +1203,14 @@ begin
end.
{
$Log$
Revision 1.15 2000-12-08 12:41:01 jonas
Revision 1.16 2000-12-31 11:14:10 jonas
+ implemented/fixed docompare() mathods for all nodes (not tested)
+ nopt.pas, nadd.pas, i386/n386opt.pas: optimized nodes for adding strings
and constant strings/chars together
* n386add.pas: don't copy temp strings (of size 256) to another temp string
when adding
Revision 1.15 2000/12/08 12:41:01 jonas
* fixed bug in sign extension patch
Revision 1.14 2000/12/07 17:19:42 jonas

View File

@ -39,6 +39,7 @@ interface
constructor create(v : bestreal;def : pdef);virtual;
function getcopy : tnode;override;
function pass_1 : tnode;override;
function docompare(p: tnode) : boolean; override;
end;
tfixconstnode = class(tnode)
@ -46,6 +47,7 @@ interface
constructor create(v : longint;def : pdef);virtual;
function getcopy : tnode;override;
function pass_1 : tnode;override;
function docompare(p: tnode) : boolean; override;
end;
tordconstnode = class(tnode)
@ -53,6 +55,7 @@ interface
constructor create(v : tconstexprint;def : pdef);virtual;
function getcopy : tnode;override;
function pass_1 : tnode;override;
function docompare(p: tnode) : boolean; override;
end;
tpointerconstnode = class(tnode)
@ -60,6 +63,7 @@ interface
constructor create(v : tpointerord;def : pdef);virtual;
function getcopy : tnode;override;
function pass_1 : tnode;override;
function docompare(p: tnode) : boolean; override;
end;
tstringconstnode = class(tnode)
@ -74,6 +78,7 @@ interface
function getcopy : tnode;override;
function pass_1 : tnode;override;
function getpcharcopy : pchar;
function docompare(p: tnode) : boolean; override;
end;
tsetconstnode = class(tunarynode)
@ -83,6 +88,7 @@ interface
destructor destroy;override;
function getcopy : tnode;override;
function pass_1 : tnode;override;
function docompare(p: tnode) : boolean; override;
end;
tnilnode = class(tnode)
@ -297,7 +303,12 @@ implementation
p1:=nil;
case p^.consttyp of
constint :
p1:=genordinalconstnode(p^.value,s32bitdef);
if (p^.value >= -maxlongint-1) and (p^.value <= maxlongint) then
p1:=genordinalconstnode(p^.value,s32bitdef)
else if (p^.value > maxlongint) and (p^.value <= int64(maxlongint)+int64(maxlongint)+int64(1)) then
p1:=genordinalconstnode(p^.value,u32bitdef)
else
p1:=genordinalconstnode(p^.value,cs64bitdef);
conststring :
begin
len:=p^.len;
@ -368,6 +379,12 @@ implementation
location.loc:=LOC_MEM;
end;
function trealconstnode.docompare(p: tnode): boolean;
begin
docompare :=
inherited docompare(p) and
(value_real = trealconstnode(p).value_real);
end;
{*****************************************************************************
TFIXCONSTNODE
@ -399,6 +416,12 @@ implementation
location.loc:=LOC_MEM;
end;
function tfixconstnode.docompare(p: tnode): boolean;
begin
docompare :=
inherited docompare(p) and
(value_fix = tfixconstnode(p).value_fix);
end;
{*****************************************************************************
TORDCONSTNODE
@ -431,6 +454,12 @@ implementation
location.loc:=LOC_MEM;
end;
function tordconstnode.docompare(p: tnode): boolean;
begin
docompare :=
inherited docompare(p) and
(value = tordconstnode(p).value);
end;
{*****************************************************************************
TPOINTERCONSTNODE
@ -461,6 +490,12 @@ implementation
location.loc:=LOC_MEM;
end;
function tpointerconstnode.docompare(p: tnode): boolean;
begin
docompare :=
inherited docompare(p) and
(value = tpointerconstnode(p).value);
end;
{*****************************************************************************
TSTRINGCONSTNODE
@ -584,6 +619,16 @@ implementation
getpcharcopy:=pc;
end;
function tstringconstnode.docompare(p: tnode): boolean;
begin
docompare :=
inherited docompare(p) and
(len = tstringconstnode(p).len) and
{ Don't compare the pchars, since they may contain null chars }
{ Since all equal constant strings are replaced by the same }
{ label, the following compare should be enough (JM) }
(lab_str = tstringconstnode(p).lab_str);
end;
{*****************************************************************************
TSETCONSTNODE
@ -634,6 +679,24 @@ implementation
location.loc:=LOC_MEM;
end;
function tsetconstnode.docompare(p: tnode): boolean;
var
i: 0..31;
begin
if inherited docompare(p) then
begin
for i := 0 to 31 do
if (value_set^[i] <> tsetconstnode(p).value_set^[i]) then
begin
docompare := false;
exit
end;
docompare := true;
end
else
docompare := false;
end;
{*****************************************************************************
TNILNODE
*****************************************************************************}
@ -662,7 +725,14 @@ begin
end.
{
$Log$
Revision 1.14 2000-12-16 15:58:48 jonas
Revision 1.15 2000-12-31 11:14:10 jonas
+ implemented/fixed docompare() mathods for all nodes (not tested)
+ nopt.pas, nadd.pas, i386/n386opt.pas: optimized nodes for adding strings
and constant strings/chars together
* n386add.pas: don't copy temp strings (of size 256) to another temp string
when adding
Revision 1.14 2000/12/16 15:58:48 jonas
* genintconstnode now returns cardinals instead of int64 constants if possible
Revision 1.13 2000/12/15 13:26:01 jonas

View File

@ -41,6 +41,7 @@ interface
{$ifdef extdebug}
procedure dowrite;override;
{$endif extdebug}
function docompare(p: tnode): boolean; override;
end;
twhilerepeatnode = class(tloopnode)
@ -78,6 +79,7 @@ interface
constructor create(p : pasmlabel);virtual;
function getcopy : tnode;override;
function pass_1 : tnode;override;
function docompare(p: tnode): boolean; override;
end;
tlabelnode = class(tunarynode)
@ -87,6 +89,7 @@ interface
constructor create(p : pasmlabel;l:tnode);virtual;
function getcopy : tnode;override;
function pass_1 : tnode;override;
function docompare(p: tnode): boolean; override;
end;
traisenode = class(tbinarynode)
@ -95,6 +98,7 @@ interface
function getcopy : tnode;override;
procedure insertintolist(l : tnodelist);override;
function pass_1 : tnode;override;
function docompare(p: tnode): boolean; override;
end;
ttryexceptnode = class(tloopnode)
@ -114,11 +118,13 @@ interface
destructor destroy;override;
function pass_1 : tnode;override;
function getcopy : tnode;override;
function docompare(p: tnode): boolean; override;
end;
tfailnode = class(tnode)
constructor create;virtual;
function pass_1: tnode;override;
function docompare(p: tnode): boolean; override;
end;
{ for compatibilty }
@ -227,6 +233,13 @@ implementation
end;
{$endif extdebug}
function tloopnode.docompare(p: tnode): boolean;
begin
docompare :=
inherited docompare(p) and
t1.isequal(tloopnode(p).t1) and
t2.isequal(tloopnode(p).t2);
end;
{****************************************************************************
TWHILEREPEATNODE
@ -652,6 +665,11 @@ implementation
result:=p;
end;
function tgotonode.docompare(p: tnode): boolean;
begin
docompare := false;
end;
{*****************************************************************************
TLABELNODE
*****************************************************************************}
@ -699,6 +717,11 @@ implementation
result:=p;
end;
function tlabelnode.docompare(p: tnode): boolean;
begin
docompare := false;
end;
{*****************************************************************************
TRAISENODE
*****************************************************************************}
@ -766,6 +789,11 @@ implementation
end;
end;
function traisenode.docompare(p: tnode): boolean;
begin
docompare := false;
end;
{*****************************************************************************
TTRYEXCEPTNODE
@ -952,8 +980,14 @@ implementation
end;
end;
function tonnode.docompare(p: tnode): boolean;
begin
docompare := false;
end;
{*****************************************************************************
TONNODE
TFAILNODE
*****************************************************************************}
@ -969,6 +1003,13 @@ implementation
pass_1:=nil;
end;
function tfailnode.docompare(p: tnode): boolean;
begin
docompare := false;
end;
begin
cwhilerepeatnode:=twhilerepeatnode;
cifnode:=tifnode;
@ -984,7 +1025,14 @@ begin
end.
{
$Log$
Revision 1.11 2000-11-29 00:30:33 florian
Revision 1.12 2000-12-31 11:14:10 jonas
+ implemented/fixed docompare() mathods for all nodes (not tested)
+ nopt.pas, nadd.pas, i386/n386opt.pas: optimized nodes for adding strings
and constant strings/chars together
* n386add.pas: don't copy temp strings (of size 256) to another temp string
when adding
Revision 1.11 2000/11/29 00:30:33 florian
* unused units removed from uses clause
* some changes for widestrings

View File

@ -37,6 +37,9 @@ interface
constructor create(number : byte;is_const:boolean;l : tnode);virtual;
function getcopy : tnode;override;
function pass_1 : tnode;override;
function docompare(p: tnode): boolean; override;
end;
var
@ -1486,12 +1489,28 @@ implementation
{$maxfpuregisters default}
{$endif fpc}
function tinlinenode.docompare(p: tnode): boolean;
begin
docompare :=
inherited docompare(p) and
(inlinenumber = tinlinenode(p).inlinenumber);
end;
begin
cinlinenode:=tinlinenode;
end.
{
$Log$
Revision 1.21 2000-12-25 00:07:26 peter
Revision 1.22 2000-12-31 11:14:10 jonas
+ implemented/fixed docompare() mathods for all nodes (not tested)
+ nopt.pas, nadd.pas, i386/n386opt.pas: optimized nodes for adding strings
and constant strings/chars together
* n386add.pas: don't copy temp strings (of size 256) to another temp string
when adding
Revision 1.21 2000/12/25 00:07:26 peter
+ new tlinkedlist class (merge of old tstringqueue,tcontainer and
tlinkedlist objects)

View File

@ -37,6 +37,7 @@ interface
constructor create(v : psym;st : psymtable);virtual;
function getcopy : tnode;override;
function pass_1 : tnode;override;
function docompare(p: tnode): boolean; override;
end;
{ different assignment types }
@ -47,6 +48,7 @@ interface
constructor create(l,r : tnode);virtual;
function getcopy : tnode;override;
function pass_1 : tnode;override;
function docompare(p: tnode): boolean; override;
end;
tfuncretnode = class(tnode)
@ -55,6 +57,7 @@ interface
constructor create;virtual;
function getcopy : tnode;override;
function pass_1 : tnode;override;
function docompare(p: tnode): boolean; override;
end;
tarrayconstructorrangenode = class(tbinarynode)
@ -67,6 +70,7 @@ interface
constructor create(l,r : tnode);virtual;
function getcopy : tnode;override;
function pass_1 : tnode;override;
function docompare(p: tnode): boolean; override;
end;
ttypenode = class(tnode)
@ -75,6 +79,7 @@ interface
constructor create(t : pdef;sym:ptypesym);virtual;
function getcopy : tnode;override;
function pass_1 : tnode;override;
function docompare(p: tnode): boolean; override;
end;
var
@ -325,6 +330,13 @@ implementation
end;
end;
function tloadnode.docompare(p: tnode): boolean;
begin
docompare :=
inherited docompare(p) and
(symtableentry = tloadnode(p).symtableentry) and
(symtable = tloadnode(p).symtable);
end;
{*****************************************************************************
TASSIGNMENTNODE
@ -474,6 +486,12 @@ implementation
{$endif SUPPORT_MMX}
end;
function tassignmentnode.docompare(p: tnode): boolean;
begin
docompare :=
inherited docompare(p) and
(assigntype = tassignmentnode(p).assigntype);
end;
{*****************************************************************************
TFUNCRETNODE
@ -508,6 +526,14 @@ implementation
registers32:=1;
end;
function tfuncretnode.docompare(p: tnode): boolean;
begin
docompare :=
inherited docompare(p) and
(funcretprocinfo = tfuncretnode(p).funcretprocinfo) and
(rettype.def = tfuncretnode(p).rettype.def) and
(rettype.sym = tfuncretnode(p).rettype.sym);
end;
{*****************************************************************************
TARRAYCONSTRUCTORRANGENODE
@ -694,6 +720,12 @@ implementation
postprocess(self);
end;
function tarrayconstructornode.docompare(p: tnode): boolean;
begin
docompare :=
inherited docompare(p) and
(constructordef = tarrayconstructornode(p).constructordef);
end;
{*****************************************************************************
TTYPENODE
@ -726,6 +758,13 @@ implementation
{ do nothing, resulttype is already set }
end;
function ttypenode.docompare(p: tnode): boolean;
begin
docompare :=
inherited docompare(p) and
(typenodetype = ttypenode(p).typenodetype) and
(typenodesym = ttypenode(p).typenodesym);
end;
begin
cloadnode:=tloadnode;
@ -737,7 +776,14 @@ begin
end.
{
$Log$
Revision 1.9 2000-11-29 00:30:33 florian
Revision 1.10 2000-12-31 11:14:10 jonas
+ implemented/fixed docompare() mathods for all nodes (not tested)
+ nopt.pas, nadd.pas, i386/n386opt.pas: optimized nodes for adding strings
and constant strings/chars together
* n386add.pas: don't copy temp strings (of size 256) to another temp string
when adding
Revision 1.9 2000/11/29 00:30:33 florian
* unused units removed from uses clause
* some changes for widestrings

View File

@ -77,6 +77,7 @@ interface
constructor create(varsym : psym;l : tnode);virtual;
function getcopy : tnode;override;
function pass_1 : tnode;override;
function docompare(p: tnode): boolean; override;
end;
tvecnode = class(tbinarynode)
@ -97,6 +98,7 @@ interface
destructor destroy;override;
function getcopy : tnode;override;
function pass_1 : tnode;override;
function docompare(p: tnode): boolean; override;
end;
function gensubscriptnode(varsym : pvarsym;l : tnode) : tsubscriptnode;
@ -615,6 +617,13 @@ implementation
end;
end;
function tsubscriptnode.docompare(p: tnode): boolean;
begin
docompare :=
inherited docompare(p) and
(vs = tsubscriptnode(p).vs);
end;
{*****************************************************************************
TVECNODE
@ -869,11 +878,38 @@ implementation
end;
end;
function twithnode.docompare(p: tnode): boolean;
begin
docompare :=
inherited docompare(p) and
(withsymtable = twithnode(p).withsymtable) and
(tablecount = twithnode(p).tablecount);
end;
begin
cloadvmtnode := tloadvmtnode;
chnewnode := thnewnode;
cnewnode := tnewnode;
chdisposenode := thdisposenode;
csimplenewdisposenode := tsimplenewdisposenode;
caddrnode := taddrnode;
cdoubleaddrnode := tdoubleaddrnode;
cderefnode := tderefnode;
csubscriptnode := tsubscriptnode;
cvecnode := tvecnode;
cselfnode := tselfnode;
cwithnode := twithnode;
end.
{
$Log$
Revision 1.13 2000-12-25 00:07:26 peter
Revision 1.14 2000-12-31 11:14:11 jonas
+ implemented/fixed docompare() mathods for all nodes (not tested)
+ nopt.pas, nadd.pas, i386/n386opt.pas: optimized nodes for adding strings
and constant strings/chars together
* n386add.pas: don't copy temp strings (of size 256) to another temp string
when adding
Revision 1.13 2000/12/25 00:07:26 peter
+ new tlinkedlist class (merge of old tstringqueue,tcontainer and
tlinkedlist objects)

View File

@ -1,4 +1,4 @@
{
{
$Id$
Copyright (c) 1999-2000 by Florian Klaempfl
@ -184,6 +184,7 @@
'procinlinen',
'arrayconstructn',
'arrayconstructrangen',
'addoptn',
'nothingn',
'loadvmtn');
@ -195,9 +196,15 @@
function tnode.isequal(p : tnode) : boolean;
begin
isequal:=assigned(p) and (p.nodetype=nodetype) and
(flags*flagsequal=p.flags*flagsequal) and
docompare(p);
isequal:=
(not assigned(self) and not assigned(p)) or
(assigned(self) and assigned(p) and
{ optimized subclasses have the same nodetype as their }
{ superclass (for compatibility), so also check the classtype (JM) }
(p.classtype=classtype) and
(p.nodetype=nodetype) and
(flags*flagsequal=p.flags*flagsequal) and
docompare(p));
end;
function tnode.docompare(p : tnode) : boolean;
@ -399,7 +406,8 @@
function tbinarynode.docompare(p : tnode) : boolean;
begin
docompare:=left.isequal(tbinarynode(p).left) and
docompare:=
inherited docompare(p) and
right.isequal(tbinarynode(p).right);
end;
@ -488,6 +496,7 @@
begin
docompare:=(inherited docompare(p)) or
{ if that's in the flags, is p then always a tbinopnode (?) (JM) }
((nf_swapable in flags) and
left.isequal(tbinopnode(p).right) and
right.isequal(tbinopnode(p).left));
@ -512,7 +521,14 @@
{
$Log$
Revision 1.13 2000-11-29 00:30:34 florian
Revision 1.14 2000-12-31 11:14:11 jonas
+ implemented/fixed docompare() mathods for all nodes (not tested)
+ nopt.pas, nadd.pas, i386/n386opt.pas: optimized nodes for adding strings
and constant strings/chars together
* n386add.pas: don't copy temp strings (of size 256) to another temp string
when adding
Revision 1.13 2000/11/29 00:30:34 florian
* unused units removed from uses clause
* some changes for widestrings

View File

@ -72,6 +72,7 @@ interface
function getcopy : tnode;override;
procedure insertintolist(l : tnodelist);override;
function pass_1 : tnode;override;
function docompare(p: tnode): boolean; override;
end;
var
@ -524,6 +525,27 @@ implementation
begin
end;
function casenodesequal(n1,n2: pcaserecord): boolean;
begin
casenodesequal :=
(not assigned(n1) and not assigned(n2)) or
(assigned(n1) and assigned(n2) and
(n1^._low = n2^._low) and
(n1^._high = n2^._high) and
{ the rest of the fields don't matter for equality (JM) }
casenodesequal(n1^.less,n2^.less) and
casenodesequal(n1^.greater,n2^.greater))
end;
function tcasenode.docompare(p: tnode): boolean;
begin
docompare :=
inherited docompare(p) and
casenodesequal(nodes,tcasenode(p).nodes) and
elseblock.isequal(tcasenode(p).elseblock);
end;
begin
csetelementnode:=tsetelementnode;
cinnode:=tinnode;
@ -532,7 +554,14 @@ begin
end.
{
$Log$
Revision 1.10 2000-12-18 17:44:26 jonas
Revision 1.11 2000-12-31 11:14:11 jonas
+ implemented/fixed docompare() mathods for all nodes (not tested)
+ nopt.pas, nadd.pas, i386/n386opt.pas: optimized nodes for adding strings
and constant strings/chars together
* n386add.pas: don't copy temp strings (of size 256) to another temp string
when adding
Revision 1.10 2000/12/18 17:44:26 jonas
* more int64 case fixes
Revision 1.9 2000/11/29 00:30:34 florian