Commit graph

309 commits

Author SHA1 Message Date
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
Martin
30b858781b -betterC: Use C assert function
Instead of druntime's _d_assert[_msg], _d_arraybounds and
_d_switch_error.

Tested by dmd-testsuite's runnable/cassert and compilable/betterCarray.
2017-10-25 00:38:05 +02:00
Martin
2616261fd2 Revise all LDC-specific errors/warnings/deprecs and insert backticks
For DMD's new syntax highlighting. I grepped in all .{h,cpp} files only.
2017-08-03 22:53:49 +02:00
Martin
45eacd0f32 Merge branch 'master' into merge-2.074
Conflicts:
	runtime/druntime
	runtime/phobos
2017-06-10 03:15:11 +02:00
Martin
383c2d3a59 Range-ify usages of front-end Arrays 2017-06-04 00:29:44 +02:00
kinke
151e83dc6b Fix C++ warnings (#2140) 2017-05-26 13:45:15 +02:00
Nicholas Wilson
ae6ff33fc1 [dcomptue] codegen (#2126)
* code generation

* simplify logic

* apply clang-format

* Undo completely inane choice by clang-format

* Guard the use of the command line args.
2017-05-24 08:55:32 +08:00
Martin
15e565e4f4 Support cast runtime variables as case expressions
Fixes compilable/b17111.d, see dlang/dmd@84fcc60.
2017-04-22 21:53:35 +02:00
Martin
e45bb9709d Don't declare IfStatement::match separately anymore
It's apparently rewritten to a CommaExp if-condition now:

`if (auto x = ...)` => `if (auto x = ..., x)`
2017-01-29 23:23:03 +01:00
Ivan Butygin
a26bfc1223 Refactor code to hide direct IrFunction->func usage and add convenient functions (#1911) 2017-01-17 22:40:32 +01:00
David Nadlinger
9f4cdb5168 Remove unnecessary semicolon [nfc] 2016-11-27 04:10:03 +00:00
LemonBoy
596fc82254 Implement -finstrument-functions.
Closes #1839.
2016-11-06 23:17:04 +01:00
Johan Engelen
8d84cc7f8c PGO: remove unnecessary instrumentationn BBs for switch statements in instrumentation-disabled functions. 2016-09-27 12:19:24 +02:00