Commit Graph

670 Commits

Author SHA1 Message Date
Jonas Maebe
cb7730a423 * fixed execution order of implicit finalization and class destructors: first
the latter, then the former

git-svn-id: trunk@38716 -
2018-04-08 15:41:00 +00:00
florian
bd27b7635b * also in case of constref make_not_regable with ra_addr_taken must be called, later on in pass_1 this happens anyways
* for in loops can generate temp. refs as loop counter, so when checking of the address of the for counter is taken, we have to check for a load node

git-svn-id: trunk@38692 -
2018-04-05 20:09:40 +00:00
florian
42d6e81c33 * made message about subroutines not being inlined a note instead of a hint, see also #33515
git-svn-id: trunk@38690 -
2018-04-05 09:51:25 +00:00
florian
c46cbc8411 * do not issue a hint of compiler procs are not inlined, resolves #33515
git-svn-id: trunk@38675 -
2018-04-03 21:39:47 +00:00
nickysn
3318703ece * moved nf_typedaddr to addrnodeflags (anf_typedaddr)
git-svn-id: trunk@38671 -
2018-04-03 16:41:01 +00:00
florian
3e7af376fe * fix issue #32539 and #20551 by some ugly hack
git-svn-id: trunk@38531 -
2018-03-15 20:37:50 +00:00
florian
5e200cad89 * write correct proc name when giving a hint that a procedure is not inlined.
git-svn-id: trunk@38480 -
2018-03-10 10:39:10 +00:00
florian
73aef1402b + compiler writes a hint if a subroutine marked as inline cannot be/is not inlined, resolves #31717
+ test

git-svn-id: trunk@38330 -
2018-02-24 14:35:12 +00:00
Jonas Maebe
53bef8d202 * fixed calculation of high parameter for arrays with non-integer bounds
(mantis #32645)

git-svn-id: trunk@37928 -
2018-01-07 13:01:14 +00:00
svenbarth
239d0704ca + add support for type helpers to also extend interface types
git-svn-id: trunk@37023 -
2017-08-21 20:49:20 +00:00
florian
54b5112284 * real constants should be propagated during inline expanding
git-svn-id: trunk@36277 -
2017-05-21 08:34:47 +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
svenbarth
9fc420b546 - remove unused variable
git-svn-id: trunk@36157 -
2017-05-08 19:54:45 +00:00
svenbarth
1aa80f77cb - remove no longer needed global variable allow_array_constructor
git-svn-id: trunk@36103 -
2017-05-04 21:58:14 +00:00
Jonas Maebe
1adde89621 * copy tcallnode.right after copying the callinitblock, as right can be a
temprefnode referring to a temp from the init block (mantis #31421)

git-svn-id: trunk@35478 -
2017-02-24 19:57:40 +00:00
Jonas Maebe
7a57161b6d * in x:=f(..), we only checked for aliasing between x and any parameters of
f(..) before using x directly as function result for f(..) (instead of a
    temp) in case the function result of temp is passed via a hiddel
    call-by-reference parameter. After all, if the result is returned by
    value, then any changes to the function result inside the callee code
    won't affect whatever we will assign the result to until the callee
    has returned. However, this is not true in case of inlining: then
    the replaced function result node will be substituted directly in the
    inlined code -> also check for aliasing in that case.
   o fixes test/toperator5.pp on x86-64

git-svn-id: trunk@34893 -
2016-11-13 16:06:35 +00:00
florian
9bff3ac624 * copy also pushedparasize when copying call nodes, resolves #30923
git-svn-id: trunk@34885 -
2016-11-13 14:46:55 +00:00
florian
cfd38388ca * formatting so lazarus can handle it
git-svn-id: trunk@34737 -
2016-10-16 19:53:12 +00:00
florian
9c81e90e08 + extension to iso mode: reset/rewrite can take a file name as a second parameter
git-svn-id: trunk@34726 -
2016-10-16 07:55:08 +00:00
nickysn
657685a8b6 * use sizesinttype instead of ptrsinttype for the index and high parameter of
open arrays/dynarrays/string-like char arrays, etc.

git-svn-id: trunk@34665 -
2016-10-08 13:56:24 +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
2f41434284 * fix crash while compiling webtbf/tw14849
git-svn-id: trunk@34454 -
2016-09-08 14:19:02 +00:00
Jonas Maebe
1e506ce1d5 * call beforedestruction if an exception happens in afterconstruction
(mantis #30570)

git-svn-id: trunk@34453 -
2016-09-08 14:18:59 +00:00
Jonas Maebe
388c047c8a - removed the code to check whether a parameter to an inline routine is
also the by-reference function result of a call node, now that this is
    properly checked in the general case (these parameters/function results
    are temp nodes in case of inlined calls)

git-svn-id: trunk@34446 -
2016-09-07 19:37:38 +00:00
Jonas Maebe
5ffd06392d * don't optimize "x:=f(x)" whereby the function result of f() is passed
by reference in case x is a temp (mantis #30572)

git-svn-id: trunk@34445 -
2016-09-07 19:37:35 +00:00
svenbarth
d46c015eb1 * when inlining a function we need to import symbols that were loaded from another unit (or the same unit if the inlined function is from another unit and uses another function in the same unit)
git-svn-id: trunk@34380 -
2016-08-26 13:47:10 +00:00
Jonas Maebe
179c1ab328 * changed ttemp*node.tempinfo^.flags to a private field, and added setters
and getters for the ttemp*node classes instead
   o this will allow descendants to prevent certain flags from being added
     or removed. E.g. for LLVM, certain temps must never be put in registers
     because it cannot typecast a value in a register from a non-record/array
     type to an array type without forcing it to memory (so if that is done
     on an lvalue, the result will be written to the memory temp instead of
     to the register)

git-svn-id: trunk@34358 -
2016-08-21 14:23:09 +00:00
Jonas Maebe
8e0ee6599c * store parameters to inline routines that are already in a temp into a new
temp if the original temp was marked as ti_const, and the new parameter
    gets modified (mantis #30015)

git-svn-id: trunk@34289 -
2016-08-12 13:35:56 +00:00
Jonas Maebe
70b1b32722 * let inline parameter temps inherit the "const" property of const
parameters, so we don't apply reference counting to them (mantis #30323)

git-svn-id: trunk@34288 -
2016-08-12 13:35:53 +00:00
Jonas Maebe
a3ca471d32 * factored out all the tests for whether we need to put inline parameters
in temps (no functional changes)

git-svn-id: trunk@34286 -
2016-08-12 13:35:48 +00:00
Jonas Maebe
8d1e8ea203 * fixed indentation in nonlocalvars()
git-svn-id: trunk@34285 -
2016-08-12 13:35:45 +00:00
Jonas Maebe
94f90895a6 * separated call to wrapcomplexinlinepara() from the method that puts
parameters into temps in case it's required for correctness (so we
    can easily "early exit" on failure from the latter) (still no
    functional changes)

git-svn-id: trunk@34284 -
2016-08-12 13:35:42 +00:00
Jonas Maebe
07856870bc * factored out code to determine whether we should put an inline parameter
in a temp or not (no functional changes)

git-svn-id: trunk@34283 -
2016-08-12 13:35:39 +00:00
Jonas Maebe
a0efde8167 * automatically generate necessary indirect symbols when a new assembler
symbol is defined
   o removed all places where AB_INDIRECT symbols were explicitly generated
   o only generate AB_INDIRECT symbols for AT_DATA on systems_indirect_var_imports
   o for some symbols an indirect symbol is always required (because they are
     dereferenced by code in RTL units) -> use new AT_DATA_FORCEINDIRECT type

git-svn-id: trunk@34165 -
2016-07-20 20:53:03 +00:00
Jonas Maebe
1cb8c0d00c * specify the def of assembler level symbols defined via
tasmdata.DefineAsmSymbol() and all routines that call it
   o will be used to automatically generate AB_INDIRECT sybols when
     necessary

git-svn-id: trunk@34164 -
2016-07-20 20:52:59 +00:00
Jonas Maebe
adef9340e6 * converted metadata generation for variant dispatch to high level typed
constant builder

git-svn-id: trunk@34154 -
2016-07-19 14:30:39 +00:00
svenbarth
1bd43d9e37 Fix regressions.
pgenutil.pas:
  + new function maybe_add_pending_specialization() to add a pending specialization if it belongs to the current unit
  * generate_specialization_phase2: don't set up the owner as this leads to problems when using overloaded generic routines and don't add it to the pending list if it's a procdef
ncal.pas, tcallnode:
  * pass_typecheck: if we have a specialization then add it to the pending specializations once we know that we use it

git-svn-id: trunk@33843 -
2016-05-28 22:12:45 +00:00
Jonas Maebe
a29524800f * converted variant dispatch parameter construction from a hacked temp
to a plain record (gets rid of ttemprefnode.create_offset())

git-svn-id: trunk@33725 -
2016-05-20 20:51:41 +00:00
Jonas Maebe
2f81c14ee9 * also print funcretnode for callnodes
git-svn-id: trunk@33610 -
2016-05-02 08:23:08 +00:00
Jonas Maebe
130d9fee91 * don't take the address of element 0 of a dynamic array in
tcallparanode.copy_value_by_ref_para() if the array is empty
    (mantis #30007)

git-svn-id: trunk@33595 -
2016-05-01 12:35:09 +00:00
Jonas Maebe
44682f9f4d * ensure that if we create a temp for the funcretnode in a call node,
the funcretnode field keeps a reference to this temp even after we
    assign it to the call-by-reference return parameter if it is deleted
    by changing it into a normal temp (after which it will be freed when
    the result of the call node is used), because in that case getcopy
    for the callnode must copy this reference after copying the
    tempdeletenode in order to reset tempinfo^.hookoncopy (mantis #29891)

git-svn-id: trunk@33569 -
2016-04-28 20:33:12 +00:00
florian
e1d4d167b4 * hidden high parameter must be of type ptrsinttype, resolves issue #29204
git-svn-id: trunk@32745 -
2015-12-26 20:48:50 +00:00
Jonas Maebe
6fda08705b * moved the generation of th ehidden self parameter from pass_1 to
typecheckpass, because if it's for a nested routine on a platform
    that uses ncgnstmm/ncgnstld, all parentfpstructs (which are
    generated by the typecheckpass of the loadparentfpnode) must be
    generated before pass_1 starts

git-svn-id: trunk@32559 -
2015-12-01 07:54:08 +00:00
nickysn
e6d01eb3b5 * fixed a bug, which caused a function that returns a method pointer (or nested
procdef) to be called twice, when the result of this function is immediately
  called (i.e. not stored in a temp variable).

git-svn-id: trunk@32495 -
2015-11-22 17:21:08 +00:00
nickysn
e325cf1126 * fixed internconsts with two arguments. This allows compile time evaluation of ptr(const,const) on i8086 and i386.
git-svn-id: trunk@32116 -
2015-10-21 16:00: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
svenbarth
2e24d6dffb htypechk.pas:
* extend tcallcandidates by the ability to handle generic procdefs
pgenutil.pas:
  + export check_generic_constraints

git-svn-id: trunk@31760 -
2015-09-18 14:37:47 +00:00
Jonas Maebe
4d0c42ee23 - removed double calling of handlemanagedbyrefpara() for managed targets,
not sure why it didn't cause problems before

git-svn-id: trunk@31668 -
2015-09-13 19:06:29 +00:00
Jonas Maebe
6ffd8f0201 * finalize managed data passed to untyped "out" parameters after r31328
(mantis #2863)

git-svn-id: trunk@31624 -
2015-09-12 23:31:57 +00:00
Jonas Maebe
6be050b729 * fixed finalization of open array out parameters after r31328
git-svn-id: trunk@31623 -
2015-09-12 23:31:53 +00:00