mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-12 13:49:51 +02:00
* optimized ansistring compare with ''
* fixed 852
This commit is contained in:
parent
a7a2d53494
commit
190ba4c78c
@ -189,35 +189,72 @@ implementation
|
|||||||
equaln,unequaln:
|
equaln,unequaln:
|
||||||
begin
|
begin
|
||||||
cmpop:=true;
|
cmpop:=true;
|
||||||
secondpass(p^.left);
|
if (p^.treetype in [equaln,unequaln]) and
|
||||||
pushed:=maybe_push(p^.right^.registers32,p^.left,false);
|
(p^.left^.treetype=stringconstn) and
|
||||||
secondpass(p^.right);
|
(p^.left^.length=0) then
|
||||||
if pushed then
|
begin
|
||||||
restore(p^.left,false);
|
secondpass(p^.right);
|
||||||
{ release used registers }
|
{ release used registers }
|
||||||
del_location(p^.right^.location);
|
del_location(p^.right^.location);
|
||||||
del_location(p^.left^.location);
|
del_location(p^.left^.location);
|
||||||
{ push the still used registers }
|
case p^.right^.location.loc of
|
||||||
pushusedregisters(pushedregs,$ff);
|
LOC_REFERENCE,LOC_MEM:
|
||||||
{ push data }
|
emit_const_ref(A_CMP,S_L,0,newreference(p^.right^.location.reference));
|
||||||
case p^.right^.location.loc of
|
LOC_REGISTER,LOC_CREGISTER:
|
||||||
LOC_REFERENCE,LOC_MEM:
|
emit_const_reg(A_CMP,S_L,0,p^.right^.location.register);
|
||||||
emit_push_mem(p^.right^.location.reference);
|
end;
|
||||||
LOC_REGISTER,LOC_CREGISTER:
|
ungetiftempansi(p^.left^.location.reference);
|
||||||
emit_reg(A_PUSH,S_L,p^.right^.location.register);
|
ungetiftempansi(p^.right^.location.reference);
|
||||||
end;
|
end
|
||||||
case p^.left^.location.loc of
|
else if (p^.treetype in [equaln,unequaln]) and
|
||||||
LOC_REFERENCE,LOC_MEM:
|
(p^.right^.treetype=stringconstn) and
|
||||||
emit_push_mem(p^.left^.location.reference);
|
(p^.right^.length=0) then
|
||||||
LOC_REGISTER,LOC_CREGISTER:
|
begin
|
||||||
emit_reg(A_PUSH,S_L,p^.left^.location.register);
|
secondpass(p^.left);
|
||||||
end;
|
{ release used registers }
|
||||||
emitcall('FPC_ANSISTR_COMPARE');
|
del_location(p^.right^.location);
|
||||||
emit_reg_reg(A_OR,S_L,R_EAX,R_EAX);
|
del_location(p^.left^.location);
|
||||||
popusedregisters(pushedregs);
|
case p^.right^.location.loc of
|
||||||
maybe_loadesi;
|
LOC_REFERENCE,LOC_MEM:
|
||||||
ungetiftempansi(p^.left^.location.reference);
|
emit_const_ref(A_CMP,S_L,0,newreference(p^.left^.location.reference));
|
||||||
ungetiftempansi(p^.right^.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);
|
||||||
|
pushed:=maybe_push(p^.right^.registers32,p^.left,false);
|
||||||
|
secondpass(p^.right);
|
||||||
|
if pushed then
|
||||||
|
restore(p^.left,false);
|
||||||
|
{ release used registers }
|
||||||
|
del_location(p^.right^.location);
|
||||||
|
del_location(p^.left^.location);
|
||||||
|
{ push the still used registers }
|
||||||
|
pushusedregisters(pushedregs,$ff);
|
||||||
|
{ push data }
|
||||||
|
case p^.right^.location.loc of
|
||||||
|
LOC_REFERENCE,LOC_MEM:
|
||||||
|
emit_push_mem(p^.right^.location.reference);
|
||||||
|
LOC_REGISTER,LOC_CREGISTER:
|
||||||
|
emit_reg(A_PUSH,S_L,p^.right^.location.register);
|
||||||
|
end;
|
||||||
|
case p^.left^.location.loc of
|
||||||
|
LOC_REFERENCE,LOC_MEM:
|
||||||
|
emit_push_mem(p^.left^.location.reference);
|
||||||
|
LOC_REGISTER,LOC_CREGISTER:
|
||||||
|
emit_reg(A_PUSH,S_L,p^.left^.location.register);
|
||||||
|
end;
|
||||||
|
emitcall('FPC_ANSISTR_COMPARE');
|
||||||
|
emit_reg_reg(A_OR,S_L,R_EAX,R_EAX);
|
||||||
|
popusedregisters(pushedregs);
|
||||||
|
maybe_loadesi;
|
||||||
|
ungetiftempansi(p^.left^.location.reference);
|
||||||
|
ungetiftempansi(p^.right^.location.reference);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{ the result of ansicompare is signed }
|
{ the result of ansicompare is signed }
|
||||||
@ -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
|
||||||
|
@ -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
|
||||||
@ -963,4 +979,4 @@ end.
|
|||||||
* arrayconstructor -> arrayofconst fixed when arraycosntructor was not
|
* arrayconstructor -> arrayofconst fixed when arraycosntructor was not
|
||||||
variant.
|
variant.
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user