Commit Graph

444 Commits

Author SHA1 Message Date
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
sergei
90d66595c2 * typecheck_real_to_currency: generate inline round() node instead of direct call to fpc_round_real, this allows target-specific processing to take place and possibly emit more efficient code.
* Provide x86_64 SSE versions of fpc_trunc_real and fpc_round_real, strictly they are not necessary after the above change to code generation, but it still reduces size of system unit by avoiding compilation of related generic code.

git-svn-id: trunk@25735 -
2013-10-10 12:46:51 +00:00
Jonas Maebe
de56f909d5 * synchronized with trunk up to and including r25430
git-svn-id: branches/cpstrrtl@25431 -
2013-09-06 10:09:26 +00:00
Jonas Maebe
b3b404db4b * handle any char constant -> p(wide)char conversions via cunicodestringtype
because the compiler cannot convert arbitrary unicodechar constants at
  compile time to a shortstring (since it doesn't know the code page to use)
  (test part of next commit)

git-svn-id: branches/cpstrrtl@25429 -
2013-09-06 08:02:52 +00:00
Jonas Maebe
3c3ad705f1 * changed fpc_(u)char_to_shortstr() from a procedure into a function, like
the other fpc_(u)char_to_*str() routines (exception dates back to the
    time calls to these routines were still inserted "manually" in the
    compiler). Fixes the compilation of "shortstr:=widecharconstant" after
    r23613 and simplifies other code calling this helper + test

git-svn-id: branches/cpstrrtl@25428 -
2013-09-06 08:02:46 +00:00
Jonas Maebe
10bb07a665 * brackets around and/or combination
git-svn-id: trunk@25386 -
2013-08-29 22:21:19 +00:00
Jonas Maebe
fb8fb29574 * record/use the code page of string constants typecasted to an ansistring
type with a non-default code page
   TODO: ensure that string constants typecasted to ansistring become
     ansistrings rather than typeless string constants

git-svn-id: trunk@25207 -
2013-08-02 13:23:32 +00:00
florian
be2ab84474 * make actualtargetnode a normal procedure using pointers to node so it can be used also when replacing nodes
+ replacenode to replace nodes inline

git-svn-id: trunk@25013 -
2013-06-29 22:20:30 +00:00
florian
0e41df598e * merge i8086 branch by Nikolay Nikolov
git-svn-id: trunk@24324 -
2013-04-25 20:23:51 +00:00
florian
075abd6220 + support of stackframesize for arm thumb
+ estimatedtempsize to get a good estimatation for architectures which require to know the stack size before

git-svn-id: trunk@24188 -
2013-04-07 21:00:38 +00:00
nickysn
889e8650f1 * fixed compiler crash due to infinite recursion when compiling boolean to longint conversion on a 16 or 8-bit CPU
git-svn-id: branches/i8086@24135 -
2013-04-03 00:16:41 +00:00
Jonas Maebe
0ad9f345dd * handle explicit typecasts of procdefs to procvardefs always via
proc_to_procdef, because a methodpointer may have to be discarded

git-svn-id: trunk@23929 -
2013-03-19 13:23:51 +00:00