Commit graph

423 commits

Author SHA1 Message Date
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
David Nadlinger
63ca3c7eb4 Always zero struct padding as required by TDPL
We already generated the memsets for zeroing the padding,
but because we relied on the native LLVM type allignment
where possible instead of generating explicit padding
values, LLVM did not always copy those bytes around (e.g.
when spilling/reloading registers).
2015-08-10 20:49:30 +02:00
David Nadlinger
553ce18a5e Fix crash due to invalid iterators in DtoEnclosingHandlers
Unfortunately, I could not manage to isolate a self-contained
test case. The bug is quite specific to the exact memory
allocation decisions made by the standard library, as it will
not occur if the elements appended by the finally block codegen
fit into the current capacity.
2015-08-09 20:25:39 +02:00
Martin
9d5560601a WIP: fix array construction/assignment wrt. RAII 2015-07-22 01:41:17 +02:00
David Nadlinger
21d1bab114 Merge branch 'master' into merge-2.067 2015-07-11 18:10:43 +02:00
David Nadlinger
f7c3fc4ef3 Do not emit globals with void initializer as LLVM constants
Fixes things like `const(Foo) f = void; static shared this() { f = …; }`.
2015-07-08 02:34:48 +02:00
Kai Nacke
d1e764cec1 Backport of "Avoid using llvm::Linker" to master.
See pull request #974 for the original code.
2015-06-27 22:08:44 +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
6f6f6b1987 Use new global string literal cache for module names 2015-06-14 21:27:21 +02:00
Kai Nacke
80acadc841 Merge branch 'master' into merge-2.067 2015-06-04 20:48:38 +02:00
Kai Nacke
104e7c991f DebugInfo: Remove most calls to EmitFuncEnd()
Debug information is based on static lexical blocks. Most calls to
EmitFuncEnd() are done if control flow reaches the end of the
function which is quite different.
2015-06-04 20:19:54 +02:00
Kai Nacke
f49d32f5f6 Merge branch 'master' into merge-2.067 2015-05-31 19:01:54 +02:00
Kai Nacke
63ed72cf48 Merge branch 'master' into merge-2.067 2015-05-30 10:42:06 +02:00
David Nadlinger
568bf3723b DtoSymbolAddress: Remove support for unused ClassInfoDeclaration
It will be gone in 2.068.
2015-05-30 06:23:16 +02:00
David Nadlinger
084ae9da5b Remove extra load on assignment generated only for debug info
This leads to serious problems for values we really should
not be loading from, such as 100k element static arrays.

It was hard to figure out exactly why we need to emit DWARF
info here, so the easiest solution is to just have a look
at assignments during the next big debug info push.
2015-05-29 00:53:58 +02:00
Martin
c76ac3496d Enable default-initialized static arrays of voids.
With a single byte (implicit and 0) as initializer, as each void
element occupies 1 byte.

This is required when building T.init for a struct T containing
a void[N] with N > 0 and building literals of T.
2015-04-26 14:15:51 +02:00