Commit Graph

151 Commits

Author SHA1 Message Date
Jonas Maebe
b7b9c5d94c * fix false possitive tconstexprint range errors after r41441 (mantis #35144)
git-svn-id: trunk@41469 -
(cherry picked from commit eb71a30933)
2021-08-27 10:02:15 +02:00
Jonas Maebe
197f5cbec5 * let all the case code generation work with tconstexprint instead of aint,
so it also works for 32 bit targets and a high level code generator
    (where aint is still 32 bit, but 64 bit operations are not decomposed)

git-svn-id: trunk@41441 -
(cherry picked from commit 07bd4ba517)

With local change to fix compilation for x86_64 CPU
2021-08-26 23:28:28 +02:00
pierre
92cd9502ef Merge of revisions 40277
40307
40309
40314
40319
40322
40324
40326
40377
40378 from trunk to fixes_3_2
------------------------------------------------------------------------
r40277 | pierre | 2018-11-08 20:18:30 +0000 (Thu, 08 Nov 2018) | 1 line

 Implement mark_write override for tinilinenode
------------------------------------------------------------------------
--- Merging r40277 into '.':
U    compiler/ninl.pas
--- Recording mergeinfo for merge of r40277 into '.':
 U   .
------------------------------------------------------------------------
r40307 | pierre | 2018-11-13 15:10:21 +0000 (Tue, 13 Nov 2018) | 6 lines

  + Introduce PPC_SUFFIXES, new make variable that lists all ppc suffixes
    for all different CPUs supported.
  * Use PPC_SUFFIXES in execlean and CPU_clean targets.
  * Also delete CPU/bin subbirectory.


------------------------------------------------------------------------
--- Merging r40307 into '.':
U    compiler/Makefile
U    compiler/Makefile.fpc
--- Recording mergeinfo for merge of r40307 into '.':
 G   .
------------------------------------------------------------------------
r40309 | pierre | 2018-11-13 15:51:32 +0000 (Tue, 13 Nov 2018) | 1 line

 Try to avoid expectloc not set after first pass error for call node
------------------------------------------------------------------------
--- Merging r40309 into '.':
U    compiler/ncal.pas
--- Recording mergeinfo for merge of r40309 into '.':
 G   .
------------------------------------------------------------------------
r40314 | pierre | 2018-11-14 13:13:19 +0000 (Wed, 14 Nov 2018) | 4 lines

  * Change first parameter type of function is_continuous_maks to aword type.
    Add typecasts where needed to allow for successful compilation of arm-linux target
    with -CriotR options when building the compiler.

------------------------------------------------------------------------
--- Merging r40314 into '.':
U    compiler/arm/cpubase.pas
U    compiler/arm/cgcpu.pas
--- Recording mergeinfo for merge of r40314 into '.':
 G   .
------------------------------------------------------------------------
r40319 | pierre | 2018-11-15 16:58:40 +0000 (Thu, 15 Nov 2018) | 1 line

 Disable range check in m68k:tiscv32 and riscv64 cgcpu units
------------------------------------------------------------------------
--- Merging r40319 into '.':
   C compiler/riscv64
U    compiler/m68k/cgcpu.pas
   C compiler/riscv32
--- Recording mergeinfo for merge of r40319 into '.':
 G   .
Summary of conflicts:
  Tree conflicts: 2
------------------------------------------------------------------------
r40322 | pierre | 2018-11-15 22:01:25 +0000 (Thu, 15 Nov 2018) | 1 line

 Also disable range checking in arm/aoptcpu unit
------------------------------------------------------------------------
--- Merging r40322 into '.':
U    compiler/arm/aoptcpu.pas
--- Recording mergeinfo for merge of r40322 into '.':
 G   .
------------------------------------------------------------------------
r40324 | pierre | 2018-11-16 10:27:42 +0000 (Fri, 16 Nov 2018) | 4 lines

  * Disable range check for m68k/aoptcpu unit
  * Add missing change of var parameter p to next instruction
    in TryToOptimizeMove method after instruction removal.

------------------------------------------------------------------------
--- Merging r40324 into '.':
U    compiler/m68k/aoptcpu.pas
--- Recording mergeinfo for merge of r40324 into '.':
 G   .
------------------------------------------------------------------------
r40326 | pierre | 2018-11-16 13:28:26 +0000 (Fri, 16 Nov 2018) | 1 line

 Change local variables offsetdec and extraoffset type to ASizeInt
------------------------------------------------------------------------
--- Merging r40326 into '.':
U    compiler/ncgmem.pas
--- Recording mergeinfo for merge of r40326 into '.':
 G   .
------------------------------------------------------------------------
r40377 | pierre | 2018-11-27 10:19:36 +0000 (Tue, 27 Nov 2018) | 1 line

 Fix bug report 34605 and add corresponding test
------------------------------------------------------------------------
--- Merging r40377 into '.':
A    tests/webtbs/tw34605.pp
U    compiler/nutils.pas
--- Recording mergeinfo for merge of r40377 into '.':
 G   .
------------------------------------------------------------------------
r40378 | pierre | 2018-11-27 10:21:37 +0000 (Tue, 27 Nov 2018) | 1 line

 Avoid range errors or overflows on for AVR cpu, when computing address offsets
------------------------------------------------------------------------
--- Merging r40378 into '.':
U    compiler/ncgset.pas
U    compiler/ngtcon.pas
--- Recording mergeinfo for merge of r40378 into '.':
 G   .

git-svn-id: branches/fixes_3_2@40716 -
2018-12-31 15:48:08 +00:00
florian
68eb921d46 * broken compilation after r39347 fixed
git-svn-id: trunk@39349 -
2018-06-30 12:30:25 +00:00
florian
f08d3fdf8f * moved execution weight calculation into a separate pass, so the info is available already available before the code generation pass if needed
git-svn-id: trunk@38717 -
2018-04-08 20:51:27 +00:00
florian
29230ebdca + added comment why the code path is not yet enabled for 16 bit
git-svn-id: trunk@38281 -
2018-02-18 09:32:54 +00:00
florian
f37bad774c * do not use 32 bit operations on 8 bit cpu in tcginnode.pass_generate_code if not needed, resolves #32071
git-svn-id: trunk@38271 -
2018-02-17 18:38:03 +00:00
florian
cc44328109 * correctly calc case label distance after r36362, resolves #32115 and #32311
git-svn-id: trunk@37390 -
2017-10-03 20:36:09 +00:00
nickysn
ddba821561 * GetNextReg(), used by 16-bit and 8-bit code generators (i8086 and avr) moved
from cpubase unit to a method in the tcg class. The reason for doing that is
  that this is now a standard part of the 16-bit and 8-bit code generators and
  moving to the tcg class allows doing extra checks (not done yet, but for
  example, in the future, we can keep track of whether there was an extra
  register allocated with getintregister and halt with an internalerror in case
  GetNextReg() is called for registers, which weren't allocated as a part of a
  sequence, therefore catching a certain class of 8-bit and 16-bit code
  generator bugs at compile time, instead of generating wrong code).
- removed GetLastReg() from avr's cpubase unit, because it isn't used for
  anything. It might be added to the tcg class, in case it's ever needed, but
  for now I've left it out.
* GetOffsetReg() and GetOffsetReg64() were also moved to the tcg unit.

git-svn-id: trunk@37180 -
2017-09-11 14:53:06 +00:00
florian
991d962ae2 * more range check errors on 8 bit CPUs fixed
git-svn-id: trunk@36362 -
2017-05-28 08:59:55 +00:00
florian
b1dff29cbf * removed unused units
git-svn-id: trunk@36165 -
2017-05-09 19:53:14 +00:00
yury
95094e9a8f * Removed unused vars.
git-svn-id: trunk@36073 -
2017-05-04 10:38:49 +00:00
florian
50dba9ad66 * if both labels of a case label are equal, we still cannot skip the comparison in a jump tree, resolves #31589
git-svn-id: trunk@35880 -
2017-04-21 19:32:27 +00:00
florian
74423b88e0 * comment on border between linear list and jmp tree for case statements extended
git-svn-id: trunk@35661 -
2017-03-26 07:36:58 +00:00
svenbarth
abc4cf21d1 * fix compiling the 64-bit compiler with a 32-bit one
git-svn-id: trunk@35654 -
2017-03-24 15:47:36 +00:00
florian
1ae90bce53 * commented how the limit for a case jmp tree had been determined
git-svn-id: trunk@35647 -
2017-03-23 18:35:48 +00:00
florian
d5754cf47c * create jmp trees for really big case statements
git-svn-id: trunk@35645 -
2017-03-23 17:50:53 +00:00
Jonas Maebe
b156744b62 * left has been forced into a register of size uopdef a few statements
above, so pass uopdef rather than left.resultdef to a_bit_test_reg_loc_reg()
    (part of fixing tests/tbs/tb0219.pp for llvm)

git-svn-id: trunk@34122 -
2016-07-14 15:20:53 +00:00
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