Commit graph

744 commits

Author SHA1 Message Date
Martin
2dfa5e8569 Some more cosmetic fixes
Found by searching for lines > 80 chars.
2015-11-05 19:12:32 +01:00
David Nadlinger
59cb0e5d8f gen: Fix Visitor override/shadowing warnings 2015-11-02 11:30:40 +02:00
David Nadlinger
05d45350aa clang-tidy: Add readability-else-after-return 2015-11-02 11:30:40 +02:00
David Nadlinger
9df487edff gen/ir: clang-tidy the world 2015-11-02 11:30:40 +02:00
David Nadlinger
44b0f7b615 driver/gen/ir: clang-format the world
This uses the LLVM style, which makes sense for sharing code
with other LLVM projects. The DMD code we use will soon all
be in D anyway.
2015-11-02 00:28:01 +02:00
Martin
2d959ea540 Make use of C++11 range-based for
Should be available now that support for LLVM < 3.5 has been dropped.
2015-11-01 14:49:04 +01:00
Martin
b63a5e3cf8 Merge branch 'master' into merge-2.068 2015-10-22 22:39:46 +02:00
Martin
05c10d9107 Introduce DtoAlignment() and overload DtoAlloca() for VarDeclarations
Trying to get the alignment right by using the first non-default one
in the following order of descending priority:

VarDeclaration::alignment [variables only of course]
Type::alignment()
Type::alignsize()

This fixes `align(x) struct S { ... }`.
2015-10-18 14:38:09 +02:00
Kai Nacke
012a9ee05c Merge branch 'master' into merge-2.068 2015-10-10 17:49:03 +02:00
David Nadlinger
0fe7180e2c Fix AssertExp in boolean context also for release builds 2015-10-09 22:21:40 +02:00
Martin
cda8a12112 Merge branch 'master' into merge-2.068
Conflicts:
	dmd2/root/man.c
	tests/d2/dmd-testsuite
2015-10-05 22:56:36 +02:00
Martin
b8daa46197 Fix typo in comment 2015-10-04 00:13:53 +02:00
Martin
b13565c17e Refactor common i1ToI8(voidToI8(DtoType(...))) code occurrences 2015-10-03 22:58:00 +02:00
Martin
c2e699f2c3 Watch out for special case when initializing ref variables
It may be the initialization of the variable's hidden pointer,
or the initialization of the pointee.

This fixes bugzilla 14944 for us (tested in `runnable/sctor.d`),
see https://github.com/D-Programming-Language/dmd/pull/5013.
2015-10-03 15:19:47 +02:00
David Nadlinger
86a1d8adf2 Do not unconditionally call toElemDtor in CondExp codegen
Since DMD commit 3bbe72b5f, the dtors are now rewritten in the
frontend.
2015-09-26 15:24:36 +02:00
David Nadlinger
ce66fa4866 Emit error on invalid nested function call instead of crashing
For fail_compilation/fail39.d, the frontend furthermore passes a
FuncExp with a TOKdelegate declaration, but a function pointer type
to the glue layer. Just add that to the special case list.
2015-09-26 15:24:36 +02:00
Martin
d45170464e Merge branch 'master' into merge-2.068
Conflicts:
	runtime/druntime
2015-09-26 14:21:43 +02:00
Martin
9e194bfe2c Refactor store-to-new-alloca code occurrences. 2015-09-25 17:12:42 +02:00
Martin
a721b4f823 Revise DtoRawAlloca() alignments 2015-09-25 15:16:28 +02:00
David Nadlinger
bd47ea49e6 Merge branch 'master' into merge-2.068 2015-09-24 17:57:25 +02:00
David Nadlinger
f4f55abf27 Use thunks instead of calling _d_toObject for D interfaces
This allows us avoid the problems stemming from the 64 kiB
size limit hack in _d_toObject.

GitHub: Fix #1065.
2015-09-13 20:27:00 +02:00
David Nadlinger
af47d7f944 Do not call postblit when initializing StructLiteralExp from rvalues
dmd-testsuite: Fixes runnable/nested.
2015-08-29 16:28:05 +02:00
David Nadlinger
830bd82afd Respect CallExp::directcall
Unfortunately, this is another case where the frontend breaks
the AST in such a way that you need to handle a condition in
exactly the place DMD does, because you cannot reconstruct the
information elsewhere.
2015-08-29 03:09:18 +02:00
David Nadlinger
3dccaad697 Fix "... && assert(0)" crash 2015-08-29 03:09:17 +02:00
David Nadlinger
cb0cecb9e7 Implement ToElemVisitor::visit(TypeidExp*) 2015-08-29 03:09:17 +02:00
David Nadlinger
9fd1e8d2a6 Merge frontend tag v2.068.0
Kept idgen as C++ program for now. We'll tackle build system integration
once we actually switch to DDMD.
2015-08-29 03:09:17 +02:00
David Nadlinger
ac792497f2 Properly ignore statically known SliceExp bounds
GitHub: Fixes #1008.
2015-08-29 01:34:25 +02:00
David Nadlinger
9474030507 TupleExp stack allocas are a DVarValue
Did not seem to matter before, but allows us not to care
about tuple types in the cleanup forwarding slot code.
2015-08-19 19:56:39 +02:00
David Nadlinger
159a1d0f30 Factor out handling of "magic" intrinsics to separate function 2015-08-19 19:56:39 +02:00
David Nadlinger
f82d3dab89 Re-fix DMD issue 13095 for the new temporary cleanup implementation
Really wish we wouldn't have to deal with all those
glue-layer special cases.
2015-08-19 19:56:39 +02:00
David Nadlinger
a4439fa7b5 Store r-value toElemDtor result in alloca when executing cleanups
See code for an explanation.
2015-08-19 19:56:39 +02:00
David Nadlinger
4bcae9731a The big catch/finally rework, part 2
Now with *almost* working EH codegen. Does not compile Phobos yet
because we run into the "instruction does not dominate all uses"
issue when an r-value result of toElemDtor is used and we need to
run cleanups in between. Should easily be fixed by promoting those
values to allocas.

Most of the changes outside of ir/irfunction.{h, cpp} are just
because CreateCallOrInvoke moved locations. I took the
opportunity to also make use of the different arg count
overloads where possible.
2015-08-19 19:56:39 +02:00
David Nadlinger
4236ae9ce5 The big catch/finally rework, part 1
Never generates any landing pads or invoke instructions right now
for simplicity. The code for emitting them will be added back in
the next step.

The "after..." blocks without any precedessors remain for now, as
we need a clean way to suppress any codegen for that block (but
not new blocks, which might resolve labels) before tackling that
one.

Builds druntime/Phobos on OS X x86_64 (albeit without EH, of course).
2015-08-19 19:56:39 +02:00
David Nadlinger
bfc20df4c8 Remove IRScope::end
Specifying the basic block before which to insert the new one
is not mandatory when calling llvm::BasicBlock::Create. This
was the only use of the tracked "end" block. The concept was
phony anyway because there is no single "end" to a scope with
unwinding and so on.

For prettying up the IR, it is possible to change the order
of basic blocks using move{Before, After}().
2015-08-19 19:56:39 +02:00
David Nadlinger
f3a79f1215 llvm::StringMap is available in 3.1 just fine? 2015-08-16 22:59:41 +02:00
David Nadlinger
5064909c32 Fix handling of reals where padding is built into the LLVM type
This fixes structs with members of structs with real fields. Did not
fail the test suite unless building with assertions before, but
crashed building real-world applications (and obviously led to wrong
struct layouts).
2015-08-10 20:49:30 +02:00
David Nadlinger
d9cd4ed22c Fix/simplify struct literal AddrExp toElem code 2015-07-28 04:27:57 +02:00
David Nadlinger
ad2546c6b0 toir/AssignExp: Align logic with DMD source to make maintenance/verification easier 2015-07-27 21:03:55 +02:00
Martin
9d5560601a WIP: fix array construction/assignment wrt. RAII 2015-07-22 01:41:17 +02:00
Martin
6fefec5a07 Don't destruct a temporary if its constructor throws. 2015-07-19 01:01:04 +02:00
Martin
b9c77c266a Restore toElemDtor() functionality. 2015-07-18 17:17:26 +02:00
Martin
cf52b53888 Move temporaries-related state from ToElemVisitor to FuncGen. 2015-07-18 13:34:26 +02:00
Martin
2304b52acb First attempt to simplify and fix destruction of temporaries in toElem(). 2015-07-18 13:34:26 +02:00
Martin
2444ae0988 First attempt to fix NewExp::argprefix.
The front-end uses a single bool variable as gate for all destructors
(by replacing each dtor expression by `gate || dtor()`).
This flag is set at the end of the argprefix chain of CommaExp.
So when no exception occurs in argprefix, the dtors aren't invoked in
the inserted finally block.
Right after the finally block we have the call to NewExp's ctor, which
will take care of destructing its parameters.
2015-07-18 13:34:26 +02:00
Martin
9f1e6f1a2e Prepare for more flexible toElemDtor().
We'd like to evaluate expression NewExp::argprefix and only destruct
it if an exception interrupts its evaluation.
2015-07-18 13:34:26 +02:00
Martin
1672b5d82d Codegen for NewExp::argprefix. 2015-07-18 13:34:25 +02:00
David Nadlinger
0922254dd1 Directly emit IR into same llvm::Module instead of using Linker
GitHub: Fixes #970.
2015-06-14 21:36:35 +02:00
David Nadlinger
d5b8713ca3 Merge pull request #968 from klickverbot/cpp-rtti
Do not try to use RTTI for C++ classes
2015-06-07 14:08:50 -04:00
Kai Nacke
f49d32f5f6 Merge branch 'master' into merge-2.067 2015-05-31 19:01:54 +02:00
Kai Nacke
0a8dd80850 Do not search for destructors inside assert expression if assertions are turned off.
Otherwise there is the possibility that temporaries are found and we try to call
the destructor on them.
This fixes issue #953.
2015-05-31 17:51:52 +02:00