* optimized ansistring compare with ''

* fixed 852
This commit is contained in:
florian 2000-02-18 16:13:28 +00:00
parent a7a2d53494
commit 190ba4c78c
2 changed files with 90 additions and 33 deletions

View File

@ -189,6 +189,42 @@ implementation
equaln,unequaln: equaln,unequaln:
begin begin
cmpop:=true; cmpop:=true;
if (p^.treetype in [equaln,unequaln]) and
(p^.left^.treetype=stringconstn) and
(p^.left^.length=0) then
begin
secondpass(p^.right);
{ release used registers }
del_location(p^.right^.location);
del_location(p^.left^.location);
case p^.right^.location.loc of
LOC_REFERENCE,LOC_MEM:
emit_const_ref(A_CMP,S_L,0,newreference(p^.right^.location.reference));
LOC_REGISTER,LOC_CREGISTER:
emit_const_reg(A_CMP,S_L,0,p^.right^.location.register);
end;
ungetiftempansi(p^.left^.location.reference);
ungetiftempansi(p^.right^.location.reference);
end
else if (p^.treetype in [equaln,unequaln]) and
(p^.right^.treetype=stringconstn) and
(p^.right^.length=0) then
begin
secondpass(p^.left);
{ release used registers }
del_location(p^.right^.location);
del_location(p^.left^.location);
case p^.right^.location.loc of
LOC_REFERENCE,LOC_MEM:
emit_const_ref(A_CMP,S_L,0,newreference(p^.left^.location.reference));
LOC_REGISTER,LOC_CREGISTER:
emit_const_reg(A_CMP,S_L,0,p^.left^.location.register);
end;
ungetiftempansi(p^.left^.location.reference);
ungetiftempansi(p^.right^.location.reference);
end
else
begin
secondpass(p^.left); secondpass(p^.left);
pushed:=maybe_push(p^.right^.registers32,p^.left,false); pushed:=maybe_push(p^.right^.registers32,p^.left,false);
secondpass(p^.right); secondpass(p^.right);
@ -220,6 +256,7 @@ implementation
ungetiftempansi(p^.right^.location.reference); ungetiftempansi(p^.right^.location.reference);
end; end;
end; end;
end;
{ the result of ansicompare is signed } { the result of ansicompare is signed }
SetResultLocation(cmpop,false,p); SetResultLocation(cmpop,false,p);
end; end;
@ -2240,7 +2277,11 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.94 2000-02-14 22:34:28 florian Revision 1.95 2000-02-18 16:13:28 florian
* optimized ansistring compare with ''
* fixed 852
Revision 1.94 2000/02/14 22:34:28 florian
* fixed another internalerror * fixed another internalerror
Revision 1.93 2000/02/09 13:22:45 peter Revision 1.93 2000/02/09 13:22:45 peter

View File

@ -63,7 +63,7 @@ implementation
globtype,systems,tokens, globtype,systems,tokens,
cobjects,verbose,globals, cobjects,verbose,globals,
symconst, symconst,
types,pass_1, types,pass_1,cpubase,
{$ifdef newcg} {$ifdef newcg}
cgbase cgbase
{$else} {$else}
@ -595,6 +595,18 @@ implementation
if (abs(p^.left^.registersmmx-p^.right^.registersmmx)<mmx) then if (abs(p^.left^.registersmmx-p^.right^.registersmmx)<mmx) then
inc(p^.registersmmx,mmx); inc(p^.registersmmx,mmx);
{$endif SUPPORT_MMX} {$endif SUPPORT_MMX}
{ the following is a little bit guessing but I think }
{ it's the only way to solve same internalerrors: }
{ if the left and right node both uses registers }
{ and return a mem location, but the current node }
{ doesn't use an integer register we get probably }
{ trouble when restoring a node }
if (p^.left^.registers32=p^.right^.registers32) and
(p^.registers32=p^.left^.registers32) and
(p^.registers32>0) and
(p^.left^.location.loc in [LOC_REFERENCE,LOC_MEM]) and
(p^.right^.location.loc in [LOC_REFERENCE,LOC_MEM]) then
inc(p^.registers32);
end end
else else
begin begin
@ -889,7 +901,11 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.58 2000-02-09 13:22:53 peter Revision 1.59 2000-02-18 16:13:29 florian
* optimized ansistring compare with ''
* fixed 852
Revision 1.58 2000/02/09 13:22:53 peter
* log truncated * log truncated
Revision 1.57 2000/02/05 12:11:50 peter Revision 1.57 2000/02/05 12:11:50 peter