Commit Graph

302 Commits

Author SHA1 Message Date
Jonas Maebe
51e68eb302 * fixed several places where the interface crc could change:
o unsetting po_inline while parsing the implementation for various reasons
     (interprocedural goto/label, accessing a local in a parent frame,
      having nested procedures)
   o instead handle this via the pio_inline_not_possible flag
   o noreturn can no longer be specified only in the implementation

git-svn-id: trunk@40789 -
2019-01-06 20:35:56 +00:00
florian
ae8304f657 * set nf_write flag properly for vec. nodes of types with implicit dereferencing
git-svn-id: trunk@40339 -
2018-11-17 15:08:23 +00:00
florian
9f16c34329 + initial work for tls-based threadvar support on arm-linux
git-svn-id: trunk@40267 -
2018-11-07 22:02:58 +00:00
svenbarth
a8b2ad31d1 * fix for Mantis #34355: correctly check whether the array constructor is empty (aka []) or not
git-svn-id: trunk@39882 -
2018-10-07 12:25:24 +00:00
svenbarth
85439a0fa0 * also check for nf_assign_done_in_right flag after typechecking the right side
git-svn-id: trunk@39118 -
2018-05-25 15:54:41 +00:00
florian
0fd0e356e1 + new flag ra_different_scope: used if a node tree is marked as non-regable if a variable is accessed from a different scope
git-svn-id: trunk@38689 -
2018-04-04 21:39:47 +00:00
florian
c230f81719 + support for <dyn. array>+<dyn. array>, resolves #30463
git-svn-id: trunk@38406 -
2018-03-04 16:12:43 +00:00
svenbarth
d50848174a + add putboolean and getboolean convenience methods to tentfile
* use putboolean and getboolean where approbiate

git-svn-id: trunk@37972 -
2018-01-14 21:36:02 +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
b1dff29cbf * removed unused units
git-svn-id: trunk@36165 -
2017-05-09 19:53:14 +00:00
svenbarth
8f4ef91efb * tarrayconstructornode: force conversion to set if there's a range node in the tree
git-svn-id: trunk@36101 -
2017-05-04 21:55:12 +00:00
svenbarth
82b2d22ed6 * keep track of allow_array_constructor as part of the array constructor node
git-svn-id: trunk@36099 -
2017-05-04 21:52:21 +00:00
svenbarth
dfc23da06c * tassignmentnode.pass_typecheck: also allow "dynarray := []" in addition to "dynarray := nil"
git-svn-id: trunk@36098 -
2017-05-04 21:40:37 +00:00
svenbarth
b1c66dee9b + tarrayconstructornode: add utility method has_range_node to check whether the array constructor node tree contains any range node
git-svn-id: trunk@36091 -
2017-05-04 21:16:47 +00:00
svenbarth
4a2266ac44 * tarrayconstructornode.pass_typecheck: set elementdef of the arraydef only after the arrayoptions are changed
git-svn-id: trunk@36090 -
2017-05-04 21:03:33 +00:00
nickysn
012153201a * moved the conversion of "x:=x op k" to inline nodes to a separate optimization
pass, so that it can be done after other optimizations, such as constant
  propagation

git-svn-id: trunk@35961 -
2017-04-26 22:44:01 +00:00
nickysn
5bb77905cd * fixed the missing warnings for unused variables at -O3, when one of the new
modify-in-place inline nodes are used

git-svn-id: trunk@35773 -
2017-04-11 14:25:57 +00:00
nickysn
4697a653a4 + perform the "i:=i +/-/and/or/xor k" optimization when there are two typecasts
inserted. This makes the optimization work for more integer types.

git-svn-id: trunk@35772 -
2017-04-11 11:25:40 +00:00
nickysn
d8406c4227 + perform the "i:=-i" / "i:=not i" optimization even when there are typecasts
inserted; this makes the optimization work for all integer types

git-svn-id: trunk@35763 -
2017-04-10 14:06:19 +00:00
nickysn
98be270adb * fixed a memory leak in the "i:=-i" / "i:=not i" optimization
git-svn-id: trunk@35762 -
2017-04-10 13:27:29 +00:00
nickysn
e78f0aafcd - remove whitespace, was inserted by accident
git-svn-id: trunk@35760 -
2017-04-10 11:55:26 +00:00
nickysn
3616627d0b * at -O3 optimization level, convert "i:=not i" and "i:=-i" to the new
in_not_assign_x and in_neg_assign_x inline nodes, which may generate better
  code on certain cpus (such as x86)

git-svn-id: trunk@35758 -
2017-04-09 14:55:15 +00:00
nickysn
f29492bdea * at -O3 level, convert i:=i and/or/xor k to the new in_[and/or/xor]_assign_x_y
inline nodes, which should generate better code for certain CPU targets,
  including x86. Note that the optimization isn't applied yet for all integer
  types (those that have extra implicit typecasts, inserted by the compiler,
  aren't handled yet).

git-svn-id: trunk@35685 -
2017-03-29 15:20:57 +00:00
florian
b55cb246da * do +/-/pred/succ to inc/dec optimizations only at an appropriate optimziation level
git-svn-id: trunk@35569 -
2017-03-12 07:49:37 +00:00
pierre
a7c7319352 Avoid use of getcopy method for i:=i+/i k optimization
git-svn-id: trunk@35568 -
2017-03-11 21:41:51 +00:00
florian
a679cd4e37 * copy loadnodeflags in tloadnode.dogetcopy as well
git-svn-id: trunk@35558 -
2017-03-10 20:44:20 +00:00
nickysn
bd48a71a98 * replace i:=i+k/i:=k+i/i:=i-k (integer only, for now; later we can also do this for pointers too) by inc/dec(i,k)
git-svn-id: trunk@35550 -
2017-03-09 15:35:27 +00:00
florian
a27b07b342 + more restrictions on pred/succ to dec/inc optimization
o check if the argument can be used as a call by reference parameter
  o check if the argument has no side-effects
+ tests

git-svn-id: trunk@34816 -
2016-11-06 16:36:02 +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
florian
509f6839fe + replace i:=succ/pred(i) by inc/dec(i)
git-svn-id: trunk@34791 -
2016-11-05 23:05:48 +00:00
Jonas Maebe
233622157c * don't attempt to load the VMT of a niln when taking the address of a
class method (mantis #30706)

git-svn-id: trunk@34641 -
2016-10-07 16:41:32 +00:00
Jonas Maebe
2d051f89f7 * don't increase refcounts for variants assigned to (ti_)const nodes, fixes
memory leak after r34288 and should have been done as part of r34287
    (mantis #30546)

git-svn-id: trunk@34440 -
2016-09-06 21:28:34 +00:00
Jonas Maebe
f64556c125 * when taking the address of a class method via an instance, create a procvar
with the VMT of the instance as self instead of the self instance pointer
    (mantis #29491)

git-svn-id: trunk@34395 -
2016-08-30 07:25:16 +00:00
Jonas Maebe
18580d3069 * when assigning a value to a temp marked as ti_const, do not immediately
release the source location in case it was also a temp. Reason: we
    don't increase reference counts when assigning to a ti_const (they are
    like const parameters), so the original value must stay alive until
    the ti_const temp is freed
   o free the original data in the ttempdelete node for the ti_const temp
   o don't increase reference counts when assigning composite types to
     ti_const temps either

git-svn-id: trunk@34287 -
2016-08-12 13:35:51 +00:00
Jonas Maebe
9914f02faa * always set the resultdef for variant array constructors correctly, so we
don't need to pull all kinds of special tricks pass_generate_code

git-svn-id: trunk@32233 -
2015-11-04 20:46:10 +00:00
Jonas Maebe
95927665ce - removed variable notification support, it's not used and superceded by
DFA

git-svn-id: trunk@31916 -
2015-10-02 17:00:25 +00:00
florian
63f828d54e * take care of nf_internal when doing range checking and inserting type conversions in tassignmentnode.pass_typecheck
git-svn-id: trunk@31473 -
2015-08-31 20:03:54 +00:00
Jonas Maebe
f402b0d7df * changed getpointerdef() into a tpointerdef.getreusable() class method
o allows removing the ugly x86 hacks

git-svn-id: trunk@31144 -
2015-06-22 08:17:49 +00:00
Jonas Maebe
dd3d0ae5bc * set the type of the hidden $vmt parameter to the correct classrefdef and
adjust the parameter comparison code to ignore types of $vmt parameters
    when comparing (previously they were all voidpointer and hence also
    equal)

git-svn-id: trunk@30955 -
2015-05-31 16:51:02 +00:00
Jonas Maebe
822b943d08 - removed most special handling of self (the self parameter has had the
correct type since quite a while)
   o exceptions:
    o objects/records (self is a "var" parameter there, and sometimes
      we want to load it as a pointer to an object instead
    o Objective-C class methods, where self has to be id (to have a signature
      compatible with what Objective-C compilers generate), but when loading
      it we want a classrefdef of the current class for type check and
      method resolving

git-svn-id: trunk@30949 -
2015-05-31 16:50:44 +00:00
Jonas Maebe
5bb89cc2f0 * keep track of the reason why a loadparentfpnode has been created: to
load a value from a nested context, or to pass a context to a nested
    routine. In case a target uses both the stack and frame pointer, this
    difference can matter.

git-svn-id: trunk@29937 -
2015-02-23 22:53:59 +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
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
florian
541d67771b * keep managed types in registers if possible. Under certain circumstances (if they don't require init/final code,
e.g. being a const parameter or immutable temp. values), managed types like dyn. arrays, new string types and interfaces can be kept in registers.

git-svn-id: trunk@24953 -
2013-06-23 15:16:30 +00:00
sergei
4e873d0561 + Determine early (before pass 2) whether managed parameters/locals/temps will cause the procedure to reference RTTI labels and, therefore, need GOT.
+ trttinode also sets pi_needs_got flag.

git-svn-id: trunk@24767 -
2013-06-02 13:09:47 +00:00
Jonas Maebe
5ea03973d3 * reject assignments to vecn[rangen] (mantis #22941)
git-svn-id: trunk@22434 -
2012-09-21 22:42:30 +00:00
florian
ca5fabda6d * cleanup some unused units from uses clauses
git-svn-id: trunk@22433 -
2012-09-21 18:53:46 +00:00
florian
e18a9cccaa * fix expectlocs for method pointers
git-svn-id: trunk@22342 -
2012-09-06 15:12:02 +00:00
Jonas Maebe
b1d00b66ac * fixed internalerror after invalid type node in subscript node
(mantis #22395)

git-svn-id: trunk@21917 -
2012-07-15 18:17:29 +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