Commit Graph

406 Commits

Author SHA1 Message Date
florian
4e5fb2c6a8 * might_have_sideeffects gets flags: if mhs_exceptions is passed, nodes which might cause an exception are considered as having a side effect
git-svn-id: branches/laksen/riscv_new@39483 -
(cherry picked from commit 32a58ba7d1)
2021-08-24 10:43:24 +02:00
pierre
06ef4e6ca8 Merge of commits 43634 and 43635 for currency problems
------------------------------------------------------------------------
r43634 | pierre | 2019-12-03 16:05:30 +0000 (Tue, 03 Dec 2019) | 1 line

 Use PInt64(@value_currency)^ construct to avoid internal error when starting from 3.0.4 ppcarm compiler
------------------------------------------------------------------------
--- Merging r43634 into '.':
U    compiler/nadd.pas
--- Recording mergeinfo for merge of r43634 into '.':
 U   .
------------------------------------------------------------------------
r43635 | florian | 2019-12-03 19:31:50 +0000 (Tue, 03 Dec 2019) | 1 line

  * more currency fixes, should resolve #36176
------------------------------------------------------------------------
--- Merging r43635 into '.':
G    compiler/nadd.pas
U    tests/test/tcurrency1.pp
--- Recording mergeinfo for merge of r43635 into '.':
 G   .

git-svn-id: branches/fixes_3_2@43661 -
2019-12-06 16:20:37 +00:00
pierre
3da4ccfb3e Merge r43631 to fixes branch
------------------------------------------------------------------------
--- Merging r43631 into '.':
U    compiler/nadd.pas
--- Recording mergeinfo for merge of r43631 into '.':
 U   .

git-svn-id: branches/fixes_3_2@43633 -
2019-12-02 23:20:40 +00:00
florian
aadd93847f -- Zusammenführen von r43620 in ».«:
U    compiler/nadd.pas
U    compiler/ncnv.pas
U    compiler/ncon.pas
U    compiler/node.pas
A    tests/test/tcurrency1.pp
A    tests/webtbs/tw33963.pp
A    tests/webtbs/tw36179.pp
-- Aufzeichnung der Informationen für Zusammenführung von r43620 in ».«:
 U   .

git-svn-id: branches/fixes_3_2@43621 -
2019-12-01 20:29:52 +00:00
Jonas Maebe
858bf743ef --- Merging r43347 into '.':
C    compiler/nmat.pas
--- Recording mergeinfo for merge of r43347 into '.':
 G   .
--- Merging r43436 into '.':
U    compiler/defutil.pas
U    compiler/nadd.pas
U    compiler/ncnv.pas
U    compiler/ncon.pas
U    compiler/ngtcon.pas
U    compiler/ninl.pas
G    compiler/nmat.pas
U    compiler/nutils.pas
U    compiler/pstatmnt.pas
--- Recording mergeinfo for merge of r43436 into '.':
 G   .
--- Merging r43438 into '.':
A    tests/test/tinlrange1.pp
A    tests/test/tinlrange2.pp
A    tests/test/tinlrange3.pp
--- Recording mergeinfo for merge of r43438 into '.':
 G   .
--- Merging r43451 into '.':
U    tests/test/tinlrange1.pp
--- Recording mergeinfo for merge of r43451 into '.':
 G   .
--- Merging r43497 into '.':
C    compiler/nmat.pas
A    tests/test/tinlrange4.pp
--- Recording mergeinfo for merge of r43497 into '.':
 G   .

git-svn-id: branches/fixes_3_2@43498 -
2019-11-16 15:18:43 +00:00
Jonas Maebe
3ac703506c * rest of the previous accidental partial commit
git-svn-id: branches/fixes_3_2@41250 -
2019-02-07 19:56:21 +00:00
pierre
1fafc17016 Merge of revisions 39731 39825 39849 39912 39913 39914 39924 39935 39999 40000 40001 40026 40115 40132 40163 from trunk to fixes_3_2
------------------------------------------------------------------------
r39731 | pierre | 2018-09-11 08:00:54 +0000 (Tue, 11 Sep 2018) | 1 line

 Disable overflow for UDIVX ans SDIVX 64-bit instructions
------------------------------------------------------------------------
--- Merging r39731 into '.':
U    compiler/sparcgen/ncpumat.pas
--- Recording mergeinfo for merge of r39731 into '.':
 G   .
------------------------------------------------------------------------
r39825 | pierre | 2018-09-27 06:59:07 +0000 (Thu, 27 Sep 2018) | 1 line

 Add rtl dependency and fix fpcdir value
------------------------------------------------------------------------
--- Merging r39825 into '.':
U    packages/ide/compiler/Makefile.fpc
--- Recording mergeinfo for merge of r39825 into '.':
 G   .
------------------------------------------------------------------------
r39849 | pierre | 2018-10-01 21:50:13 +0000 (Mon, 01 Oct 2018) | 1 line

 Use vfpv2 as default fpu for eabihf if cpu is below armv7
------------------------------------------------------------------------
--- Merging r39849 into '.':
U    compiler/options.pas
--- Recording mergeinfo for merge of r39849 into '.':
 G   .
------------------------------------------------------------------------
r39912 | pierre | 2018-10-11 20:38:39 +0000 (Thu, 11 Oct 2018) | 1 line

 Fix ppuload for string type for i8086, use getasizeint for all string defs but short string
------------------------------------------------------------------------
--- Recording mergeinfo for merge of r39912 into '.':
 G   .
------------------------------------------------------------------------
r39913 | pierre | 2018-10-11 21:02:25 +0000 (Thu, 11 Oct 2018) | 1 line

 fix position of ppuload_platform for trecorddef
------------------------------------------------------------------------
--- Recording mergeinfo for merge of r39913 into '.':
 G   .
------------------------------------------------------------------------
r39914 | pierre | 2018-10-12 06:05:50 +0000 (Fri, 12 Oct 2018) | 1 line

 Adapt ppudump to fix introduced in revision 39912
------------------------------------------------------------------------
--- Recording mergeinfo for merge of r39914 into '.':
 G   .
------------------------------------------------------------------------
r39924 | pierre | 2018-10-13 11:35:34 +0000 (Sat, 13 Oct 2018) | 1 line

 Downgrade some warnings to notes for EXTDEBUG
------------------------------------------------------------------------
--- Merging r39924 into '.':
U    compiler/pass_2.pas
U    compiler/tgobj.pas
--- Recording mergeinfo for merge of r39924 into '.':
 G   .
------------------------------------------------------------------------
r39935 | pierre | 2018-10-14 22:18:50 +0000 (Sun, 14 Oct 2018) | 1 line

 Add missing setting of expectloc for multiplications
------------------------------------------------------------------------
--- Merging r39935 into '.':
U    compiler/nadd.pas
--- Recording mergeinfo for merge of r39935 into '.':
 G   .
------------------------------------------------------------------------
r39999 | pierre | 2018-10-20 18:44:05 +0000 (Sat, 20 Oct 2018) | 1 line

 Avoid run time error if compiled with -CR option
------------------------------------------------------------------------
--- Merging r39999 into '.':
U    compiler/m68k/cpupara.pas
--- Recording mergeinfo for merge of r39999 into '.':
 G   .
------------------------------------------------------------------------
r40000 | pierre | 2018-10-20 18:49:53 +0000 (Sat, 20 Oct 2018) | 1 line

Avoid range check error when compiled with -CR
------------------------------------------------------------------------
--- Merging r40000 into '.':
U    compiler/m68k/cgcpu.pas
--- Recording mergeinfo for merge of r40000 into '.':
 G   .
------------------------------------------------------------------------
r40001 | pierre | 2018-10-20 22:19:08 +0000 (Sat, 20 Oct 2018) | 1 line

 Add explicit typecast to avoid range check error
------------------------------------------------------------------------
--- Recording mergeinfo for merge of r40001 into '.':
 G   .
------------------------------------------------------------------------
r40026 | pierre | 2018-10-24 21:37:22 +0000 (Wed, 24 Oct 2018) | 1 line

 Explicitly disable range checking
------------------------------------------------------------------------
--- Merging r40026 into '.':
U    compiler/x86/cgx86.pas
--- Recording mergeinfo for merge of r40026 into '.':
 G   .
------------------------------------------------------------------------
r40115 | pierre | 2018-10-31 22:53:11 +0000 (Wed, 31 Oct 2018) | 1 line

 Avoid range check error in ReadPosInfo
------------------------------------------------------------------------
--- Recording mergeinfo for merge of r40115 into '.':
 G   .
------------------------------------------------------------------------
r40132 | pierre | 2018-11-01 07:09:47 +0000 (Thu, 01 Nov 2018) | 1 line

 Only call moved if len>0, as otherwise astring local variable is nil, which leads to a range check error for astring[1]
------------------------------------------------------------------------
--- Recording mergeinfo for merge of r40132 into '.':
 G   .
------------------------------------------------------------------------
r40163 | pierre | 2018-11-01 21:58:54 +0000 (Thu, 01 Nov 2018) | 8 lines

  More -CriotR fixes:
  * entfile.pas: Change PPU header falgs filed from longint to dword.
  * ngtcon.pas: Change local variable startoffset type to aword.
  * omfbase.pas: Avoid calling move with a nil string s indexed as s[1],
    to avoid a range check error.
  * owomflib.pas: Disable range check explicitly in hash computation.
  * utils/ppuutils/ppudump.pp: Adapt to flags type change in entfile.pas

------------------------------------------------------------------------
--- Recording mergeinfo for merge of r40163 into '.':
 G   .

git-svn-id: branches/fixes_3_2@40616 -
2018-12-22 22:19:05 +00:00
svenbarth
32c307e9ce * fix for Mantis #34021: if one of the two operators is an array constructor try to use an operator overload for that first before converting it to a set
+ added tests

git-svn-id: trunk@39554 -
2018-08-03 15:24:59 +00:00
florian
52846df241 * fixed condition in getbestreal
git-svn-id: trunk@39446 -
2018-07-13 19:53:47 +00:00
florian
0c6cf12fbf + support for the directive $EXCESSPRECISION
git-svn-id: trunk@39443 -
2018-07-12 21:39:50 +00:00
svenbarth
fa78bb0e89 * warn if the compiler hides an eventual "+" operator overload if modeswitch ArrayOperators is active
git-svn-id: trunk@39261 -
2018-06-20 19:53:56 +00:00
svenbarth
97acf24290 + add a new modeswitch ArrayOperators which is set by default in Delphi modes that enables the internal array operators (currently only "+")
git-svn-id: trunk@39259 -
2018-06-20 19:53:43 +00:00
svenbarth
9b45f58c0b + add flags that allow checking for overloads with isbinaryoverloaded() and isunaryoverloaded() without modifying the passed in node or even checking for normally non-overloadable operators
git-svn-id: trunk@39258 -
2018-06-20 19:53:34 +00:00
svenbarth
199b5809a3 * optimize "dynarr := dynarr + [elem]" to "Insert(elem, dynarr, High(SizeInt))" and "dynarr := [elem] + dynarr" to "Insert(elem, dynarr, 0)" (we need to do this in the typecheck of taddnode as otherwise the array constructor is already converted)
+ added test
* adjusted test for Mantis #30463 as p1 triggers the optimization as well

git-svn-id: trunk@39119 -
2018-05-25 16:03:56 +00:00
florian
71e71ad267 * fix currency division on non x86 32 bit targets
* disable fix for #33439 during bootstrapping with 3.0.x, as 3.0.x cannot compile the currency division without the fix above

git-svn-id: trunk@38558 -
2018-03-17 22:44:44 +00:00
florian
b2825f2467 * scale constants if possible before currency multiplications to avoid overflows, resolves #33439
git-svn-id: trunk@38555 -
2018-03-17 21:33:07 +00:00
florian
c230f81719 + support for <dyn. array>+<dyn. array>, resolves #30463
git-svn-id: trunk@38406 -
2018-03-04 16:12:43 +00:00
Jonas Maebe
1934285c20 * don't convert "int64(sint32) * cardinal_const" into a 32x32->64
multiplication (mantis #32046)

git-svn-id: trunk@37921 -
2018-01-06 13:44:03 +00:00
pierre
59edd81a26 Disable some code using bestrealrec if macro FPC_SOFT_FPUX80 is defined
git-svn-id: trunk@37296 -
2017-09-21 14:39:14 +00:00
Károly Balogh
b755524c38 made it possible to override the decision from the cgs, if a certain muln needs a helper
git-svn-id: trunk@36347 -
2017-05-26 18:42:21 +00:00
nickysn
34113b930b * removed the checkoverflow: boolean parameter of the software mul helpers;
replaced it with a separate "_checkoverflow" version of each helper

git-svn-id: trunk@36344 -
2017-05-26 15:34:26 +00:00
Károly Balogh
3e8ee48458 m68k: define cpurox and enabled the rotate-related optimizations on CPUs which support rotate instructionsoptions.pas
git-svn-id: trunk@36302 -
2017-05-23 00:16:29 +00:00
nickysn
efc5e339d0 * use an enum instead of integer constants to represent inline numbers
* compinnr.inc include file converted to a unit
* inline number field size stored in ppu increased from byte to longint
* inlines in the parse tree (when written with the -vp option) now printed with
  their enum name, instead of number

git-svn-id: trunk@36174 -
2017-05-10 14:41:43 +00:00
florian
b1dff29cbf * removed unused units
git-svn-id: trunk@36165 -
2017-05-09 19:53:14 +00:00
nickysn
546e993c25 * use resultdef for the type of the resulting zero const from the '0*x' and
'0 and x' optimization

git-svn-id: trunk@36040 -
2017-05-01 18:11:12 +00:00
nickysn
f26a844b19 * only do the '0*x' and '0 and x' optimization if x has no side effects (except
at -O4, where it is done regardless of whether there are side effects or not)

git-svn-id: trunk@36039 -
2017-05-01 17:34:19 +00:00
nickysn
f44f2f9194 * do the optimizations in r36027 at level -O3 or higher
git-svn-id: trunk@36034 -
2017-05-01 13:14:32 +00:00
nickysn
6d589f415b * do the left.equals(right) check before might_have_sideeffects, because
left.equals(right) is usually faster

git-svn-id: trunk@36033 -
2017-05-01 12:57:15 +00:00
nickysn
217d39abf1 * fixed bug in r36027 (I had it fixed already, but accidentally committed the
wrong file in r36027)

git-svn-id: trunk@36030 -
2017-05-01 11:43:16 +00:00
nickysn
5aeb73b940 + optimizations (at -O2 level) for (where 'a' is an integer expression, without
side effects):
  * a - a   -> 0
  * a xor a -> 0
  * a and a -> a
  * a or a  -> a
  * a <> a  -> false
  * a < a   -> false
  * a > a   -> false
  * a = a   -> true
  * a <= a  -> true
  * a >= a  -> true

git-svn-id: trunk@36027 -
2017-05-01 10:17:50 +00:00
nickysn
1560f20e7f + implemented other 32-bit rol/ror by const methods for i8086 and added a
(hopefully) reasonable selection for them for all consts between 1 and 31

git-svn-id: trunk@35744 -
2017-04-06 15:41:39 +00:00
nickysn
321876252b + enabled the rol/ror intrinsic on i8086
git-svn-id: trunk@35734 -
2017-04-04 22:37:58 +00:00
florian
8bea3e0614 * the optimization introduced in r35526 requires that the tested set has no side effects as it is copied
git-svn-id: trunk@35531 -
2017-03-06 21:35:04 +00:00
florian
13b3866552 * convert (s*[const. set])<>/=[] for var. sets into or'ed in nodes, if const. set contains only a few elements
git-svn-id: trunk@35526 -
2017-03-05 20:29:22 +00:00
florian
7213a13081 * split fpc_mul_<64 bit> into separate procedures with and without overflow checking
git-svn-id: trunk@35454 -
2017-02-19 19:15:14 +00:00
florian
331bb95c5e * simplify logical operations with constant booleans if the expresions involve no side effects
git-svn-id: trunk@35230 -
2017-01-04 16:33:29 +00:00
florian
3e2aff15fb * short boolean evaluation is too expensive for simple nodes with no side effects, do full evaluation in this case
git-svn-id: trunk@35229 -
2017-01-04 16:33:27 +00:00
florian
ef81009362 * set nf_internal for nodes being generated by constant folding
git-svn-id: trunk@34800 -
2016-11-05 23:06:03 +00:00
Jonas Maebe
ec5dea1092 * don't perform the "/ const" to "* (1/const)" transformation for comp-typed
expressions, since comp cannot represent fractions (bug reported at
    http://lists.freepascal.org/pipermail/fpc-pascal/2016-June/048234.html )

git-svn-id: trunk@34035 -
2016-06-30 15:33:51 +00:00
Jonas Maebe
2bbab60c92 * when simplifying a constant string concatenation that gets assigned to a
rawbytestring, ensure the resulting constant string does not get CP_NONE
    as codepage, but the default system code page (mantis #30082)

git-svn-id: trunk@33597 -
2016-05-01 13:16:02 +00:00
yury
d4d70d3865 * Evaluate currency constant expressions when the currency type is 64-bit integer. Issue #28749.
git-svn-id: trunk@33334 -
2016-03-26 17:48:50 +00:00
Jonas Maebe
4ae8dcc91e * make the resultdef of left and right equal when comparing a dynarray
with nil (for llvm)

git-svn-id: trunk@32902 -
2016-01-10 14:01:39 +00:00
nickysn
a159ebdbad * fixed comparison of two procvars in the i8086 compact and medium memory models
git-svn-id: trunk@32166 -
2015-10-27 17:24:33 +00:00
nickysn
8eceb73dd4 * also use an 8-bit zero constant for string comparisons with the empty string.
This avoids the unnecessary 32-bit comparison on 16-bit and 8-bit CPUs

git-svn-id: trunk@32103 -
2015-10-20 15:50:02 +00:00
nickysn
a20428f246 * when doing a string comparison that calls an rtl helper, compare the function
result with an 8-bit zero constant (which will be expanded to the native
  integer size by the comparison node), instead of 32-bit zero. This avoids the
  unnecessary 32-bit comparison on 16-bit and 8-bit cpus.

git-svn-id: trunk@32099 -
2015-10-20 01:22:01 +00:00
Jonas Maebe
b22e2ef400 * add "doregister" parameter to tsetdef.create, and don't register temporary
defs created in the scanner for evaluating compile time expressions

git-svn-id: trunk@32048 -
2015-10-13 15:59:12 +00:00
Jonas Maebe
fbacf9682f * rename WinCE softfp compilerproc names to lowercase, needed since r31404
(mantis #28598)

git-svn-id: trunk@31478 -
2015-09-02 09:54:02 +00:00
Jonas Maebe
f402b0d7df * changed getpointerdef() into a tpointerdef.getreusable() class method
o allows removing the ugly x86 hacks

git-svn-id: trunk@31144 -
2015-06-22 08:17:49 +00:00
Jonas Maebe
e9800ad3f9 * make the resultdef of left and right equal when comparing a procvar
with nil (for llvm)

git-svn-id: trunk@30954 -
2015-05-31 16:50:59 +00:00
florian
cfa68be55b * do not use 16 Bit mul helper on avr, the code generator generates
muls and adds. For simple cases this might be cause longer code than a call to a well crafted assembler helper
  but inlining the muls/adds makes register allocation more flexible

git-svn-id: trunk@30739 -
2015-04-27 20:51:32 +00:00