Commit Graph

140 Commits

Author SHA1 Message Date
florian
27f6fd1c2c * use new shl/shr constant folding (of r26295) only if forinline is set
* explicitly simplify tree after constant propagation

git-svn-id: trunk@26311 -
2013-12-29 14:09:03 +00:00
florian
89663e499b * fold shifting of constants equally to cpus
* test adapted, e.g. 1 shl 63 needs now an explicit cast to qword for the one: qword(1) shl 63

git-svn-id: trunk@26295 -
2013-12-28 20:19:35 +00:00
sergei
6a08ca3f0b * tmoddivnode.firstoptimize improvements/fixes:
* Fixed misplaced parentheses, which were preventing optimization of "unsigned mod power_of_two" into "and" expressions.
  * Handling "signed div power_of_two": properly delete the temp node, removes warnings when compiled with "-dEXTDEBUG". This however requires another temp node for storing the result.
  * Replaced direct calls to "fpc_sarint64" with inline nodes (in_sar_x_y), allowing target-specific optimizations to take place.

git-svn-id: trunk@25877 -
2013-10-28 15:55:13 +00:00
nickysn
1312fd72f2 * tmoddivnode.pass_typecheck: in the case of unsigned div/mod positive_const, check also the upper bound of the const, so it doesn't get truncated
git-svn-id: branches/i8086@24247 -
2013-04-14 21:56:32 +00:00
nickysn
70a0d2989c * fixed tmoddivnode.pass_typecheck on 64-bit CPUs; I was wrong about uint64 div uint64 producing int64 on 64-bit CPUs; this fixes make cycle on e.g. x86_64
git-svn-id: branches/i8086@24226 -
2013-04-11 19:51:01 +00:00
nickysn
7a15fd0444 * in the case of (uint8 div/mod small_positive_const), convert the const to unsigned, so that we don't do a 16-bit division on 8-bit CPUs
git-svn-id: branches/i8086@24209 -
2013-04-08 18:08:10 +00:00
nickysn
3558766390 * first attempt to simplify tmoddivnode.pass_typecheck handling of all cpu native int sizes
git-svn-id: branches/i8086@24208 -
2013-04-08 17:11:33 +00:00
nickysn
0dcbb4f1cc * refactored tunaryplusnode.pass_typecheck as well
git-svn-id: branches/i8086@24185 -
2013-04-07 16:50:30 +00:00
nickysn
a3117beb12 * refactored tunaryminusnode.pass_typecheck to handle all native int sizes generically, without ifdefs
git-svn-id: branches/i8086@24184 -
2013-04-07 16:45:52 +00:00
nickysn
b79569ed2f * Borland Pascal compatibility for 16-bit CPUs: int16 shl int32 now produces int32; this fixes writeln(longint) on the i8086-msdos target
git-svn-id: branches/i8086@24011 -
2013-03-26 00:59:04 +00:00
nickysn
a9640ad9c6 + insert type conversion for the div result when cpuneedsdiv32helper is used
git-svn-id: branches/i8086@23879 -
2013-03-16 23:12:39 +00:00
nickysn
1dbca4c403 * 16-bit ALU fixes in tmoddivnode.pass_typecheck
git-svn-id: branches/i8086@23878 -
2013-03-16 22:50:09 +00:00
nickysn
edc382aa76 * 16-bit ALU fixes in tshlshrnode.pass_typecheck
git-svn-id: branches/i8086@23817 -
2013-03-13 18:00:28 +00:00
nickysn
4ac508a2b9 fixed bug in tunaryplusnode.pass_typecheck introduced in my previous commit r23737
git-svn-id: branches/i8086@23744 -
2013-03-09 14:05:09 +00:00
nickysn
63ac46c74c 16-bit ALU fixes in tunaryminusnode.pass_typecheck and tunaryplusnode.pass_typecheck
git-svn-id: branches/i8086@23743 -
2013-03-09 13:24:42 +00:00
florian
8e5bd14e3a * overleft newline fix
git-svn-id: trunk@23110 -
2012-12-03 21:56:01 +00:00
sergei
12ad6704f6 - Removed a number of unused variables, reduces noise at compilation.
git-svn-id: trunk@22880 -
2012-10-30 11:55:59 +00:00
florian
5e1e42ec2b * fixes support for cpus with cpunodefaultint for unary minus nodes
git-svn-id: trunk@22838 -
2012-10-23 20:27:07 +00:00
Jonas Maebe
9e0184884e * correctly change the signdness information of tordconstnodes that are
simplified via typeconvnode (corrects resultdef of "qword(1) shl 33",
    mantis #22133)
  * simplify shl/shr nodes after their resultdef has been set, so the
    resultdef used during simplify is set (fixes same expression as above
    when it is calculated by an inline function)

git-svn-id: trunk@21394 -
2012-05-26 13:31:23 +00:00
Jonas Maebe
aee5380ae0 * merged trunk up to r20882
o support for the new codepage-aware ansistrings in the jvm branch
   o empty ansistrings are now always represented by a nil pointer rather than
     by an empty string, because an empty string also has a code page which
     can confuse code (although this will make ansistrings harder to use
     in Java code)
   o more string helpers code shared between the general and jvm rtl
   o support for indexbyte/word in the jvm rtl (warning: first parameter
     is an open array rather than an untyped parameter there, so
     indexchar(pcharvar^,10,0) will be equivalent to
     indexchar[pcharvar^],10,0) there, which is different from what is
     intended; changing it to an untyped parameter wouldn't help though)
   o default() support is not yet complete
   o calling fpcres is currently broken due to limitations in
     sysutils.executeprocess() regarding handling unix quoting and
     the compiler using the same command lines for scripts and directly
     calling external programs
   o compiling the Java compiler currently requires adding ALLOW_WARNINGS=1
     to the make command line

git-svn-id: branches/jvmbackend@20887 -
2012-04-15 15:54:10 +00:00
pierre
7101151b5c Avoid internal error 2002042430 and check overloading before calling simplify method
git-svn-id: trunk@20635 -
2012-03-26 15:44:47 +00:00
Jonas Maebe
3b8ae840c1 * avoid range check errors when inlining not-nodes (mantis #21029)
git-svn-id: trunk@20046 -
2012-01-10 22:23:25 +00:00
florian
4765728fc4 * use SarInt64 to optimize 64 bit divs on 32 bit platforms, resolves #20998
git-svn-id: trunk@19968 -
2012-01-04 22:58:25 +00:00
pierre
da62249d6b * Fix code to avoid use of unitialized rv local variable in tmoddivnode.simplify method
git-svn-id: trunk@19571 -
2011-11-02 11:22:45 +00:00
florian
6ec0f2549a * factored load node flags out of node flags to gain space
+ implemented iso mode mod, resolves #17685

git-svn-id: trunk@19558 -
2011-10-30 15:14:21 +00:00
Jonas Maebe
845f50448c + support for qword div/mod via helper (the JVM only supports signed
64 bit division natively)

git-svn-id: branches/jvmbackend@18523 -
2011-08-20 08:07:02 +00:00
florian
d35d1ed357 + initial support for pascal booleans with sizes 2, 4 and 8
git-svn-id: branches/pasboolxx@17836 -
2011-06-26 15:02:37 +00:00
sergei
2f7c779fa4 * tmoddivnode.simplify: made result definitely assigned and removed local var
* tshlshrnode.simplify: likewise

git-svn-id: trunk@17770 -
2011-06-19 21:48:18 +00:00
tom_at_work
e5fc169e57 * Call fpc_shl/r_qword for qword types for first_shlshr64bitint method
git-svn-id: trunk@17620 -
2011-06-01 06:25:00 +00:00
paul
d21bbc4548 compiler: reduce amount of hints and warnings
git-svn-id: trunk@17350 -
2011-04-20 02:58:52 +00:00
florian
8d960cb608 + implementation of shifting operations for avr
* handle shl/shr operand size correctly

git-svn-id: branches/avr@17109 -
2011-03-09 19:48:01 +00:00
paul
a8da9e4bd1 compiler: set result value to dummy function to prevent compiler to generate a hint
git-svn-id: trunk@16649 -
2010-12-28 09:51:26 +00:00
paul
ee6fe6c4f5 compiler: add unary plus node, search for unary plus operator if a type cannot be handled by compiler, increase ppu version because of node types change
git-svn-id: trunk@16640 -
2010-12-26 12:19:28 +00:00
Jonas Maebe
769eb3f604 * moved the initialisation of the nodetree and tai class reference constants
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 -
2010-10-09 18:52:22 +00:00
Jonas Maebe
94d976bc87 * when simplifying ordinal expressions during inlining, keep the resultdef
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 -
2010-10-07 15:08:52 +00:00
florian
c1f3d8dcaa * unified names of system_*/systems_* sets
git-svn-id: trunk@14566 -
2010-01-07 18:16:20 +00:00
Jonas Maebe
a00df1033f * changed "Mixing signed expressions and longwords gives a 64bit result"
from warning into a hint (it's not a potential error, but potential
    optimisation advice)

git-svn-id: trunk@12075 -
2008-11-13 19:49:46 +00:00
Jonas Maebe
931aef4daa * make result of not(constant) (with constant type <= sinttype)
equal to sinttype (Delphi-compatible, fixes #10966)
  * changed not(cardinal_constant) into sinttype on 64 bit
    platforms for consistency with other similar rules (and with
    the above change)

git-svn-id: trunk@10455 -
2008-03-07 16:33:15 +00:00
Jonas Maebe
0ae33aeab0 * the result of not(dword(ordconst)) has to be dword as well for Delphi
compatibility (and to avoid range errors like in mantis #10931)

git-svn-id: trunk@10451 -
2008-03-06 21:36:32 +00:00
Jonas Maebe
761f2e5c93 * fixed constant evaluation of not(byte/word/long/quadbool) + test
git-svn-id: trunk@10450 -
2008-03-06 20:29:27 +00:00
Jonas Maebe
db34ed44e4 * fixed an {$ifndef cpu64bitalu} which had to be {$ifndef cpu64bitaddr}
git-svn-id: trunk@10371 -
2008-02-20 20:08:03 +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
8349cde7db * changed byte/word/longbool to be Delphi-compatible (+ similar changes
for qwordbool) + test:
    o assigning true to such a variable now sets them to $ff/$ffff/$ffffffff
    o these types are now all signed
    o converting an integer type to a byte/word/long/qwordbool using an
      explicit type cast keeps the integer's original value stored in the
      bool, instead of forcing it to ord(true)/ord(false)
    (mantis #10233 and #10613, implemented for all architectures, testsuite
     tested for ppc32, sparc and x86)
  * fixed some places where the rtl depended on longbool(true) having the
    value 1
  * extended several boolean tests (and adapted some to no longer assume
    that byte/word/long/qwordbool(true)=1)
  + support for converting to qwordbool in second_int_to_bool for x86, ppc
    and sparc

git-svn-id: trunk@9898 -
2008-01-24 21:30:55 +00:00
Jonas Maebe
67431891e0 * fixed resulttype of unaryminusn for qwords on 32 bit platforms (was
qword, now is int64)
  * simplified currency checking in unaryminusn pass_typecheck

git-svn-id: trunk@9524 -
2007-12-25 23:43:07 +00:00
peter
6b8aed593f * remove registers{int/mmx/fpu} from firstpass
* small cleanups of unused variables in firstpass
  * node_resources_fpu() created to get an approximation of the
    required fpu registers
  * for the moment use node_complexity in the CG until the
    node_resource_int() is created

git-svn-id: trunk@8655 -
2007-09-26 21:12:01 +00:00
Jonas Maebe
cc0bd74ea0 - removed unused variable after div-by-zero simplify patch
git-svn-id: trunk@8359 -
2007-09-02 21:06:50 +00:00
Jonas Maebe
ac22ff09da * detect division by zero in tmoddiv.simplify (mantis #9499)
git-svn-id: trunk@8341 -
2007-08-30 17:21:29 +00:00
peter
8bd95f4dd4 * keep signess of orginal variable in shl/shr operation
git-svn-id: trunk@8143 -
2007-07-22 22:56:35 +00:00
Jonas Maebe
28bab3fb4f - removed some unused variables
* fixed some (harmless) ptrint warnings
  - removed some commented code in agppcmpw
  * added one missing field in a typed constant in cp1251

git-svn-id: trunk@8081 -
2007-07-17 13:57:15 +00:00
yury
afdd053172 * fixed unary minus in softfloat mode (bug #8737).
git-svn-id: trunk@8047 -
2007-07-14 10:09:37 +00:00