Commit graph

7 commits

Author SHA1 Message Date
Martin
e711deac1b Refactor basic block construction and revise BB order 2016-08-06 22:04:41 +02:00
Martin
583aab933b Remove some more obsolete MSVC EH functions 2016-08-06 04:05:08 +02:00
Martin
fffe86cd2e Introduce try-catch scopes abstraction
Single intended functional change/fix: check ALL active catch blocks in
`isCatchingNonExceptions()`, not just the ones from the innermost
try-catch scope.

The catch bodies of a try-catch scope are now emitted in lexical order
(used to be reversed, last catch block first).
2016-08-06 04:05:08 +02:00
Martin
163ba88db9 Restrict nothrow invokes to try blocks catching non-Exceptions
A further optimization for try blocks only catching Exceptions.
2016-08-06 00:10:22 +02:00
Martin
f4a22f232b Propagate "nothrow" to LLVM IR (#1202)
Invoke nothrow callees only in try-blocks with at least 1 catch-block,
otherwise call them directly.

Errors thrown by nothrow callees can thus still be caught inside a
try-catch-statement (and this is apparently required for release builds
too).

Most calls will be direct calls though, and this small change will lead
to substantially less IR as we then skip the clean-ups after an Error.
Proper clean-up when unwinding after an Error seems not to be guaranteed
anyway. There are apparent RAII front-end optimizations for structs with
nothrow dtor - see PR #1656.
2016-08-06 00:10:19 +02:00
David Nadlinger
8fbb0ddbfa gen: Do not store body bb for {Case, Default}Statements in AST
Instead, put the mapping into the function-local codegen state,
where it belongs. As a side-effect of the refactoring, avoids
generating trivial "forwarding" BBs (see `nbb` in old code).

Avoids the issue from GitHub #1638 and similar altogether.
2016-08-03 21:07:18 +01:00
David Nadlinger
6cc93bc8ba gen/ir: Move function body codegen state into separate class
Previously, the transitory state only needed and valid during
generation of the LLVM IR for the function body was conflated
with the general codegen metadata for the function declaration
in IrFunction.

There is further potential for cleanup regarding the use of
gIR->func() and so on all over the code base, but this is out
of scope of this commit, which is only concerned with those
IrFunction members moved to FuncGenState.

GitHub: Fixes #1661.
2016-08-03 21:07:18 +01:00