Commit graph

246 commits

Author SHA1 Message Date
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
4cefa5e8f5 Remove unused DtoInterfaceInfoType and support code 2015-06-14 21:27:21 +02:00
Kai Nacke
23303140fe Merge branch 'master' into merge-2.067 2015-05-22 21:44:33 +02:00
Kai Nacke
8d0fada2c2 LLVM 3.7: The signature of CreateCall() has changed.
The method now takes an array with the argument values.
2015-05-22 21:25:14 +02:00
Kai Nacke
1036edc266 Merge branch 'master' into merge-2.067 2015-05-17 13:06:46 +02:00
Kai Nacke
b92e377d49 Fix definition of D_LP64.
LP64 defines a C environment with 64bit pointers and char/short/int/long
are 8/16/32/64bit. char/short/int/long have defined sizes in D. We need
to look only at the pointer size.

There are now 64bit environments with 32bit pointers. Examples are
x32 in Intel and N32 on MIPS64. For these environments D_LP64 should
not defined but the global.param.is64bit is still true. The definition
of size_t is also affected. If only 32bit are addressable then size_t
should also be a 32bit type. (This is not required by C standard but
common practize.)

The net result is that not only the definition of D_LP64 must be changed
but also DtoSize_t().
2015-05-17 12:29:23 +02:00
Kai Nacke
1385c17efc Merge branch 'master' into merge-2.067 2015-04-15 21:46:16 +02:00
Dmitri Makarov
efa96d69d8 Cache global variables for string literals. 2015-04-15 09:56:02 +02:00
kai
d652ef76a1 Enable trivial code path for 128bit integer.
They are not yet enabled.
2015-04-06 17:30:04 +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
b343107077 Merge branch 'master' into merge-2.067 2015-03-22 13:59:39 +01:00
Kai Nacke
c0e23d6814 LLVM 3.7: llvm::GetElementPtrInst() requires the pointed-to type.
Currently, the pointer type is passed which causes an assertion.
Also add assertion to verify that parameter ptr is really of a
pointer type.
2015-03-22 13:55:53 +01:00
Kai Nacke
2ad804c16b Implement core.bitop.volatileLoad() and core.bitop.volatileStore()
The implementation introduces 2 new intrinsics: ldc.bitop.vld and ldc.bitop.vst.
2015-03-22 00:11:43 +01:00
kai
95806fd7cd Merge branch 'master' into merge-2.067
Conflicts:
	runtime/druntime
2015-03-15 20:35:44 +01:00
kai
30df48f360 LLVM 3.7: llvm::GetElementPtrInst::Create() now has an additional type parameter. 2015-03-15 18:07:11 +01:00
Kai Nacke
886c2eab06 Merge branch 'master' into merge-2.067
Conflicts:
	runtime/druntime
2015-03-01 15:03:31 +01:00
kai
a65f001356 Remove now unused function DtoAggrPairSwap().
The function was only used in the old ABI implementation.
2015-02-25 07:52:06 +01:00
kai
e455b90456 Merge branch 'master' into merge-2.067
Conflicts:
	dmd2/template.c
	runtime/druntime
	runtime/phobos
2015-02-24 07:23:58 +01:00
Martin
e7bfb78632 Refactor attributes system.
By introducing abstractions for attribute builder and set since they differ
greatly between LLVM 3.1-3.3.
2015-02-23 22:52:11 +01:00
Martin
f5592048e5 Get rid of obsolete TargetABI::newFunctionType() and doneWithFunctionType(). 2015-02-23 22:52:11 +01:00
Martin
9839cfb889 Experimental varargs fix 2015-02-23 22:52:10 +01:00
David Nadlinger
e4aa92deb3 Get rid of more superfluous casts with DMD arrays.
There are still a few more left.
2014-11-16 08:00:17 +01:00
kai
a2748cd2fd Merge current development state of 2.067
First merge of current development stream. Asm blocks are known to be broken.

DMD:      0c9f437bc24015707130ba42dc434d9cd58282fb
druntime: 86d49cfb3670904603df0cfdfe44c6fff565c0fc
Phobos:   a8ca4f7964becac680af0eadbde05aa7d10fc338
2014-11-15 18:53:23 +01:00
David Nadlinger
bb1ad7e324 Clean up linkage handling.
Since the change to the symbol emission strategy, a lot of the
previous attempts to derive the linkage for a symbol from its
AST node has been superfluous. This cleans up all the related
code, as it is really not doing much anymore.

The code to opportunistically internalize symbols is now gone
entirely. It was commented out anyway due to problems with
making it work reliably in the face of the not-so-stable
structure of the AST we get from the frontend (regarding the
modules certain symbols end up in). But in any case internal
linkage woudl also be troublesome for cross-module inlining,
so I gave up on making this work for the time being.

The only (minor) change in the emitted code should be in
.offTi generation, which is untested and disabled by default
anyway (GENERATE_OFFTI).
2014-10-08 20:55:19 +02:00
Alexey Prokhin
66a392a5c2 Rename Type::irtype to ctype for consistency with dmd and gdc 2014-10-05 16:55:12 +04:00
David Nadlinger
3d1be20470 Remove availableExternally logic and extra inlining semantic passes.
Turns out that since the change to use DMD's symbol emission
logic a few releases back we didn't actually ever emit code
for the extra modules. Thus, all the effort for the extra
semantic passes went to waste.

If we want to implement DMD-style cross-module inlining, we
need to add the extra semantic3s back in, and then iterate
over all the non-root modules with a codegen visitor that
only emits symbols as available_externally.

We probably won't need the availableExternally members if
we start with a clean design in the new symbol emission
framework. Thus, remove everything in the meantime. This
will make some release builds a bit faster, and should not
negatively affect generated code.
2014-10-04 20:02:13 +02:00
Andreas Hollandt
6db62ee8a9 remove all the "tmp" IR names 2014-10-02 14:36:51 +02:00
David Nadlinger
e1ffd58732 Merge branch 'master' into merge-2.066
Conflicts:
	gen/functions.cpp
2014-09-14 15:29:43 +02:00
David Nadlinger
d98c28a8da [cleanup] Remove unused DtoConstStringPtr. 2014-09-14 14:54:18 +02:00
David Nadlinger
552186082b [cleanup] Remove unused getBiggestType/getPrefTypeAlign. 2014-09-14 14:54:18 +02:00
David Nadlinger
415e7272db [cleanup] Remove DtoMemoryBarrier (unused, unimplemented). 2014-09-14 14:54:17 +02:00
Alexey Prokhin
76dec46df5 WIP: merge dmdfe 2.066 2014-08-22 16:01:28 +04:00
Alexey Prokhin
a6f358c59b Remove LINKintrisic 2014-07-10 18:10:46 +04:00
Alexey Prokhin
61979387fd Fix DMD Issue 11394 - NRVO should work for object field initialization in constructor 2014-06-27 14:47:10 +04:00
David Nadlinger
6a17b38d83 Merge branch 'master' into merge-2.064. 2013-12-26 15:29:58 +01:00
David Nadlinger
be185263ba Disable internalizing of nested functions.
This works around linking problems such as rejectedsoftware/vibe.d#338,
caused by the frontend appending template instances to the wrong
module.

GitHub: Fixes #558.
2013-12-26 13:24:41 +01:00
Kai Nacke
f772efaec3 Merge branch 'master' into merge-2.064 2013-11-04 02:24:02 +01:00
kai
8d7f0bf0eb Fix for issue #535.
The symbols must have weak_odr linkage if they result from a template instantiation.
2013-11-04 02:21:05 +01:00
David Nadlinger
cb341586e3 First merge of 2.064 beta.
This corresponds to DMD commit a913ce4bc59a94a022a27e390fc841f4aededffb.

Doesn't build Phobos yet.
2013-10-29 19:21:15 +01:00
David Nadlinger
787c147986 Use Module::members -> Dsymbol::codegen to define symbols.
This commit fundamentally changes the way symbol emission in
LDC works: Previously, whenever a declaration was used in some
way, the compiler would check whether it actually needs to be
defined in the currently processed module, based only on the
symbol itself. This lack of contextual information proved to
be a major problem in correctly handling emission of templates
(see e.g. #454).

Now, the DtoResolve…() family of functions and similar only
ever declare the symbols, and definition is handled by doing
a single pass over Module::members for the root module. This
is the same strategy that DMD uses as well, which should
also reduce the maintainance burden down the road (which is
important as during the last few releases, there was pretty
much always a symbol emission related problem slowing us
down).

Our old approach might have been a bit better tuned w.r.t.
avoiding emission of unneeded template instances, but 2.064
will bring improvements here (DMD: FuncDeclaration::toObjFile).
Barring such issues, the change shoud also marginally improve
compile times because of declarations no longer being emitted
when they are not needed.

In the future, we should also consider refactoring the code
so that it no longer directly accesses Dsymbol::ir but uses
wrapper functions that ensure that the appropriate
DtoResolve…() function has been called.

GitHub: Fixes #454.
2013-10-13 19:18:24 +02:00
kai
62683c4efe Simplify calling memcpy/memset 2013-08-18 20:56:24 +02:00
David Nadlinger
3035735bc9 FuncDeclaration::canInline diff reduction.
The new arguments to the call in DtoLinkage do not exactly
match what was there before, but have been harmonized with
the other canInline call.
2013-06-14 19:14:19 +02:00
David Nadlinger
b1465ae7e3 Extended DtoLinkage comments. 2013-06-12 20:16:37 +02:00
David Nadlinger
d3f89f81a8 Never emit naked functions as available_externally. 2013-06-12 20:16:37 +02:00
David Nadlinger
2cebe6408c Divided ir/irtypestruct.* in general aggregate and struct specific part.
This is just to improve clarity, as it was rather non-obvious
what of the code also applied to classes before.

IrTypeAggr::createInitializerConstant would currently belong in
IrTypeStruct, but this will be refactored anyway.
2013-06-12 17:17:09 +02:00
David Nadlinger
848dee32d4 Store bools as i8.
I really hope we can refactor this to use a less leaky
abstraction later – it should at least be possible to merge
voidToI8 and i1ToI8.
2013-06-07 03:20:54 +02:00
David Nadlinger
a8ae435c69 Remove bogous DtoMemCpy assertion.
DtoMemCpy is called with identical pointer arguments in
some legal cases.
2013-06-07 02:23:00 +02:00
David Nadlinger
c02b38fe9a Removed LLVM 3.0 compatibility code.
There might be still some pieces left here and there, and
there is certainly code that could be rewritten in a nicer
way with the 3.0 requirement out of the picture.
2013-05-31 20:48:38 +02:00
kai
522c06ff7f Do not memcpy with same source and destination.
This can happen for sret_args. Drop the assignment in this case.
2013-05-10 12:59:14 +02:00