* give a compile-time error in ISO/Extended Pascal if the compiler can prove
the case selector value is not handled, and a warning in other modes
(mantis #35915)
o trigger the case node simplification at the end of the case node typecheck
pass, like for other nodes
git-svn-id: trunk@42574 -
Allows compilation of compiler using -dDEBUG_NODE_XML
which will generate a NAME-node-dump.xml file for each
unit, program or library compiled,
containing a XML description of the nodes handled during
compilation of the unit, program or library.
git-svn-id: trunk@42271 -
(based on patch by Martok)
o enabled by default in ISO and Extended Pascal: compile-time error if not
the case in ISO mode, warning and run-time error in Extended Pascal mode
o warning enabled by default in all other modes for boolean, enumeration and
subrange integer types with ranges different from the default ones
(i.e., different from 0..255, -128..127, 0..65536, etc)
o warnings for all ordinal types can be enabled in all modes with
-CC
git-svn-id: trunk@42047 -
This patch improves the compiler where "case" statements are concerned, using jump tables more often and creating more efficient machine code in some situations:
* If a case block only contains one branch (not including the else block), the initial range check is removed, since this becomes wasted effort.
* If the else block is empty, the else label is set to the end label - though this doesn't decrease the code size, it takes a bit of strain off the peephole optimizer.
* On -O2 and above, some node analysis is now done on the branch labels. Most of the time this just redirects it to the end
label for empty blocks, but if the block contains a goto statement, it will redirect it to its destination instead,
thus increasing performance by not having multiple jumps (this won't get picked up by the peephole optimiser if the label addresses are in a jump table).
* Some checks now use what I call the 'true count' rather than the 'label count'. The true count includes each
individual value in a range - for example, 0..2 counts as 3. This increases the chance that a jump table will be
utilised in situations where it is more efficient than a linear list.
* For jump tables, if the case block almost covers the entire range (32 entries or fewer from full coverage),
the initial range check is removed and the gaps included in the jump table (pointing to the else label).
git-svn-id: trunk@40676 -
o made all (non-abstract) tdef and tsym constructors virtual
o added c*def/c*sym classref types for every (non-abstract) t*def/t*sym
class
o added cpusym unit for every architecture that derives a tcpu*def/tcpu*sym
class from the base classes, and initialises the c*def/c*sym classes with
them. This is done so that the llvm target will be able to derive from
the tcpu*def/sym classes without umpteen ifdefs, and it also means that
the WPO can devirtualise everything because the c* variables are only
initialised with one class type
o replaced all t*def/t*sym constructor calls with c*def/c*sym constructor
calls
git-svn-id: trunk@27361 -
nset.pas, tcasenode.simplify: don't assume a specific order of the case labels
+ added test based on ppu.pas, tppu.getaint where no matching case label was found because of the ordering
git-svn-id: trunk@26825 -
+ nset.pas, tcasenode: add simplify method; for ordinal constant case expressions either return a copy of the correct block or return a nothing node if the constant did not match anything
+ added test to check that nothing is broken
git-svn-id: trunk@26824 -
- extend tok2node array to store inline function number for the case when nodetype = inlinen, add Inc, Dec operators to array
- implement inline function support in isunaryoverloaded
- check for operator overload if Inc, Dec is not used for standard types
- extend test to check Inc,Dec operators
git-svn-id: trunk@16629 -
from the unit initialisation sections to the variable declaration sections
to prevent the base units from overriding derived classes (based on patch
by Hans-Peter Dietrich, mantis #17516)
git-svn-id: trunk@16118 -
that was set during the typecheck pass because typeconversion nodes
may have been optimised away previously and sometimes the resultdef is
important (e.g. for the value of callparanodes) (mantis #17458)
git-svn-id: trunk@16101 -
- add own symbol table for enumeration to store enumeration elements
- reimplement enumeration member traverse using symbol table instead of firstenum/nextenum - that members are removed
- implement TEnum.Element access syntax - element is searched in the enumeration symtable in this case instead of global/local symtables
- implement {$SCOPEDENUM ON/OFF} local switch
+ tests
git-svn-id: trunk@15051 -