Commit Graph

497 Commits

Author SHA1 Message Date
Yuriy Sydorov
07dcd22b1c * sizeof(array) and length(array) must return sizeUint in case the array
size does not fit in sizeint. This fixes a range check error during
  compilation on small CPU targets where allowed array size is 64K, but
  sizeint is 32K max.
2021-08-16 21:54:46 +03:00
svenbarth
ca7c775e36 * fix for Mantis #38642: for enumerations with jumps Delphi behaves as follows:
- GetTypeKind returns tkEnumeration (FPC previously generated a compile error here)
  - GetTypeInfo on a generic parameters returns Nil for such types (FPC previously generated a compile error here)
  - GetTypeInfo otherwise generates a compile error (as before)

git-svn-id: trunk@49064 -
2021-03-27 09:35:07 +00:00
Jonas Maebe
3e047d3691 * generate more efficient code for trunc(currency), trunc(comp), and
round(comp) on platforms where currency and comp are handled using the FPU
   o also fixes trunc(comp) and trunc(currency) compilation for x86 on LLVM
     with -Oofastmath
 * add missing removal of excess fpu precision typecasts for trunc/round

git-svn-id: trunk@47854 -
2020-12-27 13:18:47 +00:00
florian
6e4997265c + min/max intrinsics for internal use by the compiler
git-svn-id: trunk@47692 -
2020-12-05 22:00:58 +00:00
florian
28d248c9d4 * cleanup merge overlefts
git-svn-id: trunk@47691 -
2020-12-05 22:00:57 +00:00
florian
bcdfd07bdd * if a variant is read/written, include the variants unit
git-svn-id: trunk@47459 -
2020-11-19 20:53:47 +00:00
florian
637976e83f * patch by Marģers to unify internal error numbers, resolves #37888
git-svn-id: trunk@47103 -
2020-10-13 19:59:01 +00:00
svenbarth
cce2dad1bf * fix for Mantis #37806: allow undefineddefs for Include() and Exclude()
+ added tests

git-svn-id: trunk@46953 -
2020-09-25 14:13:53 +00:00
svenbarth
ff4e1345ff * fix for Mantis #37779: use init RTTI instead of full RTTI when copying an array
+ added test

git-svn-id: trunk@46915 -
2020-09-21 20:17:55 +00:00
svenbarth
d3e18ccb5e * fix for Mantis #37221: apply adjusted patch by Ondrej Pokorny to allow the use of Copy() on open array parameters (the result will be a dynamic array)
+ added test

git-svn-id: trunk@46890 -
2020-09-18 15:00:10 +00:00
florian
60bd9c5ba0 * write a proper error message if types are read/written which are not supported in iso mode, resolves #37763
git-svn-id: trunk@46885 -
2020-09-17 19:58:55 +00:00
svenbarth
8770af84bd * fix for Mantis #37187: inside generics the constant code in pexpr does not handle all cases and thus current_procinfo needs to be checked as well
+ added test

git-svn-id: trunk@46218 -
2020-08-03 21:53:14 +00:00
florian
f542ee7b92 * do not throw an internal error if an errorneous type is passed to str, resolves #37462
git-svn-id: trunk@45983 -
2020-08-01 21:11:35 +00:00
florian
18877dc96e * check if current_procinfo is assigned when creating a default sym to avoid a crash, resolves #37303
git-svn-id: trunk@45772 -
2020-07-11 20:30:33 +00:00
svenbarth
d401639b24 * fix for Mantis #37251: apply patches by Bi0T1N to implement the IsConstValue() intrinsic
+ added tests

git-svn-id: trunk@45695 -
2020-06-25 20:42:47 +00:00
florian
d2d2904d78 * make more use of is_typeparam
git-svn-id: trunk@45458 -
2020-05-21 18:40:59 +00:00
svenbarth
3d2945726a * handle generic parameters in Ord()
+ added test

git-svn-id: trunk@45232 -
2020-05-03 15:08:31 +00:00
nickysn
b4ff7388df + retinparam fixes for exp, frac, int, cos, sin, arctan, ln, round and trunc
git-svn-id: branches/z80@45016 -
2020-04-23 00:25:02 +00:00
nickysn
661db99581 + ret in param fix in pass_typecheck for exp,frac,int,cos,sin,arctan,ln
git-svn-id: branches/z80@45015 -
2020-04-23 00:14:13 +00:00
nickysn
5200ff5e49 + ret in param fix for tinlinenode.first_sqrt_real
git-svn-id: branches/z80@45014 -
2020-04-23 00:11:17 +00:00
nickysn
0b19d4235f + ret in param fix for tinlinenode.first_sqr_real
git-svn-id: branches/z80@45013 -
2020-04-23 00:08:23 +00:00
nickysn
a1ccab5e23 + handle properly ret in param in tinlinenode.first_abs_real
git-svn-id: branches/z80@45012 -
2020-04-23 00:06:03 +00:00
nickysn
0e605eb30e * fix for the handling of abs(real), sqr(real) and sqrt(real) when the result is returned in param
git-svn-id: branches/z80@45011 -
2020-04-22 23:42:32 +00:00
Jeppe Johansen
c20b27ede9 Add most SSE instructions as intrinsics.
git-svn-id: trunk@44274 -
2020-03-06 21:34:22 +00:00
florian
3947922fea * set nf_* correctly when an inc/dec node is converted into an add/sub node
* do not firstpass during dead store removal as it disturbes the for each calls

git-svn-id: trunk@44180 -
2020-02-15 13:53:16 +00:00
Jonas Maebe
b625afe800 * never inline routines that call get_frame (otherwise get_frame would return
the frame of the caller rather than of the current routine, which could
    cause e.g. stackframes to be missed in RTL helpers that are known to be
    only called from run time error routines)

git-svn-id: trunk@44064 -
2020-01-29 22:21:14 +00:00
florian
70a836c4a2 * first part of merging parts of Jeppe's intrinsics patch, mainly r31135
is merged by this commit with a lot of adaptions

git-svn-id: trunk@43949 -
2020-01-14 21:52:39 +00:00
florian
f7a052f884 + inline high(<dyn. array>), resolves #28536
git-svn-id: trunk@43808 -
2019-12-28 21:38:38 +00:00
Jonas Maebe
d23c7980aa * properly perform (or not) range/overflow checking when performing constant
propagation into inlined routines, regardless of the range/overflow
    checking state at the caller site

git-svn-id: trunk@43436 -
2019-11-10 12:00:05 +00:00
svenbarth
b0ac0ddcc9 + add support for the IsManagedType() intrinsics which reports for a type (or variable) whether it needs initialization/finalization
+ added tests

git-svn-id: trunk@43409 -
2019-11-06 23:04:52 +00:00
Jonas Maebe
a051b8d225 - remmoved doregister parameter from t*sym constructors, as the registration
is handled automatically nowadays

git-svn-id: trunk@42998 -
2019-09-14 17:30:45 +00:00
Jonas Maebe
14a7429e19 * factored out inlinenode check whether it may have a side effect
o also added register assert as having a side-effect (if asserts are
     enabled)

git-svn-id: trunk@42728 -
2019-08-18 15:55:03 +00:00
Jeppe Johansen
7dc515b62c - Fix result type of SizeOf and BitSizeOf to use sizesint instead of sint.
git-svn-id: trunk@42337 -
2019-07-07 14:37:45 +00:00
Jonas Maebe
0a91fcb44f * LLVM-specific support for bsr*/bsf*
git-svn-id: trunk@42309 -
2019-06-29 16:27:18 +00:00
Jonas Maebe
c038e4c3f2 * relaxation of r42272: again only show warnings rather than errors for
out-of-range constants, because of the comments mentioned in #35753
    (except for enums, as apparently Delphi does the same)
  * added range check warnings about explicit type casts that throw away
    bits (e.g. byte($fff)), without giving warnings for most common cases
    (like cardinal(-1))
  * fixed masking/sign exting constant array indices (must be based on index
    range type size/signedness rather than on array size/"signedness")

git-svn-id: trunk@42275 -
2019-06-23 14:12:33 +00:00
pierre
243c967967 Commit of new debug feature implemented by J. Gareth Moreton
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 -
2019-06-22 14:08:47 +00:00
Jonas Maebe
1b6425176b * synchronised with trunk till r42049
git-svn-id: branches/debug_eh@42050 -
2019-05-12 18:44:05 +00:00
Jonas Maebe
281b3ad276 * fix case completeness and unreachable code warnings in compiler that would
be introduced by the next commit

git-svn-id: trunk@42046 -
2019-05-12 14:29:03 +00:00
Jonas Maebe
a0d796e98d * synchronised with trunk till r41159
git-svn-id: branches/debug_eh@41160 -
2019-02-01 17:01:54 +00:00
Jonas Maebe
04d295f186 * first step towards supporting 32 bit targets with the LLVM code generator:
use the generic code in more cases when cpuhighleveltarget is defined

git-svn-id: trunk@41133 -
2019-01-29 21:39:09 +00:00
Jonas Maebe
473fef315d * synchronised with trunk till r40732
git-svn-id: branches/debug_eh@40733 -
2019-01-01 16:24:18 +00:00
Jonas Maebe
ff8ccb06e5 * changed reverseparameters() from function into procedure: it does not make
sense as a function (the original input needed to be replaced by its
    result to make any sense), and someone already mistakenly used it like that
    in htypechk causing a bug/memory leak

git-svn-id: trunk@40729 -
2019-01-01 15:08:40 +00:00
Jonas Maebe
882d676bc9 * synchronised with trunk till r40635
git-svn-id: branches/debug_eh@40636 -
2018-12-24 22:12:19 +00:00
Jonas Maebe
3ccc3e329b * prevent calling firstpass multiple times for a node (such as when
transforming inc/dec to an addn/subn in case of range checking) from
    triggering the transformation logic for accessing nested variables
    on LLVM/JVM multiple times
  * also prevent it from triggering errors during inlining, in case a
    parameter to a nested routine gets replaced by a local variable
    from a parent routine (in that case, it does not need to be
    accessed via the parentfpstruct, as we are being inlined in the
    parent) -> don't duplicate the check from pass_typecheck in pass_1,
    but check whether it needs to be accessed via the parentfpstruct
    by verifying that tloadnode.left is assigned (which pass_typecheck
    will ensure if needed)

git-svn-id: trunk@40630 -
2018-12-24 22:09:52 +00:00
Jonas Maebe
9630eb7ce9 * synchronised with trunk till r40466
git-svn-id: branches/debug_eh@40467 -
2018-12-04 19:54:31 +00:00
Jonas Maebe
122d0d36d6 + volatile() expression that marks an expression as volatile
* disable matching volatile references in the assembler optimisers, so they
    can't be removed (more conservative than needed, but better than removing
    too many)
   o the CSE optimiser will ignore them by default, because they're an unknown
     inline node for it
  * also removed no longer used fpc_in_move_x and fpc_in_fillchar_x inline node
    identifiers from rtl/inc/innr.inc, and placed fpc_in_unaligned_x at the
    right place

git-svn-id: trunk@40465 -
2018-12-04 19:53:20 +00:00
Jonas Maebe
bfc7c58a69 * synchronised with trunk till r40348
git-svn-id: branches/debug_eh@40349 -
2018-11-18 12:01:50 +00:00
pierre
796db4cef5 Implement mark_write override for tinilinenode
git-svn-id: trunk@40277 -
2018-11-08 20:18:30 +00:00
yury
4682ac269d * Further improvement for r40180:
An uninitialized function Result of a managed type needs special handling.
    When passing it as a var parameter a warning need to be emitted, since a user
    may expect Result to be empty (nil) by default as it happens with local vars
    of a managed type. But this is not true for Result and may lead to serious issues.

    The only exception is SetLength(Result, ?) for a string Result. A user always
    expects undefined contents of the string after calling SetLength(). In such
    case a hint need to be emitted.
+ Tests for this.

git-svn-id: trunk@40216 -
2018-11-04 15:37:52 +00:00
yury
4357caaad8 * Removed unused local vars.
git-svn-id: trunk@40183 -
2018-11-02 18:44:29 +00:00