Commit Graph

231 Commits

Author SHA1 Message Date
peter
8f239d04b6 * cleanup and simplify the set type handling
git-svn-id: trunk@10432 -
2008-03-02 17:48:27 +00:00
Jonas Maebe
97f4c0a130 * call taddnode.simplify at the very end of taddnode.pass_typecheck, so
it doesn't have to duplicate any type checking code, and so constant
    expressions get the same resultdefs as non-constant expressions
  * properly fixed resultdef determination of "set + setelementn" (follows
    same rules now as "set + set")
  * also convert "longint or/xor cardinal" to int64 (needed for correct
    results with negative numbers and Delphi-compatible) + test
  * extended 64-to-32 type conversion simplification to also handle
    or/xor nodes (so if the result is typecasted back to 32 bit, the
    evaluation can still be done entirely in 32 bit). These changes also
    enable that optimization in some extra cases (not just anymore for
    expressions containing only uint32)

git-svn-id: trunk@10418 -
2008-03-01 20:48:50 +00:00
florian
5826b9bdad + define cpunodefaultint
git-svn-id: trunk@10415 -
2008-03-01 20:31:56 +00:00
Jonas Maebe
59ca0153e7 * moved transformation of "mul by power-of-2" to shl from type check
pass to pass 1 (where most optimizing transformations are located,
    and because the way it's written it goes wrong if left and right are
    a constant, and I'm working on moving the simplify code after the
    typechecking code so the resulttype for constant and non-constant
    expressions can be the same)

git-svn-id: trunk@10396 -
2008-02-27 15:56:40 +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
peter
737212ff22 * fix result type of constset+[]
git-svn-id: trunk@10311 -
2008-02-12 17:30: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
84159b3cbb * optimize away unnecessary implicit upcasts to int64 for subtractions
of u32bit values on 32 bit platforms (after the int64 values have 
    already been used for overload selection etc, i.e., semantically
    nothing changes)
  + test which checks that not too many typecasts are optimized away

git-svn-id: trunk@9664 -
2008-01-06 23:30:19 +00:00
peter
bbae08d0ef * fix range check error when compiling with 2.2.x
git-svn-id: trunk@9650 -
2008-01-06 12:45:26 +00:00
Jonas Maebe
af2b4ee178 - reverted r9519 because it breaks tbs/tb0162 and test/tint644
git-svn-id: trunk@9622 -
2008-01-03 22:13:13 +00:00
peter
13ca601510 * use svalue to compare with -1
git-svn-id: trunk@9519 -
2007-12-23 20:44:02 +00:00
Jonas Maebe
814e983c98 * optimize intvar*(-1) to -intvar
git-svn-id: trunk@9418 -
2007-12-08 16:41:28 +00:00
Jonas Maebe
bbca8ee012 * perform 32x32 to 64 multiplication in two more situations (u8bit and
u16bit can be converted to s32bit without any problems)

git-svn-id: trunk@9357 -
2007-11-30 17:55:20 +00:00
Jonas Maebe
df2ecd14f5 * fixed comparisons of orddefs with fourcharcodes in macpas mode + test
git-svn-id: trunk@9014 -
2007-10-31 15:11:13 +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
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
peter
1d387c935d * small typecheckpass wrapper for recursion
git-svn-id: trunk@8434 -
2007-09-11 22:26:36 +00:00
Jonas Maebe
3f701c96d4 * explicitly check for stringconstn next to stringdef in nadd, because
a stringconstn is often an arraydef. The result is that they again
    get the same typeconversion behaviour as string variables, which is
    important in case of overloaded operators (#9021/#9026)

git-svn-id: trunk@8268 -
2007-08-12 11:31:19 +00:00
peter
67e16340be * revert r8118
git-svn-id: trunk@8139 -
2007-07-22 19:59:00 +00:00
daniel
21293f5818 + Add common type integer promotion.
- {$intpromotion common_type} or -CIcommon_type switches to common type promotion.
    - {$intpromotion native_integer} or -CIcommon_type switches to current behaviour.
    - Default in tp mode is common_type, native_integer in other modes
    - Compiler can cycle with -CIcommon_type
    - Still needs checking on other architectures than i386

git-svn-id: trunk@8118 -
2007-07-21 19:16:24 +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
daniel
7934961490 * Fix browcol.
- Remove another obsolete uint64 test.

git-svn-id: trunk@7659 -
2007-06-14 08:33:19 +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
51ebaa592f * fixed tests/webtbf/tb0041 broken by r7603: check whether ordinals
are compatible before optimizing the checks away

git-svn-id: trunk@7616 -
2007-06-09 20:17:46 +00:00
daniel
60dee7fcf0 + New optimization: Comparisions with evaluate to true or false if the
constant is outside the range of type bounds of the left expression.
    I.e. "if a>0" evaluates to true if a is declared with type 1..10,
    as all legal values of a are greater than zero.

git-svn-id: trunk@7603 -
2007-06-09 14:03:56 +00:00
daniel
fe5118e903 * Reduce false positives of type_h_use_div_for_int.
git-svn-id: trunk@7590 -
2007-06-06 19:50:04 +00:00
Jonas Maebe
5cf2511283 - removed/disabled all normalset code (except for bootstrapping), since
it's no longer needed

git-svn-id: trunk@7403 -
2007-05-20 11:19:36 +00:00
Jonas Maebe
76b190b723 - removed caretn and related code
git-svn-id: trunk@7257 -
2007-05-04 10:53:25 +00:00
florian
01de46a0f4 * don't allow logical operators on char, resolves #8780
git-svn-id: trunk@7181 -
2007-04-28 18:43:58 +00:00
peter
bc071f709c * fix r7009, check also if the other node is integer type
git-svn-id: trunk@7032 -
2007-03-30 06:51:23 +00:00
peter
e653ab6a22 * also try to convert non-set nodes to a set in set operations
git-svn-id: trunk@7010 -
2007-03-27 18:37:30 +00:00
peter
ab22fd42d1 * simplify integer operations with constnat 0 or 1
git-svn-id: trunk@7009 -
2007-03-27 18:33:04 +00:00
Jonas Maebe
31c29a280a * moved typechecking stuff from taddnode.simplify to taddnode.pass_typechec
This is needed to be able to call simplify after pass_1, because
    otherwise the inserttypeconv's inserted new type conversions which
    where never firstpassed (if you want to do something like that, you
    have to return a new node as well so it will be firstpassed properly
    -- but in this case it seems this is not needed, since inserting
    those typeconversions are part of typechecking and not of simplifying,
    and typechecking must be done before simplifying anyway)

git-svn-id: trunk@6836 -
2007-03-13 23:17:12 +00:00
florian
c3f22aae94 * fixed set+range on big endian systems
git-svn-id: trunk@6704 -
2007-03-03 19:51:34 +00:00
florian
efb025310d * tried to restore old set behaviour for big endian targets
git-svn-id: trunk@6702 -
2007-03-03 17:52:55 +00:00
florian
9a0f769b2f * cleaned up set conversion
* fixed conversion of var sets

git-svn-id: trunk@6644 -
2007-02-25 16:29:39 +00:00
peter
9a37c04131 * cardinal-cardinal is calculated using int64
* support pointer(int64) for all modes, this is needed to
    support pointer(cardinal+longint) and pointer(cardinal-cardinal)

git-svn-id: trunk@6586 -
2007-02-21 11:52:06 +00:00
daniel
e8050233af + Patch by Thorsten Engler to optimize string comparisons for = and <> cases. (Mantis #8231)
git-svn-id: trunk@6241 -
2007-01-28 10:58:52 +00:00
florian
c6d3bc813f * fixes #8229
git-svn-id: trunk@6238 -
2007-01-28 08:21:08 +00:00
Jonas Maebe
d3ea2fa9e3 - removed some unneeded and sometimes wrong typecasts (could be
typeconv nodes as well rather than direct setelementn)

git-svn-id: trunk@6186 -
2007-01-25 15:19:47 +00:00
pierre
b486f926ce * taddnode.first_addstring, avoid memory leak if
left or right is an empty string.

git-svn-id: trunk@5550 -
2006-12-07 13:03:51 +00:00
florian
7781e842fc * varset support fixed
git-svn-id: trunk@5294 -
2006-11-08 22:48:44 +00:00
peter
0557ddc342 * removed typed const, it is now handled by staticvarsym
* globalvarsym renamed to staticvarsym
  * fixed invalid regvar use in init when the finalize also uses the var

git-svn-id: trunk@5290 -
2006-11-08 21:04:22 +00:00
yury
5a9b0949c5 * fixed wince build.
git-svn-id: trunk@5250 -
2006-11-05 17:55:00 +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
85d63d9fa9 * settings refactored
git-svn-id: trunk@5094 -
2006-10-30 18:02:58 +00:00
Jonas Maebe
d5b069a935 * added missing typecheckpasses for new left/right nodes created in
taddnode.typecheckpass()

git-svn-id: trunk@5089 -
2006-10-30 10:29:29 +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
florian
67aa148602 * fixed softfpu support
+ softfpu enabled for arm-gba

git-svn-id: trunk@4939 -
2006-10-15 21:31:27 +00:00
micha
8678d52aeb * avoid warning when pointer points to size 1 data
* fix variantmanager for {$T+}

git-svn-id: trunk@4861 -
2006-10-11 16:40:40 +00:00