Commit Graph

133 Commits

Author SHA1 Message Date
Jonas Maebe
da696057ab * converted register_maybe_adjust_setbase() to the high level code generator
git-svn-id: trunk@32591 -
2015-12-05 18:03:37 +00:00
Jonas Maebe
2ad8bc3b27 * fixed operation size of comparison with maximum legal value in
tcginnode.passs_generate_code

git-svn-id: trunk@32522 -
2015-11-24 20:10:42 +00:00
Jonas Maebe
c8a5994e2e * fixed size used for left in in_smallset (it's been forced in a register
of size opdef a few lines before)

git-svn-id: trunk@32410 -
2015-11-21 12:36:58 +00:00
Jonas Maebe
09c8c5eba0 * adjusted comment after previous commit
git-svn-id: trunk@32297 -
2015-11-12 20:58:50 +00:00
Jonas Maebe
a32605bd38 * don't force setelementn's into a 32 bit modifiable register if they were
already in a register, as this changes the result location into a size
    different from what resultdef says (and only in that specific case)
   o modified the ppc code so that it always forces a setelementn to uinttype,
     as that is the size that is expected by the operations later on

git-svn-id: trunk@32296 -
2015-11-12 20:55:33 +00:00
Jonas Maebe
175f4376bc * give an internalerror if a setelementn is range in pass_generate_code,
as those constructs should have been converted to calls to
    fpc_varset_set_range by the parent addn

git-svn-id: trunk@32293 -
2015-11-11 20:46:49 +00:00
yury
b26fa07f1a * Fixed notes "var is assigned but not used".
git-svn-id: trunk@31734 -
2015-09-17 13:03:04 +00:00
Jonas Maebe
0fc1fd6ac1 * replaced current_procinfo.currtrue/falselabel with storing the true/false
labels of LOC_JUMP in the node's location. This generates some extra jumps
    for short circuit boolean and/or-expressions if optimizations are off, but
    with optimisations enabled the generated code is the same (except for JVM
    because the jump threading optimisation isn't enabled there yet).

git-svn-id: trunk@31431 -
2015-08-27 18:28:57 +00:00
Jonas Maebe
b9d4d9b141 * corrected type passed to a_bit_test_reg_loc_reg() (we force left into
a register of size opdef before)

git-svn-id: trunk@31056 -
2015-06-13 22:48:26 +00:00
florian
fa6bea9bbb * all the cg/hlcg routines take normally tcgint constants, so replace aint constants and casts in ncgset by tcgint ones
git-svn-id: trunk@30560 -
2015-04-12 20:32:37 +00:00
Jonas Maebe
2112713579 * converted the remaining parts of tcginnode.pass_generate_code() to thlcg
git-svn-id: trunk@30370 -
2015-03-29 18:16:51 +00:00
Jonas Maebe
67b8aceaee * synchronized with privatetrunk till r30095
git-svn-id: branches/hlcgllvm@30101 -
2015-03-05 20:32:15 +00:00
Jonas Maebe
33b1732ca2 * avoid unnecessary sign/zero-extensions in genlinearlist() when generating
code on a platform that doesn't have subregisters of the same size as
    the "case" value

git-svn-id: trunk@30031 -
2015-02-28 16:46:54 +00:00
Jonas Maebe
c6ddf0001c * simplified in_smallset() and removed some old cruft (there's no need
anymore to change the register size)

git-svn-id: branches/hlcgllvm@28400 -
2014-08-12 23:17:45 +00:00
nickysn
1d4de72aa7 + 8-bit ALU support in tcgcasenode.genlinearcmplist
git-svn-id: trunk@27660 -
2014-04-26 12:41:58 +00:00
Jonas Maebe
212f4d1152 * pass the size of the set rather than of the constant to
a_bit_test_const_loc_reg() (bug in hlcgobj conversion)

git-svn-id: trunk@27606 -
2014-04-20 14:34:57 +00:00
florian
4d5119bf1c * fixes several issues which cause warnings by the dfa code when using it to detect uninitialized variables
git-svn-id: trunk@26161 -
2013-12-01 17:02:08 +00:00
nickysn
29c7d38e43 * 16-bit ALU fixes in tcgcasenode.genlinearcmplist
git-svn-id: branches/i8086@23989 -
2013-03-24 22:40:27 +00:00
florian
c1bca748ee * factored out tcginnode.in_smallset
* indention changed to common compiler style

git-svn-id: trunk@22063 -
2012-08-11 22:07:36 +00:00
Jonas Maebe
edd42aa42a * moved subsetref/reg and bit_set/test support from cgobj to hlcgobj for
future use by high level code generator targets
   o this in turn required that all a_load*_loc* methods are called via
     hlcg rather than via cg, since a location can be a subsetref/reg and
     and those are no longer handled in tcg
   o that then required moving several force_location_* routines into
     thlcg because they use a_load_loc*, but did not take tdef size
     parameters (which are required by the thlcg a_load_loc* routines)
   o the only practical consequence is that from now on, you have to
     use hlcg.location_force_mem/reg() (fpureg not yet) and
     hlcg.gen_load_loc_cgpara() instead of the removed versions from ncgutil,
     and hlcg.a_load*loc*() instead of cg.a_load*loc* if a subsetref/reg
     might be involved

git-svn-id: trunk@21287 -
2012-05-13 12:33:10 +00:00
Jonas Maebe
084c76119b * use unsigned type for unsigned comparison
git-svn-id: branches/jvmbackend@18738 -
2011-08-20 08:30:26 +00:00
Jonas Maebe
37aa2d8443 + full support for sets on the JVM target
o sets of enums are handled as JUEnumSet instances, others as JUBitSet
     derivatives (both smallsets and varsets, to make interoperability with
     Java easier)
   o special handling of set constants: these have to be constructed at run
     time. In case of constants in the code, create an internal constsym to
     represent them. These and regular constsyms are then aliased by an
     another internal staticvarsym that is used to initialise them in the
     unit initialisation code.
   o until they are constructed at run time, set constants are encoded as
     constant Java strings (with the characters containing the set bits)
   o hlcgobj conversion of tcginnode.pass_generate_code() for the genjumps
     part (that's the only part of the generic code that's used by the JVM
     target)
   o as far as explicit typecasting support is concerned, currently the
     following ones are supported (both from/to setdefs): ordinal types,
     enums, any other set types (whose size is the same on native targets)
   o enum setdefs also emit signatures
   o overloading routines for different ordinal set types, or for different
     enum set types, is not supported on the JVM target

git-svn-id: branches/jvmbackend@18662 -
2011-08-20 08:22:22 +00:00
Jonas Maebe
d1a1d30e04 * unless compiled with -dnounsupported, the compiler will now accept not
only JVM constructs that are already implemented, but also ones that
    will be supported in the future but that aren't implemented yet (to
    make it easier to already adapt code to the future changes)

git-svn-id: branches/jvmbackend@18498 -
2011-08-20 08:04:51 +00:00
Jonas Maebe
b023627f6a * converted tcgcasenode.pass_generate_code() to hlcgobj
o changed type of opsize field of tcgcasenode from tcgsize into tdef,
     and fixed compilation of other code generator units after this change

git-svn-id: branches/jvmbackend@18339 -
2011-08-20 07:48:33 +00:00
Jonas Maebe
749e791768 * fixed in-code for big endian systems and smallsets < 4 bytes
(fixes tbs/tb0219 on big endian systems after r14177)

git-svn-id: trunk@14206 -
2009-11-17 22:05:12 +00:00
yury
cf7390ea81 * Fixed 'mixed signed/unsigned' and pointer conversion warnings.
git-svn-id: trunk@11439 -
2008-07-23 09:36:07 +00:00
peter
8f239d04b6 * cleanup and simplify the set type handling
git-svn-id: trunk@10432 -
2008-03-02 17:48:27 +00:00
Jonas Maebe
f36e5411af * split cpu64bit compiler define into
a) cpu64bitaddr, which means that we are generating a compiler which
       will generate code for targets with a 64 bit address space/abi
    b) cpu64bitalu, which means that we are generating a compiler which
       will generate code for a cpu with support for 64 bit integer
       operations (possibly running in a 32 bit address space, depending
       on the cpu64bitaddr define)
   All cpus which had cpu64bit set now have both the above defines set,
   and none of the 32 bit cpus have cpu64bitalu set (and none will
   compile with it currently)
  + pint and puint types, similar to aint/aword (not pword because that
    that conflicts with pword=^word)
  * several changes from aint/aword to pint/pword
  * some changes of tcgsize2size[OS_INT] to sizeof(pint)

git-svn-id: trunk@10320 -
2008-02-13 20:44:00 +00:00
Jonas Maebe
03e9f652fd * fixed range error in case node distance calculation
git-svn-id: trunk@9662 -
2008-01-06 23:18:12 +00:00
peter
6058b2c247 * renamed t_times to executionweight and moved it to
code generation pass
  * include executionweight in the spilling decision

git-svn-id: trunk@9330 -
2007-11-25 16:38:05 +00:00
florian
c3475dddc0 * handle case ranges properly for unsigned types with a non-zero base, resolves #10009
git-svn-id: trunk@8974 -
2007-10-28 17:06:02 +00:00
peter
eb7aedc285 * fixed overflow
git-svn-id: trunk@8577 -
2007-09-20 20:23:26 +00:00
peter
582fa79494 * don't overwrite cai_align with tai_align_abstract
* check that tai_align is used and not tai_align_abstract

git-svn-id: trunk@8563 -
2007-09-19 15:41:47 +00:00
Jonas Maebe
89ed91509a * Some fixes for r8515:
* fixed set add-nodes in case left and right are swapped (taddset4)
   * fixed "in" expressions with packed sets in case left is < setbase
     (now tested by tw8258b, which was missing a {$packset 1} directive)

git-svn-id: trunk@8519 -
2007-09-16 22:24:42 +00:00
Jonas Maebe
0040eecf9f + support for extra packing of sets whose lower element number
is <> 0 (Delphi compatible now, + various tests)
  + support for enums and sets in is_in_limit()
  * fixed converting smallset expressions to varsets
  * improved choosing an appropriate common set type when mixing
    set types in an expression
  - removed no longer used normalset code from nadd.pas
  - disabled large set (>256 elements) support for now, because
    they are not yet supported entirely throughout the compiler
    and this causes errors at run time in several situations

git-svn-id: trunk@8515 -
2007-09-16 20:04:45 +00:00
Jonas Maebe
1c71bb36a1 * also check for valid min/maxlabel range for jumptable in case
of cs_opt_size

git-svn-id: trunk@8281 -
2007-08-14 13:58:56 +00:00
Jonas Maebe
e23a8655e8 * fixed generic in-code in case left = LOC_JUMP
* fixed generic and x86 in-code in case genjumps=true and
    complexity(right)>complexity(left) (not sure if possible
    in practice currently, but better safe than sorry)

git-svn-id: trunk@7912 -
2007-07-01 19:35:22 +00:00
daniel
9adb202a92 * Rework the constexprint to allow operations from low(int64) to high(qword).
+ Some initial work on a formaldef which also carries the typinfo of a parameter.

git-svn-id: trunk@7639 -
2007-06-13 07:41:18 +00:00
Jonas Maebe
a0b57eddb5 * new internal set format for big endian systems. Advantages:
* varsets ({$packset x}) are now supported on big endian targets
    * gdb now displays sets properly on big endian systems
    * cleanup of generic set code (in, include/exclude, helpers), all
      based on "bitpacked array[] of 0..1" now
  * there are no helpers available yet to convert sets from the old to
    the new format, because the set format will change again slightly
    in the near future (so that e.g. a set of 24..31 will be stored in
    1 byte), and creating two classes of set conversion helpers would
    confuse things (i.e., it's not recommended to use trunk currently for
    programs  which load sets stored to disk by big endian programs compiled
    by previous FPC versions)
  * cross-endian compiling has been tested and still works, but one case
    is not supported: compiling a compiler for a different endianess
    using a starting compiler from before the current revision (so first
    cycle natively, and then use the newly created compiler to create a
    cross-compiler)

git-svn-id: trunk@7395 -
2007-05-19 17:15:15 +00:00
florian
c5d56702ff * properly align case target labels
git-svn-id: trunk@6395 -
2007-02-10 18:42:25 +00:00
tom_at_work
dc21781f1d * fix compilation for 64 bit platforms,
as suggested by Jonas

git-svn-id: trunk@6372 -
2007-02-07 23:05:19 +00:00
Jonas Maebe
f38d29cfab * optimized previous patch for "byte in set" (Thorsten Engler)
* fixed storing/loading of setdefs to/from ppu + test (Thorsten Engler)
  * fixed ppudump for new setdef format in ppus

git-svn-id: trunk@6363 -
2007-02-07 20:22:29 +00:00
Jonas Maebe
fc3852e59a * in non-TP modes, 'ord_larger_than_256 in set' now always returns
false instead of triggering a range error (mantis #8258,
    based on patch provided by Thorsten Engler)

git-svn-id: trunk@6357 -
2007-02-07 18:57:19 +00:00
Jonas Maebe
1d96dcc50d * renamed nf_swaped to nf_swapped
git-svn-id: trunk@5818 -
2007-01-05 12:47:22 +00:00
peter
658c46b903 * remove tdictionary and tindexarray
* symtables based on TFPHashObjectList and TFPObjectList
  * rename torddef.typ to torddef.ordtype
  * rename tfloatdef.typ to tfloatdef.floattype
  * rename tdef.deftype to tdef.typ
  * remove obsolete browser code, browcol is kept so the ide
    can still be compiled

git-svn-id: trunk@5192 -
2006-11-03 00:30:30 +00:00
florian
ef7bd58c54 * germanism removed (aktfilepos -> current_filepos)
git-svn-id: trunk@5099 -
2006-10-30 22:37:31 +00:00
florian
85d63d9fa9 * settings refactored
git-svn-id: trunk@5094 -
2006-10-30 18:02:58 +00:00
peter
3078a1927f * remove ttype
* rename old ttype variables *type to *def
  * rename resulttypepass to pass_typecheck
  * rename pass_2 to pass_generate_code

git-svn-id: trunk@5077 -
2006-10-29 22:19:39 +00:00
Jonas Maebe
e531c4f125 + very limited SSA support (only outside control flow
constructs for now)

git-svn-id: trunk@3671 -
2006-05-25 11:45:08 +00:00
Jonas Maebe
5afd8c5e76 * fixed LOC_JUMP handling for case nodes
git-svn-id: trunk@3421 -
2006-05-05 09:01:55 +00:00