Commit graph

287 commits

Author SHA1 Message Date
Martin
c1c285782d Streamline DSliceValue
All DValues are now required to have a (main) LL value, which allows
to conveniently refactor the DValue hierarchy.

DSliceValue now represents a LL struct instead of separate values for
length and pointer.
2016-06-13 22:30:14 +02:00
Martin
e3e2f4b2e9 DValue: Remove method getType()
Use the existing public field directly instead.

It's shorter and different than LLValue's getType() (making it easier
to discriminate DValues and LLValues for experienced LDC devs imho).
2016-06-13 22:30:13 +02:00
Martin
039560bd83 Introduce DtoRVal/DtoLVal convenience functions
No functional changes intended.
2016-06-13 22:30:13 +02:00
Martin
0440bd20db Optimize array comparisons against null
This fixes issue #894 and includes some refactorings.
2016-03-28 15:30:55 +02:00
David Nadlinger
03429eb60f gen: Fix another array literal crash with vectors 2016-02-06 20:57:07 +01:00
David Nadlinger
b756b2de8a arrays: Fix accessing array literal elements with 2.069 frontend
This is unrelated to the move to DDMD. It would have probably been
a good idea to merge the last C++ frontend first.
2016-01-29 22:34:04 +01:00
David Nadlinger
77c29bc8c1 Re-clang-formatify gen/arrays.cpp 2016-01-29 22:32:47 +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
956061c3c7 Revise DtoGEP() helpers and mark most GEPs inbounds 2015-12-14 00:18:15 +01:00
Martin
0671e91d6b Remove getTypePaddedSize() and use getTypeAllocSize() instead
The functions were equivalent, only leading to confusion.
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
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
d30310c1f9 Support implicit casts in DtoArrayPtr()
On branch merge-2.068, `runnable/testassign.d` checks that a dynamic
array of objects of type B can be assigned to a dynamic array of objects
of a base class A.
The front-end seems to modify the rhs expression type from B[] to A[],
so we need to perform an implicit cast in DtoArrayPtr() to prevent
further type mismatches, notably in DtoArrayAssign().
2015-10-04 00:13:52 +02:00
Martin
b13565c17e Refactor common i1ToI8(voidToI8(DtoType(...))) code occurrences 2015-10-03 22:58:00 +02:00
David Nadlinger
c897015f62 Fix misaligned vector variable initializers
GitHub: Closes #1092.
2015-09-26 19:48:54 +02:00
Martin
9e194bfe2c Refactor store-to-new-alloca code occurrences. 2015-09-25 17:12:42 +02:00
David Nadlinger
4bcd29d0d0 Fix infinite recursion with empty member array default initializers
GitHub: Closes #1101
2015-09-20 19:05:55 +02:00
David Nadlinger
ac792497f2 Properly ignore statically known SliceExp bounds
GitHub: Fixes #1008.
2015-08-29 01:34:25 +02:00
David Nadlinger
ef431836b0 Remove _ad{Eq, Cmp} defines from back when we supported both D1/D2 (NFC) 2015-08-22 19:01:02 +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
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
8e92db150c arrays: Fix crash with void arrays 2015-07-30 00:40:43 +02:00
David Nadlinger
e6d0029f66 arrays: Do not invoke dtor/postblit on garbage when constructing array literal 2015-07-28 04:21:05 +02:00
David Nadlinger
d2135d4ade Fix more duplicate static array postblit calls 2015-07-28 02:12:45 +02:00
Martin
daee7955d5 arrays: Fix distinction between full and element-wise assignment
If both lhs and rhs are static/dynamic arrays, simply compare
the LL types produced by DtoArrayPtr(). If they mach, use full
array assignment, otherwise treat the rhs as compatible element
(e.g., T for T[n], T[n][], T[n][m], or even T[a][b] for
T[a][b][c][] :D).
2015-07-28 01:09:46 +02:00
David Nadlinger
eb96b8ab44 arrays: Disalllow void array block assignment 2015-07-27 21:05:30 +02:00
David Nadlinger
63337b278a arrays: TOKblit assignments never invoke postblit 2015-07-27 21:04:45 +02:00
David Nadlinger
b5e9e556d5 arrays: Fix static array of non-pod structs 2015-07-27 20:15:44 +02:00
David Nadlinger
5bdf482b8a arrays: Do not emit _d_array_slice_copy for static array assignment 2015-07-27 19:36:56 +02:00
David Nadlinger
d2f3717c4d arrays: Fix assigning T[n] to T[n][m]. 2015-07-27 18:50:50 +02:00
David Nadlinger
f1530b2a41 arrays: Do not emit _d_array_slice_copy for construction 2015-07-27 18:50:05 +02:00
David Nadlinger
19fd4938be Fix static array null assignment/default initialization 2015-07-26 19:34:45 +02:00
David Nadlinger
901f015ce4 arrays.cpp: Move some var decls into the inner scope 2015-07-26 19:28:33 +02:00
David Nadlinger
7c40e12a40 arrays.cpp: Move copySlice to avoid forward decl 2015-07-26 19:28:01 +02:00
David Nadlinger
68c0df413e Fix initialization of bool arrays 2015-07-26 17:52:23 +02:00
Martin
9d5560601a WIP: fix array construction/assignment wrt. RAII 2015-07-22 01:41:17 +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
kai
544af80417 Fix an unused variable warning 2015-04-12 20:17:57 +02:00
kai
eadefdc676 The runtime functions for multi-dim arrays have changed.
_d_newarraymT and _d_newarraymiT are now named _d_newarraymTX and
_d_newarraymiTX. There is also a change in the signature: instead
of a variable length argumentlist the functions now require an array
of dimensions.

This should fix test runnable/test28.d
2015-04-12 19:59:18 +02:00
Kai Nacke
ced658da92 Merge branch 'master' into merge-2.067 2015-04-05 03:29:30 +02:00
Kai Nacke
a4924c50e1 LLVM 3.7: llvm::ConstantExpr::getElementPtr() wants element type.
This is the same change like the one on the GEP instruction.
2015-04-04 01:37:14 +02:00
Kai Nacke
ae4344714c Fix bad signature in call to _d_arraysetctor / _d_arraysetassign.
The count parameter is int, not size_t.
2015-03-24 20:06:55 +01:00
Kai Nacke
fe9c769ce1 Fix yet another missed bitcast 2015-03-23 21:16:35 +01:00
kai
b9a41ecba7 Use llvm::SmallVector instead of std::vector.
A quick statistic collection revealed that during
druntime/phobos compilation no more then 7 arrays are
concatenated. Pre-allocation of 16 elements should be
good for most cases.
2015-03-22 13:49:11 +01:00
kai
bd0dc3b9d5 Add slices in reverse order 2015-03-21 20:23:20 +01:00
kai
05b501dc83 Add bitcast before loading value. 2015-03-21 19:42:58 +01:00
kai
9ef4c8f421 Implement _d_arraycatnTX and remove _d_arraycatnT.
With this commit, the first simple applications can be linked and run!
2015-03-21 17:37:51 +01:00