Commit graph

321 commits

Author SHA1 Message Date
Martin Kinkelin
7fa7f35b2a Skip some more superfluous bitcasts NOT using the DtoBitCast() helper 2024-05-20 17:29:55 +02:00
Martin Kinkelin
9041c0bf67 Adapt to free functions in dmd C++ namespace now 2024-03-03 19:14:00 +01:00
Johan Engelen
1d4c2cfc5e
Fix if-statement elision on constant true/false condition, for condit… (#4559)
Fix if-statement elision on constant true/false condition, for condition expressions that are more complex than a simple integer.

Resolves issue #4556
2024-01-10 23:21:22 +00:00
Martin Kinkelin
d6d79187e6 Merge fix: Adapt to removed error/warning members 2023-11-06 01:10:16 +01:00
Martin Kinkelin
ae52da1bfa Adapt to Loc::linnum and Loc::charnum now being functions 2023-08-26 15:56:02 +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
Nicholas Wilson
906037988f
Move abi*.* to abi/ (#4192) 2022-09-21 13:16:04 +00:00
Nicholas Wilson
78e68b5149
Make DComputeTarget::ID an enum class (#4172) 2022-09-15 20:00:52 +08:00
Nicholas Wilson
07d2942ed8
Use typed gep in statements.cpp (#4101) 2022-09-03 10:45:21 +08:00
Nicholas Wilson
0587ba985f
Use typed loads in gen/statements.cpp (#4056) 2022-08-28 13:51:32 +08:00
Martin Kinkelin
be20833b22 codegen: Support {Not,Logical,Identity,Cmp}Exp with non-bool type (for importC AST)
Fixing failing LDC assertions.
2022-04-30 23:46:47 +02:00
Martin Kinkelin
b7b8e59043 Upgrade frontend & libs to v2.100.0-beta.1+ (dlang/dmd@c0cff59c79) 2022-04-26 23:01:13 +02:00
Martin Kinkelin
7b6810b01b Fix LLVM 13 deprecation messages during build 2022-02-26 19:15:46 +01:00
Martin Kinkelin
5c9f1e5fd6 Handle new throw expressions 2022-02-19 19:28:08 +01:00
Martin Kinkelin
4bd8dcd91b Adapt to new TOK and EXP enum classes 2022-02-16 20:52:07 +01:00
Martin Kinkelin
e8997308f9 Always specify a pointee type for llvm::ConstantExpr::getGetElementPtr()
As required by LLVM 13.
2021-10-11 19:21:37 +02:00
Martin Kinkelin
598b615e77 Fix switch case with const runtime variable assuming a *constant* initializer
As the initializer might just as well not be computable at compile-time.
Fixes such a case in `bug6985()` in dmd-testsuite's
`compilable/interpret3.d`.
2021-09-08 17:56:23 +02:00
Martin Kinkelin
369cfd13ce Adapt to TY enum class 2021-09-07 16:51:19 +02:00
Martin Kinkelin
b1577e606f Support type noreturn in return statements codegen
Fixes runnable/testassert.d.
2021-06-01 15:13:57 +02:00
Martin Kinkelin
f453b686d7 Exclude assert(0) from lines coverage
A straight port of dlang/dmd#12264, fixing runnable/no_assertz_cov.d.
2021-05-31 22:52:18 +02:00
Martin Kinkelin
6f5730049b Merge remote-tracking branch 'origin/master' into merge-2.094
Conflicts:
	gen/tocall.cpp
	runtime/phobos
2020-09-30 19:46:43 +02:00
Martin Kinkelin
1d969cfcca Revise IRScope refactoring
LLVM already provides suited RAII helper types to restore the IRBuilder
state. [They sadly aren't movable, so I've had to wrap them in a
unique_ptr.]

While at it, also minimally revise debuginfo generation for functions.
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
f202c851ae Upgrade frontend & libs to v2.094.0-beta.1 2020-09-22 00:06:19 +02:00
Johan Engelen
e628a0a7d0
Add missing UnrolledLoopStatement to PGO region count instrumentation and calculation. Also add extra precautions to catch this problem earlier in the future. (#3524)
Fixes issue #3375
2020-07-30 20:59:09 +02:00
Johan Engelen
fd9d23139e
Fix PGO instrumentation crash for final switch(enum) statements together with -release. (#3512)
This change includes checking of whether there is a default statement when using `case <variable>:` (LLVM IR switch instruction cannot be used), although that is currently not allowed in the D language. Therefore there is no testcase that covers that.

See GH issue #3375
2020-07-22 11:42:02 +02:00
Martin Kinkelin
f70feb1354
Fix return statements: Don't access memory from destructed temporaries (#3426)
Our version of https://issues.dlang.org/show_bug.cgi?id=20809.
2020-05-09 21:26:26 +02:00
Martin Kinkelin
684acd6a3f Improve check for multiple entry point definitions
* Extend the error message, closely following DMD. Tested by
  fail_compilation/fail5634.d.
* Check across all compiled modules, not on a per-object-file basis.
  That's what DMD does too.
* Apply the implicit `return 0` / void -> int return type promotion to
  all D/C main functions, not just the first one. This prevents some
  potential follow-up crashes.
2020-04-28 01:37:49 +02:00
Martin Kinkelin
ebd359273d druntime: Switch from __asm to GCC-style asm syntax 2020-02-25 01:19:25 +01:00
Martin Kinkelin
298898a0a7 Add support for GCC/GDC-style inline asm syntax 2020-02-15 23:58:13 +01:00
Martin Kinkelin
26673c174f
Refactoring: Replace Expression::op check followed by static cast to Expression::is<ExpressionType> (#3141)
This may negatively impact performance, as the (final, i.e.,
non-virtual) Expression::is... family is implemented in D and not
available inline in the C++ headers.
2020-01-15 12:54:05 +01:00
Martin Kinkelin
4ac7f0554b Adapt to frontend refactorings 2019-12-22 16:29:45 +01:00
Stefanos Baziotis
94743b90fc Disable dead code when an if/else if condition is constant (#3134) 2019-11-05 18:33:25 +01:00
Martin Kinkelin
8fd69da8fb Make all DtoGEP helpers use implicit inbounds
Single functional change: always emit inbounds when computing the base
pointer of a SliceExp.
2019-09-10 22:36:25 +02:00
Martin Kinkelin
8da4e6f9cf
Merge pull request #3093 from kinke/merge-2.087
Upgrade front-end & libs to v2.087.1+
2019-08-06 22:21:18 +02:00
Martin Kinkelin
1608105681
Fix ICE when returning a void expression (#3095)
Fixes #3094, a regression introduced in v1.16 due to AST changes.
2019-07-01 20:35:39 +02:00
Martin Kinkelin
e52199469f Upgrade front-end & libs to v2.087.0-beta.1 2019-06-21 15:39:45 +02:00
Martin Kinkelin
0dbd7ded60 Adapt to switch error lowering to object.__switch_error!()
The _d_switch_error function has been removed from druntime.
2019-04-23 22:41:44 +02:00
Martin Kinkelin
5e93ed0dfd Upgrade front-end & libs to v2.085.0-beta.1 2019-03-01 18:19:00 +01:00
Martin Kinkelin
6c19cfeae0 Port https://github.com/dlang/dmd/pull/8997 2018-12-09 01:19:51 +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
Elie Morisse
841146644b Debug info: emit llvm::DIModule and llvm::DIImportedEntity for modules and imports
Matches GDC's DWARF output and enables access to global and imported symbols from GDB.
2018-10-15 22:48:03 +02:00
Martin Kinkelin
e0611c3114 Adapt to now subtyped class AsmStatement 2018-08-18 00:33:48 +02:00
Martin
d8f60d2f5c Redirect access to object.d type declarations through gen/runtime
Not all type declarations yet (e.g., some TypeInfo subtypes are still
accessed directly), but those already wrapped as LazyType in the
gen/runtime.cpp module (with check and proper error msg in case object.d
doesn't contain a required declaration).
2018-04-04 19:59:10 +02:00
Martin
1b8a3b9d7d Adapt to frontend injecting implicit 'return 0' for betterC main
This fixes lit-test codegen/betterC_typeinfo.d.
2018-02-25 01:25:37 +01:00
Martin
197e65efde Merge branch 'master' into merge-2.078
Conflicts:
	driver/main.cpp
	gen/cl_helpers.h
	gen/declarations.cpp
	runtime/druntime
	tests/d2/dmd-testsuite
2018-01-20 11:20:17 +01:00
Martin
27deb2ff8c Get rid of obsolete gen/llvmcompat.h
Not needed anymore since C++11.
2018-01-12 20:20:47 +01:00
Martin
b83780538f Adapt to new string-switch lowering
Now all done in the front-end, no need for us to handle it manually
anymore. This also fixes tests/semantic/dcompute.d.
2018-01-07 01:43:12 +01:00
Martin
cfad799f48 Merge 2.078.0 front-end and stdlibs 2018-01-06 01:39:18 +01:00