Commit graph

228 commits

Author SHA1 Message Date
Martin Kinkelin
cc336d6df1 Support generic ldc.attributes.llvmAttr UDAs for function parameters 2019-03-31 20:59:54 +02:00
Martin Kinkelin
1fdf330346 Refactoring: Remove obsolete AttrBuilder wrapper
It was useful when we still supported older LLVM versions, but it's
obsolete now.
2019-03-31 19:18:56 +02:00
Martin Kinkelin
6bdf7f88e7
Account for front-end implicitly casting vector return values to static arrays (#2991)
Fixes #2988.
2019-02-15 18:17:43 +01:00
Martin Kinkelin
68fa7b0167 Enforce slice IR rvalues to be represented by DSliceValue, disallow DImValue 2019-01-10 00:53:24 +01:00
Martin Kinkelin
33cadfaca6 Remove ldc.arrayinit & streamline _d_array_slice_copy/_d_arraycast_len with upstream 2019-01-07 15:54:26 +01:00
Martin Kinkelin
32ecbdd266 Upgrade front-end & libs to v2.084.0-beta.1 2018-12-18 02:31:57 +01:00
Martin Kinkelin
4a23399236 Aim for consistent #includes (order + dir prefix)
I surely missed a few.
2018-10-20 16:19:46 +02:00
Martin Kinkelin
7776c4081b Upgrade frontend & libs to v2.083.0-beta.1 2018-10-20 16:19:46 +02:00
Martin Kinkelin
5c24f60cf9
Raise min LLVM version to 3.9 (#2872) 2018-10-15 22:31:59 +02:00
Martin Kinkelin
3ca43c51b8
Use IndirectByvalRewrite for non-POD args and extern(C++) on Posix (#2728)
Fixing one aspect of issue #2702; not tackling the different destruction
rules yet.
2018-06-19 20:09:35 +02:00
Martin Kinkelin
915a5acd25 Try to elide bitcopy for IndirectByvalRewrite
For rvalues which are already in memory.
2018-05-30 21:46:39 +02:00
Martin
d8f60d2f5c Redirect access to object.d type declarations through gen/runtime
Not all type declarations yet (e.g., some TypeInfo subtypes are still
accessed directly), but those already wrapped as LazyType in the
gen/runtime.cpp module (with check and proper error msg in case object.d
doesn't contain a required declaration).
2018-04-04 19:59:10 +02:00
Martin
bccaee82f8 Fix issue #2450 for lvalues passed with byval attribute 2018-01-14 01:51:56 +01:00
Martin
bbaae5b9fe Invoke IrFuncTy::putParam() right after toElem()enting an arg
This fixes issue #2450 for primitive data types, i.e., performs the
rvalue load from lvalues (passed by value) right after evaluating the
argument expression. Previously, all expressions were evaluated in a
dedicated prior pass, so side effects in later argument expressions were
incorrectly visible.

Arguments rewritten by the TargetABI are rewritten immediately too now,
so I guess most of them are fine.

Lvalues passed with the byval attribute still need to be fixed
(dedicated alloca+memcpy).
2018-01-14 00:39:13 +01:00
Martin Kinkelin
11dfc4b5d7
Get rid of dead code (arrayops + DtoCallFunction() overload) (#2500) 2018-01-14 00:02:42 +01:00
Martin
ad89009d6e Merge 2.077.0 front-end and stdlibs 2017-11-05 18:41:55 +01:00
Martin
95915a8ab8 Fix and refactor Objective-C state
Tie the state to an LLVM module/object file instead of having a global
one. And finalize it once per LLVM module instead of once per D module
(previously, as part of ModuleInfo generation).

Fixes issue #2388.
2017-10-26 20:28:53 +02:00
Martin
183f97cd4e Objective-C: Fix functions with selector (issue #2387) 2017-10-26 17:01:02 +02:00
Martin
0b28925e9a Win32: Remove extra leading underscore from D symbol mangling
This is compatible with DMD.
2017-10-07 14:06:17 +02:00
Martin
980c5620ec Merge branch 'master' into merge-2.075
Conflicts:
	runtime/druntime
2017-08-04 22:43:16 +02:00
Johan Engelen
92d8062836 Fix a few compiler warnings (#2248)
* Remove default label in switch which covers all enumeration values.

This fixes the warning "default label in switch which covers all enumeration values". We will already get a warning when _not_ all enumeration values are covered.
This is the last warning left on OSX/Clang, so with this change, we can build with -Werror.

* Fix warning: enumeral and non-enumeral type in conditional expression

* Fix warning: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size 5

* "fallthrough" is recognized by the compiler warning system
2017-08-04 12:05:36 +02:00
Martin
2616261fd2 Revise all LDC-specific errors/warnings/deprecs and insert backticks
For DMD's new syntax highlighting. I grepped in all .{h,cpp} files only.
2017-08-03 22:53:49 +02:00
Martin
c51c2c0d55 Merge 2.075.0 front-end and stdlibs 2017-07-30 03:03:28 +02:00
Nicholas Wilson
1b19cea150 Add missing include. 2017-07-15 14:20:04 +08:00
Johan Engelen
b409a262d3 Fix LLVM 5.0 build.
Changes in SynchronizationScope, see https://reviews.llvm.org/D21723
2017-07-14 15:01:26 +02:00
kinke
151e83dc6b Fix C++ warnings (#2140) 2017-05-26 13:45:15 +02:00
Johan Engelen
ba1ed88b55 Remove magic +1 constant for parameter indexing. (#2120)
Remove magic +1 constant for parameter indexing.

LLVM may change the indexing offset in the future. See http://llvm.org/viewvc/llvm-project?view=revision&revision=302060
2017-05-20 08:48:48 +02:00
Rainer Schuetze
ae7f1a7f2c fix buildinng against LLVM master (#2111) 2017-05-16 20:43:29 +02:00
Johan Engelen
64df1687a8 Fix LLVM 5.0 compilation. 2017-04-14 12:55:19 +02:00
Johan Engelen
9e394e4f99 Fix LLVM 5.0 build. (#2050)
llvm::AttributeSet was renamed to llvm::AttributeList
2017-03-29 22:26:17 +02:00
kinke
87bfcc7108 Prepare DtoCallFunction() for runtime function calls (#1238)
By also accepting DValue args, not just Expressions.
2017-02-06 16:59:13 +01:00
LemonBoy
eab33ea726 Implement single-thread fences via the LDC_fence pragma. (#1837)
* Implement single-thread fences.

* Add a test for PR#1837
2016-10-18 19:20:44 +01:00
Martin
7d15ab9ffc Reduce ScopeStack to JumpTargets
Add some comments after this more or less clean separation, and move
callOrInvoke() to FuncGenState.
2016-08-07 21:29:47 +02:00
Martin
f4a22f232b Propagate "nothrow" to LLVM IR (#1202)
Invoke nothrow callees only in try-blocks with at least 1 catch-block,
otherwise call them directly.

Errors thrown by nothrow callees can thus still be caught inside a
try-catch-statement (and this is apparently required for release builds
too).

Most calls will be direct calls though, and this small change will lead
to substantially less IR as we then skip the clean-ups after an Error.
Proper clean-up when unwinding after an Error seems not to be guaranteed
anyway. There are apparent RAII front-end optimizations for structs with
nothrow dtor - see PR #1656.
2016-08-06 00:10:19 +02:00
David Nadlinger
6cc93bc8ba gen/ir: Move function body codegen state into separate class
Previously, the transitory state only needed and valid during
generation of the LLVM IR for the function body was conflated
with the general codegen metadata for the function declaration
in IrFunction.

There is further potential for cleanup regarding the use of
gIR->func() and so on all over the code base, but this is out
of scope of this commit, which is only concerned with those
IrFunction members moved to FuncGenState.

GitHub: Fixes #1661.
2016-08-03 21:07:18 +01:00
Johan Engelen
de86a0a358 [PGO] Generalize value profiling code. 2016-07-29 21:10:43 +02:00
Johan Engelen
12431ac5f4 [PGO] Add Indirect Call instrumentation and promotion. 2016-07-29 14:59:21 +02:00
Martin
d6dcc7a4db Enforce type consistency for most DValues
At the cost of some more bitcasts.
2016-07-17 06:22:22 +02:00
Martin
879fb97d56 Rename retvar to sretPointer 2016-07-02 12:52:21 +02:00
Martin
82005009e7 Refactor and fix intrinsics for variadic functions
I.e., va_start(), va_copy() and va_arg().
2016-06-28 22:40:14 +02:00
Martin
de9149f1b6 Remove getLVal() from DValue and add DtoL/RVal() overloads 2016-06-13 22:30:16 +02:00
Martin
0c0c1ecaf5 Rename DVarValue to DLValue 2016-06-13 22:30:15 +02:00
Martin
963a10b225 Let DValue types handle memory-only types consistently
I.e., disallow memory-only values from being represented as DImValues
and disallow getRVal() for such types instead of returning the address.
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
7778db00a8 Simplify generation of a call's return value 2016-05-29 14:01:02 +02:00
Martin
fc6c340661 Optimize ABIRewrite system for lvalues
Allow ABIRewrites to return the D parameter's LL value directly.
Most rewrites store to memory anyway, so let the D parameter point
directly to that memory instead of a dedicated alloca bitcopy.
2016-05-28 21:03:56 +02:00
Rainer Schuetze
628a560574 fix runnable/testcontracts: a contract on an interface function expects the interface pointer as "this", not the class pointer of the object 2016-04-26 00:12:00 +02:00
Dan Olson
b993823a52 Cleanup comments 2016-04-11 21:42:06 -07:00
Dan Olson
cd216538f9 Merge branch 'master' into objc-wip 2016-04-08 22:38:39 -07:00