Commit Graph

187 Commits

Author SHA1 Message Date
Jonas Maebe
3e98429418 Revert " * patch by J. Gareth Moreton: Nothing (NOP) node optimisation, resolves #38194"
This reverts commit c2ff85ac5b.

That change duplicates the logic of tstatementnode.simplify in
tblocknode.simpify in a very complex way, and in case of issue #39336 results
in adding a non-tstatementnode in a tblocknode, which is illegal. If
tstatementnode.simplify cannot catch all cases, then that one should
preferably be improved instead (and if not possible, we can look into
catching those edge cases in tblocknode.simplify rather than duplicating
everything).

Resolves issue #39336
2021-09-25 21:02:29 +02:00
florian
c2ff85ac5b * patch by J. Gareth Moreton: Nothing (NOP) node optimisation, resolves #38194
git-svn-id: trunk@49054 -
2021-03-25 21:51:52 +00:00
yury
64c586b86d * Removed/ifdefed lots of unused variables.
git-svn-id: trunk@48384 -
2021-01-24 12:24:01 +00:00
florian
85afaf5289 * patch by J. Gareth Moreton: Unitialized result variable fix on non-x86 debug builds, resolves #38371
git-svn-id: trunk@48221 -
2021-01-19 21:04:41 +00:00
florian
089e13396a * ensure that changed compiler options do not cause values
ending up in registers which cannot be hold in registers

git-svn-id: trunk@47415 -
2020-11-14 18:40:58 +00:00
florian
637976e83f * patch by Marģers to unify internal error numbers, resolves #37888
git-svn-id: trunk@47103 -
2020-10-13 19:59:01 +00:00
Jonas Maebe
a88288bab3 - reverted r46457, accidentally committed (breaks -Oooptcse)
git-svn-id: trunk@46459 -
2020-08-16 12:46:21 +00:00
Jonas Maebe
f26735fc77 * execute the tempinitcode whent the tempcreate node gets processed rather
than when the first temprefnode to it gets processed. Solves the issue
    the foreachnodestatic processes the tempinitcode when seeing the
    tempcreatenode and ignores it when seeing temprefnodes, even though
    it may actually be executed/generated for the temprefnode. It's
    impossible to easily process it for the "correct" temprefnode
    (since there may be multiple temprefnodes for the same tempcreatenode)
   o fixes tarray12 for Darwin/i386 and Linux/i386

git-svn-id: trunk@46457 -
2020-08-16 12:29:31 +00:00
florian
2500f8432f * ti_const must be part of tempinfostoreflags as well
+ more detailed output in ttempcreatenode.printnodedata

git-svn-id: trunk@46274 -
2020-08-05 21:15:31 +00:00
florian
62c417c8bf * temporarily fix #37034 by disabling the problematic optimization until the real cause is fixed
git-svn-id: trunk@45655 -
2020-06-15 19:57:39 +00:00
florian
84a1f614d9 * fix several double ;
git-svn-id: trunk@45488 -
2020-05-24 17:52:09 +00:00
florian
de805fddcd * properly force the result type after r45217
git-svn-id: trunk@45220 -
2020-05-02 12:33:46 +00:00
florian
e3870079b2 * remove tempref mess for simple inlined functions
git-svn-id: trunk@45217 -
2020-05-02 09:01:35 +00:00
florian
9dd25d836d * include ti_nofini in tempinfostoreflags
git-svn-id: trunk@44096 -
2020-02-02 14:30:46 +00:00
Jonas Maebe
ac1e0f96bd * replaced tentryfile.get/putsmall/normalset() with a common tget/putset
that expects an open array of byte, and use it for all sets
   o since all sets need to be typecasted to an array type of the appropriate
     size, we'll get a compilation error in case this needs to be done and
     that also tells us at the same time that the ppu version will need to
     be increased
  * enabled {$packset 1} for the compiler, as this is now safe with the above
    changes

git-svn-id: trunk@43407 -
2019-11-06 21:50:19 +00:00
Jonas Maebe
0f57327bff * maybereplacewithtemp/maybereplacewithtempref: also create a temp in case
of possible side effects

git-svn-id: trunk@42338 -
2019-07-07 21:33:36 +00:00
Jonas Maebe
0a91fcb44f * LLVM-specific support for bsr*/bsf*
git-svn-id: trunk@42309 -
2019-06-29 16:27:18 +00:00
pierre
243c967967 Commit of new debug feature implemented by J. Gareth Moreton
Allows compilation of compiler using -dDEBUG_NODE_XML
  which will generate a NAME-node-dump.xml file for each 
  unit, program or library compiled,
  containing a XML description of the nodes handled during
  compilation of the unit, program or library.

git-svn-id: trunk@42271 -
2019-06-22 14:08:47 +00:00
Jonas Maebe
281b3ad276 * fix case completeness and unreachable code warnings in compiler that would
be introduced by the next commit

git-svn-id: trunk@42046 -
2019-05-12 14:29:03 +00:00
yury
e5c2d13671 * Do not set pi_needs_got in current_procinfo.flags at the node level, since the GOT usage can only be estimated there. Instead set the pi_needs_got flag at places where the GOT register is accessed during the code generation. This eliminates generation of the unneeded initialization of the GOT register and fixes linker errors when the _GLOBAL_OFFSET_TABLE_ symbol is referenced but no actual GOT references are present.
git-svn-id: trunk@41460 -
2019-02-25 13:35:40 +00:00
Jonas Maebe
ea69a5b372 * finalizetemps nodes should never be considered equal and have side effects
git-svn-id: trunk@40348 -
2018-11-18 11:07:28 +00:00
Jonas Maebe
3b9f5a5e96 * moved finalization of code generator temps to a node, so it can be getcopy'd
(needed for LLVM, where we need two copies of the finally code: one in case
     an exception occurs, and one in case none is raised)
   o also first finalize parameters and only then code generator temps, since
     in theory the former could create more of the latter

git-svn-id: trunk@40345 -
2018-11-17 22:38:36 +00:00
svenbarth
116230f759 * forgot to commit extension to tspecializenode
git-svn-id: trunk@39788 -
2018-09-21 15:17:52 +00:00
florian
800ce23499 * fixed some issues to get correct values of section_count, works better than before but it is still not perfect for unknown reasons
git-svn-id: trunk@39750 -
2018-09-12 20:33:18 +00:00
svenbarth
0ba14c7ad8 * fix memory leak when freeing a temp delete node: also call the inherited destructor so that e.g. tnode.optinfo is freed.
git-svn-id: trunk@39558 -
2018-08-03 20:24:05 +00:00
florian
1497b64804 * the temp. locations created by cse were not properly cleanup up, this patch fixes this
git-svn-id: trunk@38624 -
2018-03-25 15:55:34 +00:00
florian
b1dff29cbf * removed unused units
git-svn-id: trunk@36165 -
2017-05-09 19:53:14 +00:00
florian
ec45a92fb5 * more nodedata printing fixes, similiar to r35477
git-svn-id: trunk@35480 -
2017-02-25 15:41:39 +00:00
Jonas Maebe
b5fb9beec9 * fixed printing of nodedata to the screen
git-svn-id: trunk@35477 -
2017-02-24 19:57:36 +00:00
svenbarth
c6bfb0064f * keep track of the sections that are created in the asmlists
git-svn-id: trunk@35408 -
2017-02-10 14:38:53 +00:00
florian
82e6e1eb34 + tempinfo flag ti_no_final_regsync which prevents that the final reg. sync. is emitted
git-svn-id: trunk@34787 -
2016-11-05 23:05:41 +00:00
florian
502e48541c * properly copy flags of tempinfo
+ write flags of tempinfo in ttemprefnode.printnodedata

git-svn-id: trunk@34738 -
2016-10-16 19:53:14 +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
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
46166c89cb - removed no longer used and unsafe ttemprefnode.create_offset()
functionality

git-svn-id: trunk@33733 -
2016-05-21 10:28:28 +00:00
svenbarth
4f5fc66298 + new parser-only node class to handle Delphi-mode inline specializations
git-svn-id: trunk@31588 -
2015-09-11 12:58:25 +00:00
sergei
657ac78304 * Improved handling of registers used in assembler blocks. Assembler nodes no longer have lists of used registers attached to them. Instead, each specified register creates an allocation/deallocation pair and an additional tai_regalloc.markused item directly in the asmlist. This way, register lists are no longer limited to integer registers, and parsing no longer depends on paramanager to know which registers are volatile.
If assembler block has no modified register list, it is still handled in pass2, by allocating all volatile registers (not only the integer ones as before).

git-svn-id: trunk@30011 -
2015-02-25 21:53:15 +00:00
florian
7b7aa8d542 * remove statements with only a nothing node when they are the only children of a block
git-svn-id: trunk@29628 -
2015-02-04 21:19:40 +00:00
Jonas Maebe
9e29fd424d * changed the "laststatement" parameter of internalstatements() from "var"
to "out"

git-svn-id: trunk@28228 -
2014-07-18 09:09:16 +00:00
florian
3e4198ea45 * take care of dyn. arrays in cse
git-svn-id: trunk@26740 -
2014-02-08 21:47:46 +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
florian
3cb747f4a7 * mark the node which is the entry of the user code with a flag
* check for uninitialized variables at the node which is marked as the start of the user code

git-svn-id: trunk@26014 -
2013-11-10 20:20: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
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
florian
7155808570 + ttempcreatenode.printnodedata writes tempinitcode node
git-svn-id: trunk@24116 -
2013-04-01 19:52:39 +00:00
Jonas Maebe
b50d0aa3d0 * only don't pre-finalize funcret temps that are passed by reference to the
called function, fixes webtbs/tw3742.pp after r21955 (looked at wrong
    testsuite results :/ )

git-svn-id: trunk@21963 -
2012-07-23 23:55:00 +00:00
florian
c62a2c8bb5 + write temptype when printing tempdelete nodes
git-svn-id: trunk@21752 -
2012-07-01 18:46:13 +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
florian
111d05c68f o patch by Alexander Shishkin, resolves #20409
* eliminate warnings in compiler (i386 & i368->x86_64) and minor refactorings
    - comment out unused vars and types
    - comment out unneeded comparisons (Longword <=> 0)
    - suppress some "comparison always true|false" warnings
    - tweak visiblity sections

git-svn-id: trunk@19385 -
2011-10-05 20:11:09 +00:00