Commit Graph

455 Commits

Author SHA1 Message Date
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
florian
d185122799 * optimize type conversions away if bits has been masked by a previous and operation
git-svn-id: trunk@26802 -
2014-02-16 18:40:35 +00:00
florian
e3f9982ee1 * make_not_regable is a matter of code generation so do it in pass_1
git-svn-id: trunk@26645 -
2014-02-01 13:08:28 +00:00
florian
2081b9cad7 * do not convert a boolean to a 32 bit int first when converting to a 64 bit int, this causes data loss when casting e.g. a qwordbool to a qword
git-svn-id: trunk@26301 -
2013-12-28 20:19:51 +00:00
florian
4d5119bf1c * fixes several issues which cause warnings by the dfa code when using it to detect uninitialized variables
git-svn-id: trunk@26161 -
2013-12-01 17:02:08 +00:00
florian
99eadb91b3 * run CheckAndWarn to get proper locations for warnings about uninitialized variables
* several fixes to liveness analysis
* get rid of old version defines
+ tests

git-svn-id: trunk@26159 -
2013-12-01 17:01:51 +00:00
Jonas Maebe
7be4e20307 * also don't put a value in registers if it is converted from a type that can
be held in one kind of register to a type that can be held in another kind
    of register (mantis #25361)

git-svn-id: trunk@26128 -
2013-11-24 12:49:23 +00:00
Jonas Maebe
2bb67ec47d * corrected usage of CPUNO32BITOPS
git-svn-id: trunk@25988 -
2013-11-07 15:20:15 +00:00
florian
bbabb77ec9 * disable 32 bit operation optimization for powerpc64
git-svn-id: trunk@25979 -
2013-11-06 21:11:08 +00:00
florian
b147693cc5 * comment updated
git-svn-id: trunk@25913 -
2013-11-01 20:22:46 +00:00
florian
945b318012 + get rid of unnecessary 64 bit conversions too if one of the operands is 8 or 16 bit
git-svn-id: trunk@25897 -
2013-11-01 19:01:09 +00:00
florian
d201bcb1cd * get rid of 64 bit operations on 64 bit targets as well if possible
git-svn-id: trunk@25896 -
2013-11-01 19:01:06 +00:00
florian
17dcd2fa31 * get rid of unneeded 64 bit multiplications, it makes also for signed operations no difference if a calculation is carried out with 32 or 64 bit, if the result is casted to 32 bin again
git-svn-id: trunk@25868 -
2013-10-27 16:47:37 +00:00
svenbarth
798bb91e90 Extract tdef.is_related plus its overrides in tobjectdef, trecorddef and tstringdef into a new function def_is_related in unit defcmp.
defcmp.pas:
  + add new function "def_is_related" which combines the "is_related" overloads of "tobjectdef", "trecorddef" and "tstringdef" (it returns "false" for other def types which is what "tdef.is_related" did)
  * compare_defs_ext & compatible_childmethod_resultdef: change call from "x.is_related" to "def_is_related(x,...)"
symtype.pas, tdef:
  - remove "is_related" method
symdef.pas:
  - remove "is_related" in "tobjectdef", "trecorddef" and "tstringdef"
  * tobjectdef.needs_inittable: for checking whether a Corba interface somehow inherits from a IInterface don't use "is_related" anymore (we want to avoid the dependency after all), but mimic the necessary functionality of "def_is_related"
htypechk.pas, nadd.pas, ncal.pas, ncnv.pas, ngtcon.pas, nld.pas, optvirt.pas, pdecobj.pas, pdecvar.pas, pexpr.pas, pgenutil.pas:
  * change call from "x.is_related" to "def_is_related(x,...)"
symtable.pas
  + use unit defcmp
  * change call from "x.is_related" to "def_is_related(x,...)"
jvm/njvmcnv.pas, jvm/njvmflw.pas:
  * change call from "x.is_related" to "def_is_related(x,...)"

git-svn-id: trunk@25847 -
2013-10-25 19:44:27 +00:00
svenbarth
76f6de5cf1 Refactor tobjectdef.find_implemented_interface out into unit defcmp so that the recently introduced cycle between symdef and defcmp can be broken again.
defcmp.pas:
  + add function "find_implemented_interface"
  * change method call of "find_implemented_interface" into function call
symdef.pas:
  - tobjectdef: remove method "find_implemented_interface"
  - remove use of unit "defcmp"
pgenutil.pas:
  * change method call of "find_implemented_interface" into function call
  + add use of unit "defcmp"
ncgcnv.pas, ncnv.pas, pdecobj.pas, pdecsub.pas, pdecvar.pas:
  * change method call of "find_implemented_interface" into function call

git-svn-id: trunk@25844 -
2013-10-23 19:05:00 +00:00