Commit graph

313 commits

Author SHA1 Message Date
Kai Nacke
f1c4cf92ff Possible fix for issue #938.
The functions for all arrayops are compiler-generated but the functions
which are also defined in druntime are never emitted. This prevents
inlining of the function body and causes issue #938.

The fix is to emit the arrayops if inlining is enabled and otherwise
use the druntime provided implementations.

An alternative approach could be to always emit the arrayops and
never use the druntime version.
2015-05-23 23:02:17 +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
Martin
de783557bb ABI fix: let lazy parameters (i.e., delegates) be rewritten.
Implying that when allocating storage for the D delegate argument,
we need to allocate a LL struct representing the D delegate instead
of an instance of the actually passed LL type, which may have been
rewritten.
2015-03-15 14:18:12 +01:00
Martin
92d9ade0d1 Rework LLVM attributes abstraction. 2015-02-24 13:42:22 +01:00
Martin
c3f2e19c53 Fix AttrSet struct for LLVM 3.1 and 3.2.
Use a map instead of a vector as the attribute index may get as
high as 0xFFFFFFFF (LLVM 3.1), apparently for function attributes.
2015-02-23 22:53:09 +01:00
Martin
76d65d45b5 Never rewrite varargs passed by value. 2015-02-23 22:52:11 +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
aa38fe06ec Refactoring: move ABI-specific variadic stuff to TargetABI type. 2015-02-23 22:52:11 +01:00
Martin
a41a31d535 Get rid of obsolete DtoVariadicArgument(). 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
e5deefb1dd Re-implement __va_list struct allocation for System V AMD64 varargs ABI. 2015-02-23 22:52:11 +01:00
Martin
9839cfb889 Experimental varargs fix 2015-02-23 22:52:10 +01:00
kai
024b14cd7f Fix some warnings.
These are easy to solve and reduce the noise in the Travis build.
2014-12-26 15:59:23 +01:00
kai
dbbbe0092b Fix for issue #637.
In case of a ctor `this` is passed to the function and is also the
return value. This is the perfect case for the `Returned` attribute.
But the x86_64 ABI missed the fact that the return value was a pointer
to a struct and did a struct rewrite, resulting in an bitcast
incompatible type.
2014-11-13 02:06:57 +01:00
kai
e5745f5bb1 Fix compile error with LLVM 3.6.
The llvm::Linker class now uses diagnostic messages.
2014-10-25 18:11:49 +02:00
kai
332480460c Revert "Fix compile error with LLVM 3.6."
This reverts commit cc829485cc.
2014-10-25 18:02:26 +02:00
kai
cc829485cc Fix compile error with LLVM 3.6.
The llvm::Linker class now uses diagnostic messages.
2014-10-25 17:39:42 +02: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
4e2d45a409 Move irFty fields to backend ir classes 2014-10-05 16:55:22 +04:00
Alexey Prokhin
66a392a5c2 Rename Type::irtype to ctype for consistency with dmd and gdc 2014-10-05 16:55:12 +04:00
Alexey Prokhin
0f7a3b64c5 Make FuncDeclaration::isIntrinsic and FuncDeclaration::isVaIntrinsic free functions 2014-10-05 16:08:58 +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
David Nadlinger
8fafb59157 [cleanup] Slight comment improvements. 2014-09-15 23:19:52 +02:00
David Nadlinger
9b9d6035aa [cleanup] Remove unused DtoBaseFunctionType. 2014-09-14 18:13:43 +02:00
David Nadlinger
73735dd98c Fix assertions-enabled build.
needsCodegen was moved to TemplateInstance in 2.066.1.
2014-09-14 18:13:19 +02:00
David Nadlinger
28f4bce28c Merge DMD 2.066.1-rc1 plus dmd#3985.
This corresponds to DMD commit 9ca87d2855e30a42c65aea0be93a93449f82400c,
which will likely be released as 2.066.1.
2014-09-14 16:07:19 +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
934c67dc75 Emit functions as available_externally instead of skipping them.
This finally fixes the performance regression due to missing
inlining after the switch to the DMD-style symbol emission
logic (what later became FuncDeclaration::needsCodegen).

In my tests, this slightly increased compile times in release
mode (~7% for a set of small-ish programs) due to the extra
codegen. The impact is that small because we were doing all the
extra semantic{2, 3}s anyway (only to throw their results away)
and still get to avoid the LLVM backend. The performance gains
are, depending on the benchmark, spectacular, as this was
responsible for things like std.array.front not getting inlined.
2014-09-14 14:54:17 +02:00
Kai Nacke
382ad184d8 Merge branch 'master' into merge-2.066
Conflicts:
	dmd2/builtin.c
	gen/classes.cpp
	gen/functions.cpp
	gen/llvmhelpers.cpp
	gen/statements.cpp
	gen/toir.cpp
	runtime/druntime
	runtime/phobos
2014-09-13 23:11:54 +02:00
David Nadlinger
5370f52e8a [cleanup] Remove stale debug output statements. 2014-09-13 20:58:05 +02:00
David Nadlinger
42f5ea7cbb [cleanup] Don't check global.params.useUnitTests twice. 2014-09-13 20:58:02 +02:00
Alexey Prokhin
960d84508b [Refactoring] Turn IrDsymbol flags into an enum value 2014-09-12 16:27:13 +04:00
Alexey Prokhin
32b1d4cc55 Reduce size of IrDsymbol even more
resolved/defined/declared/initialized are turned into flags.
2014-09-12 14:43:54 +04:00
Alexey Prokhin
18f33b1815 Make IrDsymbol to be a typesafe union to reduce memory usage 2014-09-12 14:43:49 +04:00
Alexey Prokhin
5b15095c81 IrDsymbol::DModule is not used 2014-09-11 18:52:27 +04:00
kai
b8a75be61c Use LLVM intrinsic name as mangled name.
If the mangled name is viewed as the name emitted into IR code then the mangled name of an intrinsic is the intrinsic's name.
The name is unique because of the `llvm.` prefix. The only point is that overloaded intrinsics must be resolved earlier.

This commit moves the resolution of oveloaded intrinsics into the semantic analysis pass. The
2014-08-29 08:05:09 +02:00
Alexey Prokhin
d9189acbc4 Move toElem/toConstElem to visitors 2014-08-27 16:22:02 +04:00
Alexey Prokhin
ce1a41305b Set enclosingScopeExit in glue layer after semantic is done
Otherwise, we may end up with a wrong enclosing statement. It could
happen if a try-finally is rewritten as a try-catch (see NrvoWalker).
In this case, enclosingScopeExit will still point to the old unused
try-finally.
2014-08-24 13:59:18 +04:00
kai
2d49563ade Fix typo 2014-08-23 20:30:43 +02:00
kai
aa35307f54 Fix LLVM 3.6 build 2014-08-23 20:02:43 +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
4555af39fa Fix assert in DtoDefineFunction() 2014-07-10 15:50:44 +04:00
David Nadlinger
b0ff0de9c1 Make function entry basic blocks unnamed.
The performance impact should be completely immeasurable,
but the main benefit is that this makes IR dumps slightly
nicer to look at (as the redundant "empty:" labels are
now omitted entirely).
2014-06-29 16:47:44 +02:00
Alexey Prokhin
7597808a2d Ignore nested functions with a parent that had errors during semantic3. 2014-06-27 18:27:05 +04:00
Alexey Prokhin
61110e3ea4 Fix crash in runnable/arrayop 2014-06-26 19:47:21 +04:00
kai
2b6dbb03f4 Add IF_LOG to more logging statements.
Evaluating arguments which call toChars() or toPrettyChars() are much more expensive then checking Logger::enabled().
2014-06-26 06:54:38 +02:00
kai
ecd59cbb77 Fix compilation error 2014-06-23 18:02:14 +02:00
kai
b7615f6a28 Merge branch 'master' into merge-2.065
Conflicts:
	dmd2/declaration.h
	dmd2/dsymbol.h
	dmd2/func.c
	gen/functions.cpp
	gen/toir.cpp
	runtime/druntime
2014-06-23 07:57:30 +02:00
kai
7c289fd673 Introduce needsCodegen.
This is a backport of the code from 2.065.
2014-06-19 13:20:28 +02:00