[fpc-devel] Case code pattern

J. Gareth Moreton gareth at moreton-family.com
Mon Aug 13 16:29:49 CEST 2018


 I haven't explored it too deeply myself, but from what I understand, a
jump table is only generated if there are a large number of branches (over
50).  If it's just a handful of branches, it simply subtracts values from
the input corresponding to the differences between the case labels, and
jumping to the next subtraction if there's a mismatch, or to the else block
if it goes negative.  I'm not sure what it does for strings though.

 Gareth aka. Kit

 On Mon 13/08/18 16:20 , Marco Borsari via fpc-devel
fpc-devel at lists.freepascal.org sent:
 Hello, 
 I would need a clarification about the way the case statement is 
 translated into assembler by FPC. When the list of alternatives is 
 continous, does the compiler generate a jump table? And if yes, there is 
 some conditions for which a fall-through is performed anyway? 
 Thank you, Marco Borsari 
 _______________________________________________ 
 fpc-devel maillist - fpc-devel at lists.freepascal.org [1] 
 http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
[2]">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel 

 

Links:
------
[1] mailto:fpc-devel at lists.freepascal.org
[2] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20180813/97d52c96/attachment.html>


More information about the fpc-devel mailing list