* small optimization to case genlist() case statements

This commit is contained in:
Jonas Maebe 2002-09-09 13:57:45 +00:00
parent 36e41d49d3
commit 775b065d70
2 changed files with 15 additions and 7 deletions

View File

@ -736,10 +736,11 @@ implementation
{ present label then the lower limit can be checked } { present label then the lower limit can be checked }
{ immediately. else check the range in between: } { immediately. else check the range in between: }
{ note: you can't use gensub() here because dec doesn't } gensub(longint(t^._low-last));
{ change the carry flag (needed for jmp_lxx) (JM) } { no jump necessary here if the new range starts at }
emit_const_reg(A_SUB,opsize,longint(t^._low-last),hregister); { at the value following the previous one }
emitjmp(jmp_le,elselabel); if (t^._low-last) <> 1 then
emitjmp(jmp_le,elselabel);
end; end;
emit_const_reg(A_SUB,opsize,longint(t^._high-t^._low),hregister); emit_const_reg(A_SUB,opsize,longint(t^._high-t^._low),hregister);
emitjmp(jmp_lee,t^.statement); emitjmp(jmp_lee,t^.statement);
@ -1023,7 +1024,10 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.40 2002-08-17 09:23:46 florian Revision 1.41 2002-09-09 13:57:45 jonas
* small optimization to case genlist() case statements
Revision 1.40 2002/08/17 09:23:46 florian
* first part of procinfo rewrite * first part of procinfo rewrite
Revision 1.39 2002/08/12 15:08:42 carl Revision 1.39 2002/08/12 15:08:42 carl

View File

@ -121,7 +121,8 @@ implementation
{ present label then the lower limit can be checked } { present label then the lower limit can be checked }
{ immediately. else check the range in between: } { immediately. else check the range in between: }
gensub(longint(t^._low-last)); gensub(longint(t^._low-last));
tcgppc(cg).a_jmp_cond(exprasmlist,jmp_lt,elselabel); if (t^._low-last) <> 1 then
tcgppc(cg).a_jmp_cond(exprasmlist,jmp_lt,elselabel);
end; end;
gensub(longint(t^._high-t^._low)); gensub(longint(t^._high-t^._low));
tcgppc(cg).a_jmp_cond(exprasmlist,jmp_le,t^.statement); tcgppc(cg).a_jmp_cond(exprasmlist,jmp_le,t^.statement);
@ -154,7 +155,10 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.2 2002-09-08 20:14:33 jonas Revision 1.3 2002-09-09 13:57:45 jonas
* small optimization to case genlist() case statements
Revision 1.2 2002/09/08 20:14:33 jonas
* use genlinearcmplist() for unsigned 32bit case statements instead * use genlinearcmplist() for unsigned 32bit case statements instead
of genlinearlist(), because the addic. instruction always sets the of genlinearlist(), because the addic. instruction always sets the
flags as if the arguments are signed 32bits (for smaller unsigned flags as if the arguments are signed 32bits (for smaller unsigned