Commit graph

26 commits

Author SHA1 Message Date
Martin Kinkelin
a2bd6a6c95 Add new CLI option -fno-exceptions (-nothrow for ldmd2)
Tested by `fail_compilation/test24084.d`.
2023-11-06 20:46:06 +01:00
Martin Kinkelin
69d636a15a Remove legacy LLCallBasePtr 2023-07-29 02:09:35 +02:00
Martin Kinkelin
9ce57807c0 Drop support for LLVM 9 and LLVM 10 2023-07-29 01:12:43 +02:00
Johan Engelen
ef0719f36b
Implement -femit-local-var-lifetime which adds local (stack) variable… (#4395)
Implement -femit-local-var-lifetime which adds local (stack) variable lifetime annotation to LLVM IR, which enables sharing stack space for variables whose lifetimes do not overlap.
Resolves issue #2227

This is not enabled by default yet, to prevent miscompilation due to bugs (should be enabled in future for optimization levels > 0, and when sanitizers are enabled).
2023-06-01 22:45:56 +00:00
Martin Kinkelin
7544a97475 Fix LLVM < 8 compatibility (no llvm::CallBase) 2020-09-26 01:04:50 +02:00
Martin Kinkelin
96b9cde428 Add support for LLVM 11
One major change is the removal of llvm::CallSite, which I've replaced
by llvm::CallBase*.
2020-09-26 01:04:50 +02:00
Martin Kinkelin
69269f3bd9 Refactor IRScope handling
Replace the stack of IRScopes, each with its own IRBuilder, by directly
tampering with the state of a single IRBuilder.

This seems like the most feasible way to account for a breaking change
in LLVM 11, disallowing IRBuilder from being copied.
2020-09-26 01:04:50 +02:00
Martin Kinkelin
c20ed9a639
-betterC: Don't use unsupported EH for handling clean-ups (#3482)
A reboot of #3480, fixing #3479 and related issues.
2020-06-29 21:03:10 +02:00
Martin Kinkelin
33cadfaca6 Remove ldc.arrayinit & streamline _d_array_slice_copy/_d_arraycast_len with upstream 2019-01-07 15:54:26 +01:00
Martin Kinkelin
4a23399236 Aim for consistent #includes (order + dir prefix)
I surely missed a few.
2018-10-20 16:19:46 +02:00
Martin Kinkelin
7776c4081b Upgrade frontend & libs to v2.083.0-beta.1 2018-10-20 16:19:46 +02:00
Johan Engelen
ee0881c353 Fix unused field warning. 2016-08-15 18:24:58 +02:00
Johan Engelen
5448b5f0ff Fix unused private field warning (SwitchCaseTargets::llFunc) and remove use of global gIR. 2016-08-15 18:24:58 +02:00
Martin
cac96fd0e9 Add some more comments for TryCatchFinallyScopes 2016-08-08 23:33:27 +02:00
Martin
963dd722dd Move EH ptr & selector and resume-unwind block to TryCatchFinallyScopes
To properly encapsulate landing pad emission.
2016-08-08 22:43:01 +02:00
Martin
25b186ce2d TryCatchFinallyScopes: Encapsulate unresolved gotos properly 2016-08-08 22:15:23 +02:00
Martin
7d15ab9ffc Reduce ScopeStack to JumpTargets
Add some comments after this more or less clean separation, and move
callOrInvoke() to FuncGenState.
2016-08-07 21:29:47 +02:00
Martin
73652977e9 Move unresolved gotos from ScopeStack to TryCatchFinallyScopes 2016-08-07 20:32:20 +02:00
Martin
caf5397f6f Extend TryCatchScopes to TryCatchFinallyScopes 2016-08-07 18:45:59 +02:00
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