Commit graph

150 commits

Author SHA1 Message Date
Ivan Butygin
a40c6c7fd2
Make LDC custom passes available to jit, add API for jit compiler options (#2758) 2019-09-08 09:16:05 +03:00
Martin Kinkelin
e52199469f Upgrade front-end & libs to v2.087.0-beta.1 2019-06-21 15:39:45 +02:00
Martin Kinkelin
c17cee71f3 Extend pragma(LDC_no_typeinfo) to classes and interfaces 2019-05-04 20:56:03 +02:00
Martin Kinkelin
edad40943a Do not bail out when coming across an erroneous vtbl entry
If functionSemantic() fails, compilation will eventually halt anyway.
This prevents displaying a fatal follow-up error, and e.g. makes
fail_compilation/fail18938.d produce the expected error messages.
2019-01-07 16:03:33 +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
Elie Morisse
8d26d5f452 Debug info: DIBuilder::GetSymbolScope() might need to declare functions 2018-10-15 22:57:59 +02:00
Martin Kinkelin
5c24f60cf9
Raise min LLVM version to 3.9 (#2872) 2018-10-15 22:31:59 +02:00
Martin Kinkelin
494bc8b1e4
Add some support for classes without TypeInfos (#2765)
For -betterC and/or a minimal object.d without TypeInfo:

* Skip TypeInfo emission for classes and interfaces.
* Emit null as first vtable member.

Makes dmd-testsuite's {compilable,runnable}/minimal2.d work.
2018-07-10 17:56:05 +02:00
Martin
025c69cc65 Merge branch 'master' into merge-2.079
Conflicts:
	appveyor.yml
	driver/main.cpp
	runtime/druntime
	runtime/phobos
2018-04-15 18:46:39 +02:00
Martin
8d5a94c7b8 Only emit interface vtables in the module declaring the class type 2018-04-10 22:13:00 +02:00
Martin
f38a7972a5 Split up getOrCreateGlobal() in {declare,define}Global()
Making it obvious which of the two operations is performed, reducing
call args and making sure a global isn't defined multiple times via
`defineGlobal()`.

The only [intended] functional change is in gen/trycatchfinally.cpp,
where I inserted a check for an existing __cpp_type_info_ptr global when
emitting a catch for C++ exceptions.
2018-04-10 22:13:00 +02:00
Martin Kinkelin
6c21e76ff4
Make interface thunks forward variadic args (#2630)
This fixes issue #2613.
2018-04-10 22:01:55 +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
10c44dd0b7 Merge branch 'master' into merge-2.076
Conflicts:
	runtime/phobos
2017-10-19 01:08:26 +02:00
Martin
c7823f034b Exclude @__future class methods from name hiding checks
Analogous to DMD.
2017-10-08 00:41:02 +02:00
Martin
c251170912 Rename DtoMangled... to getIRMangled... 2017-10-07 14:06:17 +02:00
Martin
c9a3be1295 Let TargetABI fix up LLVM mangles for more special symbols
For ModuleInfos, ModuleRefs, InterfaceInfos, interface vtables & thunks.
2017-10-07 14:06:17 +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
1fb269f940 Drop support for LLVM < 3.7 2017-07-16 02:18:00 +02:00
Martin
dca21939e1 Merge 2.072.2 front-end
The part needing most attention was ddmd.root.ctfloat, ddmd.target (incl.
gen/target.cpp) and ddmd.builtin. The front-end is now prepared for
elaborate compile-time floating-point types to allow for proper cross-
compilation.

This version still uses the host's `real` type for compile-time reals,
except for MSVC hosts, which still use 64-bit doubles (when compiled with
DMD host compiler too).

Some other changes:

* semantic*() of Statements extracted from statement.d to statementsem.d
* mangle() -> mangleToBuffer()
* Identifier::string -> toChars()
* Token::float80value => floatvalue
* Dsymbol::isAggregateMember() => isMember()
* BoolExp is no more
* ddmd.root.ctfloat: LDC-specific CTFE builtins
2017-01-29 15:48:03 +01:00
Ivan Butygin
a26bfc1223 Refactor code to hide direct IrFunction->func usage and add convenient functions (#1911) 2017-01-17 22:40:32 +01:00
Martin
8a161260b3 Infer return type of functions for vtbl initializer
Fixes issue #1906.

Also get rid of another bug wrt. potentially failing `DtoFunctionType()`
for abstract functions.
2016-11-30 11:07:54 +01:00
Martin
16d15e01cb Use opaque [N x i8*] for vtables
This fixes the forward-referencing issue #1741.
2016-11-21 21:54:53 +01:00
Martin
e1394fad5f Build vtable type lazily 2016-11-19 15:29:19 +01:00
Martin
642d755e99 Decorate thunk target calls as tail-calls (=> jumps)
I noticed that the C++ thunks would adjust the `this` pointer and then
jump directly to the actual target function.
The D thunks (on Linux, verified by disassembling) on the other hand
performed a regular call + return. Requesting tail-calls here leads to
direct jumps for D thunks as well, improving performance when calling
virtual functions via interfaces.
2016-09-27 01:34:05 +02:00
Martin
9e99411b0b Fix thunks naming so that extern(C++) matches C++ names
E.g., for `extern(C++) int Derived::MethodCpp()`:
`Th16_ZN7Derived9MethodCPPEv` => `_ZThn16_N7Derived9MethodCPPEv`

This makes sure `runnable/cppa.d` and `runnable/extra-files/cppb.cpp` work
when linking the 2 object files in any order on Linux, just as for DMD.

Previously, it only worked if the C++ object was specified first. Then the
C++ implementations of `Derived::MethodD()` and `Derived::Method()` were
picked and the D ones discarded.
If the C++ ones were discarded by specifying the D object first, the (C++)
thunks in the (C++) interface vtable (i.e., used for `Derived` instances
created on the C++ side) apparently got corrupted, jumping to null (as the
thunk target, the real C++ function, got discarded in favor of the D one).

By fixing the D thunk names, `extern(C++)` thunks are now overrideable as
well. If the C++ object is specified first when linking, the C++ thunks
(and methods) will be picked, otherwise the D thunks (and methods).
So the interface vtables produced by C++ and D should now always point to
the same set of thunks and thus resolve this nasty issue.
2016-09-27 01:34:05 +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
c6ba2dc29b Fix a few clang warnings. [NFC] 2016-07-27 20:21:02 +02:00
Rainer Schuetze
f9995b1883 fix build against LLVM trunk svn rev 273030 2016-06-18 10:54:23 +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
Johan Engelen
776e32d801 Add experimental -hash-threshold option to hash very long symbol names. 2016-05-24 11:39:08 +02:00
Rainer Schuetze
1b4d8569b8 fix issue #1473: ICE when implementing extern(C++) interfaces 2016-05-08 22:11:55 +02:00
Rainer Schuetze
bc1a1b1f9e fix runnable/cppa.d for Windows: C++ interface functions are implemented without thunks, the this pointer is adjusted in the function itself 2016-04-28 23:43:50 +02:00
Rainer Schuetze
1f5d689526 fix vtbl generation for interfaces (bad caching caused wrong thunks to be used)
fix interface casting
2016-04-18 08:22:31 +02:00
David Nadlinger
1160b81b5a Clean up some (clang-)formatting [nfc] 2016-04-10 15:43:21 +01:00
Kai Nacke
88f3de8bea Merge branch 'ltsmaster' 2016-03-22 19:05:07 +01:00
Martin
88dcb4349a Refactor setting linkage type and COMDAT 2016-03-20 16:37:44 +01:00
Rainer Schuetze
1131e6fc24 fix function name mangling for debug info 2016-03-13 17:31:22 +01:00
Rainer Schuetze
6f3adaea46 add debug info to thunks as a workaround for https://llvm.org/bugs/show_bug.cgi?id=26833 2016-03-13 17:29:44 +01:00
Rainer Schuetze
c970d5da3f thunks don't need a personality 2016-03-13 17:27:50 +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
71912511a5 Adaptations for recent LLVM 3.8 master changes 2015-11-08 14:06:16 +01:00
David Nadlinger
db3b3f157f Remove unused get_default_initializer argument 2015-11-06 00:24:03 +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
2d959ea540 Make use of C++11 range-based for
Should be available now that support for LLVM < 3.5 has been dropped.
2015-11-01 14:49:04 +01: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