Commit graph

150 commits

Author SHA1 Message Date
Nicholas Wilson
85b371e7bc
nested.cpp: Refactor loading the this pointer, use typed loads (#4052) 2022-08-28 10:12:05 +08:00
Nicholas Wilson
aea2033c19
Remove getPointeeType from DtoAlignedLoad (#4025) 2022-08-21 08:24:40 +08: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
143d7b3171 Fix compile & link errors against LLVM 14 2022-03-30 13:51:18 +02:00
Nicholas Wilson
4349388563
Prepare for LLVM15: Headers, attributes (#3936)
`llvm::AttrBuilder` was changed to require an LLVMContext in its constructor, and can no longer be copied.

declare `DEBIG_TYPE` after includes for the GC2Stack pass as `llvm/Support/GenericDomTreeConstruction.h `(included from `llvm/IR/Dominators.h` `#define`s and `#undef`s it.

`llvm::DIBuilder::createExpression` now takes an `ArrayRef<uint64_t>` instead of `int64_t`. EmitLocalVariable has similarly changed
2022-03-11 16:38:49 +01:00
Martin Kinkelin
c100c15ae0
Fix capturing NRVO variables (#3902)
Fixes #3883 by capturing NRVO vars by ref - unless the nested context
is a heap closure.
2022-01-21 03:41:03 +01:00
Martin Kinkelin
9858cfb01c Simplify dmd/ldcbindings.{d,h} 2021-09-17 03:49:28 +02:00
Martin Kinkelin
7aed600440 Adapt to changed TypeDelegate constructor signature 2021-09-07 16:51:19 +02:00
Martin Kinkelin
56b2902473
Fix DtoCreateNestedContextType() for -linkonce-templates (#3766)
Fixes #3690.
2021-06-21 21:37:03 +02:00
Martin Kinkelin
fe5a1776ac Merge remote-tracking branch 'origin/master' into merge-2.095 2021-01-06 23:58:20 +01:00
Martin Kinkelin
a9aafac862 Glue layer: Make all mutable Loc & params const 2020-12-13 15:01:19 +01:00
Martin Kinkelin
079858f3b2 Upgrade frontend & libs to early v2.095.0 (dlang/dmd@a4274b3c39) 2020-11-27 17:45:13 +01:00
Martin Kinkelin
1700e30c20
Traverse full chain of nested aggregates when resolving a nested variable (#3558)
Fixes #3556.
2020-10-10 19:34:06 +02:00
Martin Kinkelin
834f666ce5
Raise min LLVM version to 6.0 (#3493) 2020-07-13 20:42:50 +02:00
Martin Kinkelin
0c0102a9e4 Fix ICE for *captured* parameters *not* passed on the LLVM level
Their IrParameter isn't created as part of DtoDeclareFunction(). Before
being able to handle that later in defineParameters() (as part of
defining the function), DtoCreateNestedContextType() steps in and
creates an IrLocal if not already created.

1) Create an IrParameter in that case in DtoCreateNestedContextType().
2) Handle these new value-less (no LL param) IrParameters in
   defineParameters().
3) Fix the iOS AArch64 ABI, as apparently not all empty structs are
   ignored for parameter passing, but only POD ones.
   Also don't ignore anything passed by reference.
2020-05-22 14:58:29 +02:00
Martin Kinkelin
f4f80d32d7 Make IR type determination for captured lazy params TargetABI-agnostic
This fixes codegen/nested_lazy_gh2302.d for AArch64, which failed due to
the TargetABI rewriting the delegate (IR struct) to `[2 x i64]`.
2020-05-03 16:31:46 +02:00
Martin Kinkelin
4ac7f0554b Adapt to frontend refactorings 2019-12-22 16:29:45 +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
e52199469f Upgrade front-end & libs to v2.087.0-beta.1 2019-06-21 15:39:45 +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
d2c704b186
Fix context of some nested aggregates (#2969)
The context for instances of aggregates *not* nested in the current
function, but some parent. Fixes #2960.
2019-01-20 22:18:55 +01:00
Martin Kinkelin
61ed0563e8
Fix issue #2932 (allow speculative nested variables) (#2940) 2019-01-20 14:58:59 +01:00
Martin Kinkelin
32b6e49a65
Debuginfo: Fix nested variables (primarily for CodeView) (#2909)
We've been going back and forth between GEPs and complex DWARF
expressions based on the context pointer; this goes back to the latter,
as that fixes simple nested variables for CodeView with LLVM >= 6.

I guess it also helps for debuginfos of nested vars with enabled
optimizations.
2018-11-20 20:44:47 +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
5d8b581025 Rename ExplicitByvalRewrite to IndirectByvalRewrite 2018-05-27 00:57:26 +02:00
Martin
c6132508b1 Don't waste an alloca for the nested context argument
And so get rid of all loads too; just use the untouched pointer argument
directly.
2018-02-11 18:43:02 +00:00
Martin
d7f68dbeb3 Merge branch 'master' into merge-2.075
Conflicts:
	runtime/druntime
2017-10-01 18:28:44 +02:00
kinke
5a9c7a17ae Fix storage of captured lazy parameters (depending on ABI) (#2330)
Fixes issue #2302.
2017-09-24 19:46:52 +02:00
Johan Engelen
0546bd406b Small reduction of scope. (#2335) 2017-09-20 00:40:02 +02:00
Martin
41aae46b91 Merge branch 'master' into merge-2.075
Conflicts:
	runtime/druntime
2017-09-12 19:44:53 +02:00
Martin
e4e7eaa0da Restore additional GEP deref for llvm.dbg.declare for LLVM < 5 2017-09-09 22:02:18 +02:00
Martin
8cc5ff6e79 Fix debuginfos for nested ref/out parameters (use llvm.dbg.declare)
llvm.dbg.value() apparently doesn't like GEP + deref, so use
llvm.dbg.declare() & GEP.
2017-09-09 22:02:14 +02:00
Martin
dc8eb23457 Debuginfos: Get rid of additional deref for the GEP of nested vars
This fixes things on Linux x64 with LLVM 5.0.
2017-09-09 22:01:23 +02:00
Martin
8a5984b7d3 Use llvm.dbg.value for all non-special refs & fix nested refs DI 2017-09-09 22:01:22 +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
1fb269f940 Drop support for LLVM < 3.7 2017-07-16 02:18:00 +02:00
Johan Engelen
950d2aabcf Additional -vv logging in DtoCreateNestedContext. (#2191) 2017-07-06 18:55:16 +02:00
kinke
89e5d27415 Put debuginfo on GEP instead of on the alloca with an offset. (#1984)
For nested variables. Resolves issue #1933 at the expense of a debuginfo
regression wrt. captured this pointer, see PR #1963.

Also add DWARF deref for non-ref/out variables captured by reference.
2017-01-25 00:36:00 +01:00
Martin
0de021fe32 Fix check if nested function can access outer function frame
The previous check wouldn't check intermediate aggregates for static-ness,
that was one problem. The other was the assertion that the outer function
can be reached as long as there are no static functions inbetween, which
isn't always the case, as issue #1864 clearly shows, which is resolved by
this.
2016-11-18 18:05:56 +01:00
Martin
8be1e3e719 Adapt emission of debuginfos for parameters
Emit all parameters (except for captured ones) as DI parameters.
2016-10-09 20:17:39 +02: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
Johan Engelen
197b63a04f Fix debuginfo generation for the local variable frame for a function with nested functions.
Declare debuginfo directly on the GEP instead of on the frame alloca+offset, . An explicit DW_OP_deref is necessary (tested in LLDB).

Resolves an ICE introduced by PR #1598.
2016-07-27 16:57:47 +02:00
Elie Morisse
7ac1216292 Nested variables debug info fixes.
- Fix the value of closure variables in the parent function. Previously the passed value was the GEP instruction into .frame, and that instruction corresponds to a register  so resulted in "DWARF-2 expression error: DW_OP_reg operations must be used either alone(...)" (also the address was incorrect anyway because the offset would get doubled by 'addr')

 - When emitting debug info for a parent function parameter that is accessed from a nested function, call DIBuilder.createAutoVariable instead of createParameterVariable. Two different variables for the same parameter index was triggering an assert in llvm::DbgVariable::addMMIEntry. This fixes the compilation of druntime and phobos when building against LLVM 3.8.
2016-06-30 14:13:51 -03:00
Martin
0c0c1ecaf5 Rename DVarValue to DLValue 2016-06-13 22:30:15 +02:00
Martin
a6a6786d8d Try to boil down special cases in nested.cpp 2016-05-28 03:03:56 +02:00
David Nadlinger
bf432d92f3 DtoNestedVariable: Make debug log more useful [nfci] 2016-05-08 22:00:14 +01:00
David Nadlinger
9f998a398d Initial merge of upstream v2.071.0-b2
Notably, the glue layer side of the changed multiple interface
inheritance layout (DMD a54e89d) has not been implemented yet.

This corresponds to DMD commit 3f6a763c0589dd03c1c206eafd434b593702564e.
2016-04-03 15:15:14 +01:00
Johan Engelen
823a9efe26 Merge branch 'ltsmaster'
Solved merge conflicts in:
	gen/abi.cpp
	gen/toir.cpp
	runtime/druntime
	tests/d2/dmd-testsuite
	tests/lit.site.cfg.in
2016-03-29 11:40:20 +02:00
David Nadlinger
b47aee1750 refactor: Remove last bits of direct connection between DVarValue and VarDeclaration
The relationship between them is at best tenuous; DVarValue should
probably be renamed to DLValue and is used right now to describe
a general lvalue, of which variables are just one example.
2016-03-29 09:08:55 +01:00
David Nadlinger
33704577f3 Merge branch 'ltsmaster' 2016-02-25 20:09:19 +01:00