Commit Graph

243 Commits

Author SHA1 Message Date
Yuriy Sydorov
b78761efd3 * Removed obsolete OLDREGVARS ifdefs. 2021-11-02 17:08:08 +02:00
Yuriy Sydorov
e04df465ef * The label which is generated by traisenode is not a jump target. Mark
this label as nf_internal, which means the label does not impact the
  code flow. This leads to a much better register allocation.
2021-11-02 16:46:09 +02:00
nickysn
940738a3a1 * synchronized with trunk
git-svn-id: branches/wasm@48846 -
2021-03-01 13:21:24 +00:00
florian
fe57cd3536 * fix LLVM after r48828
* global gotos really use the return type of fpc_setjmp to test where we come from

git-svn-id: trunk@48835 -
2021-02-27 22:07:58 +00:00
florian
4c2e0b9ff0 * for setjmp based exception handling, get the type of the exception reason from the setjmp result
git-svn-id: trunk@48828 -
2021-02-27 16:47:36 +00:00
nickysn
91e9558f5b * synchronized with trunk
git-svn-id: branches/wasm@47766 -
2020-12-12 23:20:33 +00:00
yury
8b7c5666a2 * Renamed fc_block_with_exit to fc_no_direct_exit to expand its usage.
* Set fc_no_direct_exit in case when a routine has an additional implicit exit code, such as calling FreeInstance in the destructor.

git-svn-id: trunk@47749 -
2020-12-10 17:38:37 +00:00
nickysn
dc5b78d5f0 * synchronized with trunk
git-svn-id: branches/wasm@47716 -
2020-12-08 06:57:57 +00:00
yury
d72566169e * The code generator of the exit statement must set the fc_gotolabel flag in flowcontrol for inlined routines/code blocks. It fixes the incorrect assumption that such exit statements terminate the main routine.
git-svn-id: trunk@47683 -
2020-12-04 12:33:47 +00:00
nickysn
62cb7c2d12 * synchronized with trunk
git-svn-id: branches/wasm@46214 -
2020-08-03 21:15:39 +00:00
nickysn
95bed362ba [PATCH 02/83] updating common FPC sources for WASM target
From 7705a37c1f11687c3d465c4645357d6679150996 Mon Sep 17 00:00:00 2001
From: Dmitry Boyarintsev <skalogryz.lists@gmail.com>
Date: Wed, 28 Aug 2019 17:01:14 -0400

git-svn-id: branches/wasm@45879 -
2020-07-29 16:01:48 +00:00
florian
fc44c2d4c9 + insert alignments after break/goto/exit/continue jmp instructions, if it is
superfluous, the assembler optimizer will take care of it

git-svn-id: trunk@44007 -
2020-01-20 21:56:39 +00:00
Jonas Maebe
1e3f72403e * renamed getintparaloc to getcgtempparaloc
o it can be used for more than integer parameters

git-svn-id: trunk@43781 -
2019-12-24 22:12:25 +00:00
Jonas Maebe
e775ecdc43 * cleaned up safecall support: use a hidden localvarsym instead of result
register hacking
   o this also allowed fixing/adding safecall support for LLVM

git-svn-id: trunk@43578 -
2019-11-24 20:23:22 +00:00
Jonas Maebe
d0be4f11b8 * "on" nodes inherit the exception catching state from the "try"
git-svn-id: branches/debug_eh@42194 -
2019-06-08 20:17:01 +00:00
Jonas Maebe
e720a1f306 * moved tcgexceptionstatehandler to a new cgexcept unit
* fixed llvm cycle by overriding additional eh-related tcgprocinfo methods

git-svn-id: branches/debug_eh@41519 -
2019-02-27 21:13:45 +00:00
florian
12a53ad454 * reduce number of (redundant) landing pads
* reduce number of (redundant) action lists

git-svn-id: branches/debug_eh@41470 -
2019-02-25 20:49:18 +00:00
florian
82e1ce8e4a * if a subroutine has an lsda record, the actions have to cover all code
* cleanup

git-svn-id: branches/debug_eh@41453 -
2019-02-24 20:04:43 +00:00
florian
3c61bb9c5d * some safecall issues fixed
git-svn-id: branches/debug_eh@41406 -
2019-02-20 21:53:27 +00:00
florian
4b66dc0a94 * few fixes to psabieh, mainly related to nested exception handling
git-svn-id: branches/debug_eh@41385 -
2019-02-19 22:20:16 +00:00
florian
9514bd9162 * refactored psabieh handling, most code is now in psabiehpi
git-svn-id: branches/debug_eh@41367 -
2019-02-17 21:20:40 +00:00
florian
5587c878e6 * small fixes for pseabieh
+ raise node support for pseabieh

git-svn-id: branches/debug_eh@41355 -
2019-02-17 20:12:51 +00:00
florian
a3594574ca * in case of finally nodes of implicit frames with a third=nil, exit has to load 0 into the exception value, so an explicit exit call is not handled as an exception
git-svn-id: branches/debug_eh@41318 -
2019-02-14 22:30:40 +00:00
florian
6b0c2a45f5 * compilation fixes
git-svn-id: branches/debug_eh@41290 -
2019-02-10 19:33:14 +00:00
florian
65aebd22b0 + initial implementation of dwarf/eh_frame based exception handling for i386-linux, basic stuff works, open todos
* nested exception handling statments in one procedure need to be fixed
  * clean up, finally factor out tcgprocinfo from psub at least
  * extensive testing

git-svn-id: branches/debug_eh@41289 -
2019-02-10 18:07:33 +00:00
Jonas Maebe
9f928b2805 * fix exception handling code generator memory leaks
git-svn-id: branches/debug_eh@40734 -
2019-01-01 16:24:42 +00:00
Jonas Maebe
11511e13d5 * synchronised with trunk till r40723
git-svn-id: branches/debug_eh@40724 -
2019-01-01 13:22:17 +00:00
Jonas Maebe
dee1056546 * fixed wrong change of jumpalignmax from 10 to 16 in previous commit
o renamed jumpalignmax and coalescealignmax to jumpalignskipmax/
     coalescealignskipmax to better reflex the meaning of these setting
     (and the difference in meaning to e.g. constalignmax)

git-svn-id: trunk@40682 -
2018-12-28 13:22:50 +00:00
Jonas Maebe
df0a126064 * abstracted rest of the generic exception handling code through the
texceptionstatehandler class + llvm overrides
  + added FPC_DummyPotentialRaise routine that gets called at the begin and end
    of try-blocks to be able to catch hardware exceptions to a limited extent
    with LLVM

git-svn-id: branches/debug_eh@40418 -
2018-11-29 21:31:40 +00:00
Jonas Maebe
01ddde2283 * refactored jumping out of exception frames so it can be overridden by descendents
git-svn-id: branches/debug_eh@40406 -
2018-11-29 21:31:02 +00:00
florian
cefb38b605 * better alignment of while loop heads
git-svn-id: trunk@40340 -
2018-11-17 15:08:24 +00:00
florian
a092da723a + new fields for more precise control of alignment
+ support of new alignment control values for GNU AS writer
+ support of new alignment control values for binary writer
* better alignment settings on i386-win32
* improved inserted align directives for if nodes

git-svn-id: trunk@40159 -
2018-11-01 20:49:17 +00:00
Jonas Maebe
0cd85d73e4 * ttryfinallynode now inherits from tbinarynode instead of tloopnode, as its
t1 field was always set to tnothingnode

git-svn-id: trunk@40142 -
2018-11-01 13:19:33 +00:00
florian
f08d3fdf8f * moved execution weight calculation into a separate pass, so the info is available already available before the code generation pass if needed
git-svn-id: trunk@38717 -
2018-04-08 20:51:27 +00:00
florian
b1dff29cbf * removed unused units
git-svn-id: trunk@36165 -
2017-05-09 19:53:14 +00:00
yury
5405a4727a * Removed unused vars.
git-svn-id: trunk@35535 -
2017-03-07 08:56:07 +00:00
florian
5aa32a1bbe * align more jump targets
git-svn-id: trunk@35223 -
2017-01-03 16:43:24 +00:00
florian
2e16628db1 * warning fixed
git-svn-id: trunk@35168 -
2016-12-18 20:27:13 +00:00
Jonas Maebe
746de569d5 - removed unused local variable
git-svn-id: trunk@35159 -
2016-12-18 13:57:36 +00:00
Jonas Maebe
b14c037533 * record in the flowcontrol flags whether we are currently in a block whose
exceptions are caught in the current routine (fc_catching_exceptions),
    so that for LLVM we will be able to use "invoke" instead of "call" in that
    case

git-svn-id: trunk@35158 -
2016-12-18 13:57:33 +00:00
Jonas Maebe
6a1c4f9b75 * replaced cg.a_label/a_jmp_always with hlcg.* calls (only for consistency,
does not change anything in practice)

git-svn-id: trunk@35157 -
2016-12-18 13:57:29 +00:00
Jonas Maebe
3ae1f6664a * extracted exception state handling helpers into a utility class so
they can be overridden

git-svn-id: trunk@35156 -
2016-12-18 13:57:25 +00:00
Jonas Maebe
c0f4e4db34 * group emitting a label of a try-block and restoring the control flow flags
in a single routine, so that both happen at the same time (needed for LLVM
    where inside a try-block all calls need to be performed using "invoke"
    and refer to the current try-block/catching label)

git-svn-id: trunk@35144 -
2016-12-16 22:41:30 +00:00
Jonas Maebe
a1c0d1a1ff * moved exception handling helpers from ncgutil to ncgflw as they are only
used there (could be turned into protected methods if they are ever needed
    by child classes)

git-svn-id: trunk@35143 -
2016-12-16 22:41:28 +00:00
Jonas Maebe
d6ccd54da5 - removed unused doexceptlabel
git-svn-id: trunk@35139 -
2016-12-16 22:38:07 +00:00
Jonas Maebe
a25ebbba3e + added volatility information to all memory references
o separate information for reading and writing, because e.g. in a
     try-block, only the writes to local variables and parameters are
     volatile (they have to be committed immediately in case the next
     instruction causes an exception)
   o for now, only references to absolute memory addresses are marked
     as volatile
   o the volatily information is (should be) properly maintained throughout
     all code generators for all archictures with this patch
   o no optimizers or other compiler infrastructure uses the volatility
     information yet
   o this functionality is not (yet) exposed at the language level, it
     is only for internal code generator use right now

git-svn-id: trunk@34996 -
2016-11-27 18:17:37 +00:00
Jonas Maebe
48ef33a8b3 * fixed interprocedural gotos for llvm
o ensure that the label's local "jumpbuf" variable gets moved to the
     parentfpstruct soon enough
   o don't generate global symbols for interprocedural labels: they're not
     necessary if they are only used via setjmp/longjmp (all references are
     local in that case), and if they are referenced via an assembler block
     then we'll have to handle them by passing a blockaddress() expression
     as parameter to that assembler block (which does not require a global
     symbol, but which is not yet implemented)

git-svn-id: trunk@34946 -
2016-11-21 07:39:13 +00:00
florian
834d58f54c * better execution weighting for while loops: the condition must be evaluated with an increased execution weight as well
* ensure that the weight is always increased

git-svn-id: trunk@34799 -
2016-11-05 23:06:01 +00:00
florian
0610187878 + transform for loop into equivalent while loop during pass 1 to simplify code generation
git-svn-id: trunk@34788 -
2016-11-05 23:05:43 +00:00
svenbarth
70fbe50bac * reference the extern assembler symbol of the VMT when catching an exception if it's from another unit
git-svn-id: trunk@34336 -
2016-08-19 12:41:06 +00:00