Commit graph

388 commits

Author SHA1 Message Date
David Nadlinger
209b6fc2b0 Merge pull request #1393 from kinke/nullArray
Optimize array comparisons against null
2016-04-09 23:22:53 +01:00
David Nadlinger
d89419445d gen: Fix buildStringLiteralConstant() for zeroTerm enabled
Apparently, this has not been triggered on the 2.070 branch
so far by chance, but Phobos 2.071 hits it.
2016-04-02 19:22:29 +01:00
Johan Engelen
15aebef5be Merge branch 'master' into merge-2.070 2016-03-29 11:48:14 +02: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
6c15b4bc8e Random comment cleanup [nfc] 2016-03-29 09:08:55 +01: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
32864c47a5 Re-clang-format some files [nfc] 2016-03-29 09:08:55 +01:00
Martin
0440bd20db Optimize array comparisons against null
This fixes issue #894 and includes some refactorings.
2016-03-28 15:30:55 +02:00
Kai Nacke
763b196a72 Merge remote-tracking branch 'origin/master' into merge-2.070 2016-03-24 22:40:31 +01:00
Kai Nacke
782dd77110 Fix merge error 2016-03-22 19:31:29 +01:00
Kai Nacke
88f3de8bea Merge branch 'ltsmaster' 2016-03-22 19:05:07 +01:00
Martin
88dcb4349a Refactor setting linkage type and COMDAT 2016-03-20 16:37:44 +01:00
David Nadlinger
90c213b52e Adapt to changed StringExp API
Not tested yet. There is also quite a bit of potential for
further cleanup of the glue layer string manipulation code.
2016-02-14 19:35:40 +01:00
Johan Engelen
acdcc4a8c1 Merge branch 'master' into merge-2.069 2016-02-13 20:12:17 +01:00
David Nadlinger
994da2e98f DtoCast: Implement struct repainting casts
The assoiative array case seems to be mostly triggered by some
remaining parts of the old shared/immutable AA type canonicalization
issue.
2016-01-31 00:57:34 +01:00
David Nadlinger
660cefaaf6 llvmhelpers: Re-clang-format [nfc]
GitHub: Fixes #1211.
2016-01-31 00:57:34 +01:00
David Nadlinger
9d4c65270f DtoCast: Condense if chain into switch [nfc] 2016-01-31 00:57:27 +01:00
Johan Engelen
29ce4012af dmd2 --> ddmd. Merge (almost all of) our changes to dmd source into the new D source of dmd 2.069.2.
Also adds the CMake infrastructure to compile and link the D source files.

The build is partially broken:
- A few files in Phobos and druntime do not build
- MSVC build is broken because of unresolved symbols involving reals
2016-01-28 19:03:58 +01:00
Martin
ddfaac10b3 Rename DtoAggrCopy/ZeroInit() to DtoMemCpy/SetZero() overloads
And replace some obvious load->store combos by a memcpy.
2015-12-04 22:23:09 +01:00
Martin
740a21eb8f Rename DtoIsPassedByRef() to DtoIsInMemoryOnly()
Motivation: issue #937
2015-12-04 22:23:09 +01:00
Johan Engelen
70a6e73188 Cleanup runtime fwd decls and use ABI functiontype rewriting 2015-11-22 01:27:26 +01:00
Martin
2dfa5e8569 Some more cosmetic fixes
Found by searching for lines > 80 chars.
2015-11-05 19:12:32 +01:00
David Nadlinger
4f2f1f87e5 Implement @ldc.attributes.section(...) for variables
This now uses actual struct literals for attributes that can be generated
by arbitrary CTFE expressions. This should allow for quite a bit of
flexibility when targeting multiple compilers.
2015-11-03 21:33:05 +02:00
David Nadlinger
ca51f514e4 Convert some C-style casts 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
60d676e2a1 Drop support for LLVM < 3.5
This allows to clean up the code a little.
2015-10-30 22:24:05 +01:00
Martin
b63a5e3cf8 Merge branch 'master' into merge-2.068 2015-10-22 22:39:46 +02:00
Martin
a39997d326 Use the target pointer size as lower bound for the alignment of LL globals
This is apparently assumed by a std.conv unittest.

Using DtoAlignment() here instead of checking for an explicit
vd->alignment != STRUCTALIGN_DEFAULT is not only nice for consistency,
but also leads to a `struct S { align(16) int a; }` global being correctly
aligned on a 16-bytes boundary. The struct itself has no explicit
alignment, but alignsize() is 16; so the upstream code doesn't set any
explicit alignment for the global.
2015-10-19 23:25:25 +02:00
Martin
310ad102d7 Don't use DtoAlignment() when determining if a struct is packed
We need the type's natural alignment for that.
2015-10-19 21:21:00 +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
Martin
46421dbd5f Proper (?) fix in getParentFunc() 2015-10-08 19:41:16 +02:00
Martin
b0649397c0 Nested static functions and function literals do not inherit the parent context 2015-10-08 19:40:54 +02:00
Martin
0d7c0aeedc Proper (?) fix in getParentFunc() 2015-10-08 03:23:02 +02:00
Martin
a2fe91d5e3 Nested static functions and function literals do not inherit the parent context 2015-10-08 02:17:58 +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
b13565c17e Refactor common i1ToI8(voidToI8(DtoType(...))) code occurrences 2015-10-03 22:58:00 +02:00
Martin
8ee0e250c7 Merge branch 'master' into merge-2.068 2015-10-02 15:38:02 +02:00
David Nadlinger
c897015f62 Fix misaligned vector variable initializers
GitHub: Closes #1092.
2015-09-26 19:48:54 +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
David Nadlinger
f9e8f0d09a Merge branch 'master' into merge-2.068
druntime/phobos/dmd-testsuite not yet merged
2015-09-13 18:17:23 +02:00
kai
cf8875fad1 Fix for issue #988.
Starting with LLVM 3.7, linkage and COMDAT are 2 different concepts.
This means that LinkageODROnce does not put the object into a COMDAT.
On Windows this resulted in linker error messages.

This PR places all template functions, TypeInfo objects and other
objects into a COMDAT.
2015-09-09 16:46:49 +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
47bd4c5f7b Fix ICE caused by type mismatch on casting sret return value
Another one caused by special "context-specific" AST semantics. :/

GitHub: Fixes #982.
2015-08-21 23:34:26 +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
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