Commit Graph

469 Commits

Author SHA1 Message Date
svenbarth
0351369698 * ttypeconvnode.typecheck_arrayconstructor_to_dynarray: the assignment node of the temp array to the resulting array always needs to exist, so remove the assigned() check
git-svn-id: trunk@36245 -
2017-05-18 20:07:57 +00:00
svenbarth
b78037f6f2 * ttypeconvnode.typecheck_arrayconstructor_to_dynarray: use ctempcreatenode.create_value() instead of create() to get rid of the explicit addition of an assignment node
git-svn-id: trunk@36244 -
2017-05-18 20:07:02 +00:00
nickysn
460dd1c10a * remove the redundant equal typeconv, left over as an artifact after removing
the unnecessary widening of intermediary calculations to 64-bit. This allows,
  among other things, the x:=x+k optimization to be applied in the case of
  signed32:=signed32+unsigned32 types.

git-svn-id: trunk@36191 -
2017-05-12 11:40:06 +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
c7ba611bf9 * when explicitly casting a variable, it might be sufficient if it is const_regable
git-svn-id: trunk@36137 -
2017-05-06 18:47:45 +00:00
svenbarth
df893b4a30 * implement a type conversion from an array constructor to a dynamic array
git-svn-id: trunk@36095 -
2017-05-04 21:34:38 +00:00
svenbarth
6e31a7ac83 + add an overload to arrayconstructor_to_set that allows it to be used without the passed in node being freed
git-svn-id: trunk@36094 -
2017-05-04 21:30:52 +00:00
svenbarth
cc5e3fdee9 + add utility function arrayconstructor_can_be_set which uses similar code to arrayconstructor_to_set to check whether an array constructor has even a chance to be converted to a set
git-svn-id: trunk@36093 -
2017-05-04 21:28:03 +00:00
nickysn
8033392554 * on 16-bit CPUs remove unnecessary 32-bit conversions of integers, that are
later converted back to 16 bits

git-svn-id: trunk@35679 -
2017-03-29 10:49:32 +00:00
Károly Balogh
5426c11611 marked a few uses of TConstExprInt as const during parameter passing, to avoid a few unnecessary record copying
git-svn-id: trunk@35509 -
2017-03-03 17:29:59 +00:00
Jonas Maebe
a2017b2327 * don't keep tc_equal type conversions for LLVM in case the resultdef doesn't
change, since then we definitely don't have to insert a type conversion at
    the LLVM level either (fixes webtbs/tw1901 for LLVM)

git-svn-id: trunk@35057 -
2016-12-04 11:15:09 +00:00
florian
4862e64b53 * type conversions of constants require that unneeded bits are cut off
git-svn-id: trunk@34797 -
2016-11-05 23:05:58 +00:00
florian
000cffa8e3 * make more use of nf_internal to avoid range check errors
git-svn-id: trunk@34793 -
2016-11-05 23:05:51 +00:00
Jonas Maebe
66be068365 * set the correct resultdef after converting a dynamic array to an open array
in ncnv
  * handle the fact that we overwrite the open array resultdef of a parameters'
    left node with the original resultdef (i.e., also for dynamic arrays) with
    regards to LLVM type rules
   o use the parameter's formal type (open array) instead of the value's type
     (dynamic array) when loading/using its value, since that's the type the
     value has been converted to
   o this change is not really nice since it adds several independent checks in
     different places, but I can't find a way to nicely unify the code to work
     around this (nor one to get rid of that hack in the first place)

git-svn-id: trunk@34515 -
2016-09-11 17:12:04 +00:00
Jonas Maebe
661be0baad * replaced ctemprefnode.create_offset() usage in variant array indexing
operations

git-svn-id: trunk@33731 -
2016-05-21 10:28:22 +00:00
Jonas Maebe
1e1b36515e * don't narrow expressions that contain a mod/div followed by an "and",
since the mod/div get a different result if calculated using fewer
    bits (mantis #29930)

git-svn-id: trunk@33413 -
2016-04-02 22:09:34 +00:00
Jonas Maebe
bbe8e346e0 * handle tc_equal typeconversions from conststring to a stringdef in
simplify, so that shortstring -> shortstring constant string conversions
    are simplified for LLVM too (it leaves regular tc_equal type conversions
    because often the type is still somewhat different), which is required
    for the code in tasmlisttypedconstbuilder.tc_emit_stringdef() (it
    assumes the result of inserting a type conversion is again a
    stringconstant if it can be handled at compile time)

git-svn-id: trunk@32907 -
2016-01-10 14:01:58 +00:00
Jonas Maebe
49a83b2872 * allow targets to keep certain type conversions for equal types in
inserttypeconv()
   o keep typeconversions between structurally equivalent but semantically
     different procvardefs for LLVM and JVM, because they're different
     types there

git-svn-id: trunk@32904 -
2016-01-10 14:01:46 +00:00
Jonas Maebe
ea0c8e6f38 - reverted accidentally committed code with r32463
git-svn-id: trunk@32476 -
2015-11-22 11:52:30 +00:00
Jonas Maebe
688b9c0a69 * use the correctly typecasted reference in a_bit_set_reg_ref
git-svn-id: trunk@32463 -
2015-11-22 11:49:07 +00:00
Jonas Maebe
18ad8fc004 * fixup for r32338: to reset a typeconvn, its convtype must also be set
back to tc_none

git-svn-id: trunk@32342 -
2015-11-15 23:15:46 +00:00
Jonas Maebe
6677747d74 * reprocess changed typeconvn in doremoveinttypeconvs(), as the changed
resultdef can result in a different type conversion (e.g. from nothing
    to int_2_int in case the result size changes)

git-svn-id: trunk@32338 -
2015-11-15 19:57:04 +00:00
yury
9431648b6c * Fixed conversion from float to currency when the currency type is 64-bit integer. Issue #28748.
git-svn-id: trunk@32054 -
2015-10-13 22:30:46 +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
svenbarth
529677cc79 ncal.pas:
* extend tcallnode with the ability to pass a tspecializationcontext so that tcallcandidates can do a final specialization
  * the final procdef is registered at the end of tcallnode.pass_typecheck

git-svn-id: trunk@31763 -
2015-09-18 14:48:54 +00:00
yury
432248cbf1 * Removed lot of unused vars.
git-svn-id: trunk@31732 -
2015-09-17 12:48:58 +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
fa1ac2515e * don't look for overloaded operators in case of internally generated
type conversions (mantis #28375)

git-svn-id: trunk@31191 -
2015-07-03 20:19:48 +00:00
florian
01cbf00455 * unified code to remove unnecessary type casts to support also removals of type conversions between smaller ints
* get rid of unnecessary 8->16 Bit type conversions on 8 Bit CPUs, resolves issue #27839

git-svn-id: trunk@30726 -
2015-04-25 21:18:34 +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
c764826bb3 * check whether we are explicitly typecasting untypedpointer^ before other
cases (that depend on the sizes of the typecast matching) so that we
    can (internally) generate typecasts to open array/array of const

git-svn-id: trunk@29819 -
2015-02-23 22:47:44 +00:00
florian
aafec52a52 * allow multiple passes on as nodes
git-svn-id: trunk@29741 -
2015-02-17 21:14:43 +00:00
Jonas Maebe
146e3bcb9e * synchronised with trunk till r29513
git-svn-id: branches/blocks@29516 -
2015-01-21 23:28:34 +00:00
Jonas Maebe
e97f31541e - reverted partial commit of merge
git-svn-id: branches/blocks@29515 -
2015-01-21 23:24:37 +00:00
Jonas Maebe
a76bbf363d * synchronised with trunk r29513
git-svn-id: branches/blocks@29514 -
2015-01-21 23:18:29 +00:00
pierre
1e7a3cd003 Fix for tw8513 failure for big endian processors
git-svn-id: trunk@29090 -
2014-11-19 06:58:02 +00:00
Jonas Maebe
63a3ff3c7f * integrate the functionality to create an address-only procvardef from a
procdef into tprocdef.getcopyas()

git-svn-id: branches/hlcgllvm@28474 -
2014-08-19 20:22:06 +00:00
Jonas Maebe
6f01bb56d6 * automatically call calcparas adter creating a procvardef from a procvdef,
so it doesn't have to be done explicitly anymore afterwards

git-svn-id: branches/hlcgllvm@28473 -
2014-08-19 20:22:03 +00:00
Jonas Maebe
f4cdf13d54 * since the generic second_bool_to_bool() calls through to
second_int_to_bool() and second_bool_to_int() for certain cases, do the
    same for their first_*() variants in first_bool_to_bool() so that the
    expectloc is correctly initialised
   o since first_int_to_bool can now be called for bool_to_bool to, make
     sure we correctly handle is_boolean(left.resultdef) in that case
     (integers cast to a smaller boolean type ignore the upper bits,
      while with boolean to boolean they are taken into account

git-svn-id: branches/hlcgllvm@28369 -
2014-08-10 19:40:11 +00:00
Jonas Maebe
af98f9e39d * initialise expectloc for passthrough first_bool_to_int() and
first_int_to_bool()

git-svn-id: branches/hlcgllvm@28368 -
2014-08-10 19:40:08 +00:00
Jonas Maebe
2bc8afaa63 + support for calling a method via a block: we capture the method as a
procvar in the local state of the block, and then call it insde the
    generated invoke routine. We can't call it directly there, because
    due to visibility reasons it may not be accessible from a regular
    procedure (e.g. if it is a strict private method)

git-svn-id: branches/blocks@28234 -
2014-07-18 09:15:35 +00:00
Jonas Maebe
bd09b88a5b + support for http://en.wikipedia.org/wiki/Blocks_(C_language_extension)
o blocks are implemented as a variation of procedure variables
   o declaration of a block variable: "test: procedure(c: char) is block;"
     (C equivalent: (void)(^test)(char c) )
   o the compiler automatically converts procedures/functions whose address
     is passed to a block parameter or assigned to a block variable into
     a "block". This consists of
    1) generating a block descriptor (containing the size of the "block
       literal" (see below) and the signature of the invocation function
       encoded as an Objective-C selector)
    2) generating a wrapper function around the original funcion (with C
       calling convention), that has an extra first hidden parameter
       (marked as vo_is_parentfp in the compiler) whose type is a pointer
       to the describing "block literal"
    3) generating the "block literal", which contains a pointer to an
       external variable indicating whether this block captures context or
       not, some flags (see compiler/blockutl.get_block_literal_flags for
       info), a pointer to the wrapper function and a pointer to the
       descriptor. In the future, it will also contain captured variables.
   o right now, only global procedures/functions can be converted to blocks
     (because they don't require state capturing). The next steps are (Object
     Pascal) methods (not Objective-C methods, because Objective-C method
     procvars don't exist) and finally nested functions
   o on Mac OS X, the functionality will only work on Mac OS X 10.7 and later,
     because we have to use the so-called "ABI.2010.3.16" to ensure that
     our blocks aren't called as variadic functions by the runtime (which
     came out after the Mac OS X 10.6 release)
   o while the currently implemented functionality does not require any
     library support at all, there's no use enabling it on other platforms
     because unless it has been confirmed to work with a blocks runtime,
     there's no point in using blocks (they're just somewhat bulky procvars
     right now). Enabling it on other platforms (in combination with the
     GNUStep Objective-C run time), should simply be a matter of adding
     the right {$linklib xxx} statement to rtl/inc/blockrtl.pp file, adding
     that file to Makefile.fpc for that platform and adding that platform
     to the compiler/systems.systems_blocks_supported set

git-svn-id: branches/blocks@28232 -
2014-07-18 09:15:22 +00:00
Jonas Maebe
7949bebb8d * synchronised with r28168 of trunk
git-svn-id: branches/hlcgllvm@28169 -
2014-07-05 21:30:28 +00:00
Jonas Maebe
99b4389297 * fixed tbs/tb0607 for 64 bit targets: there the nf_internal flag isn't set
for cardinal-cardinal. Now treat the result of any sub node as potentially
    negative.

git-svn-id: trunk@27971 -
2014-06-15 15:26:56 +00:00
Jonas Maebe
bacd303208 * synchronized with trunk up to r27758
git-svn-id: branches/hlcgllvm@27779 -
2014-05-12 16:12:34 +00:00
Jonas Maebe
13fbf5b6ef * fixup for r27725: limit change to subn
git-svn-id: trunk@27732 -
2014-05-04 11:40:32 +00:00
Jonas Maebe
e704dd8d74 * treat "u32bit-u32bit" as a signed value when removing automatic
64 bit upcasts, as the result can be negative when evaluated in
    64 bit (reported on irc, please file bug reports)

git-svn-id: trunk@27725 -
2014-05-03 15:06:16 +00:00
Jonas Maebe
d452686c39 * moved pbestrealtype from symdef to symcpu
git-svn-id: trunk@27441 -
2014-04-01 21:41:37 +00:00
Jonas Maebe
b57c95043f + support overriding tdef/tsym methods with target-specific functionality:
o made all (non-abstract) tdef and tsym constructors virtual
   o added c*def/c*sym classref types for every (non-abstract) t*def/t*sym
     class
   o added cpusym unit for every architecture that derives a tcpu*def/tcpu*sym
     class from the base classes, and initialises the c*def/c*sym classes with
     them. This is done so that the llvm target will be able to derive from
     the tcpu*def/sym classes without umpteen ifdefs, and it also means that
     the WPO can devirtualise everything because the c* variables are only
     initialised with one class type
   o replaced all t*def/t*sym constructor calls with c*def/c*sym constructor
     calls

git-svn-id: trunk@27361 -
2014-03-29 22:31:55 +00:00
Jonas Maebe
8cc9b64ad7 * don't discard typeconversion nodes that only change the result type when
compiling for llvm, because this type change also needs to be modelled in
    llvm IR

git-svn-id: branches/hlcgllvm@26999 -
2014-03-06 21:41:24 +00:00