Commit graph

214 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
c1725809c2
-fvisibility=hidden: Hide init symbols, TypeInfos and vtables too if the associated aggregate isn't exported (#3129) 2019-08-20 01:41:26 +02: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
314a64c351 Fix pragma(LDC_no_typeinfo) - elide TypeInfo emission for structs 2019-05-04 18:41:51 +02: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
7dbd07dd1e Use new extern(D) dtor shims for struct/class TypeInfos
The TypeInfo may need an extern(D) wrapper accounting for ABI
differences wrt. extern(C++) dtor implementations.

This fixes `runnable/cppa.d` for 32-bit x86 targets.
2018-06-23 19:31:43 +02:00
Martin
2dea0e96ee Account for special case of builtin TypeInfos (rt.typeinfo.*)
And aid in debugging by outputting the IR type names if there are type
mismatches when declaring global variables.
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
e337cec78a Slightly refactor RTTIBuilder 2018-04-04 19:59:10 +02:00
Martin
24c2d3e867 Skip TypeInfo emission if there's no TypeInfo declaration
This is compatible with DMD.
2018-04-04 19:59:10 +02:00
Martin
bd623f028a Redirect access to remaining TypeInfo subtypes through gen/runtime 2018-04-04 19:59:10 +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
df4f854dd5 Upgrade to D v2.079.0-beta.1 2018-02-20 02:04:41 +01:00
Martin
cfad799f48 Merge 2.078.0 front-end and stdlibs 2018-01-06 01:39:18 +01:00
Martin
ad89009d6e Merge 2.077.0 front-end and stdlibs 2017-11-05 18:41:55 +01:00
Martin
3f38f9715a Get rid of special 'typeid(...)' LL types for TypeInfos
Use the real LL type representing the TypeInfo (sub)class directly and
from the beginning, i.e., already for the declaration, instead of
building an extra LL struct type (firstly opaque, then finalized when
defining the TypeInfo via RTTIBuilder).

To get this to work in all cases, the dummy TypeInfo for opaque structs
is now a complete TypeInfo_Struct, with all 11/13 fields zero-
initialized. Previously, it was a special TypeInfo (no extra
TypeInfo_Struct fields) with TypeInfo_Struct vtable, something which DMD
also emits.

Also refactor the RTTIBuilder finalize() interface - e.g., don't set the
linkage there (had to be reverted for ModuleInfos) and only take the
global variable to be defined. Cast the field initializers if required,
e.g., null pointers to appropriately typed function pointers for
TypeInfo_Struct etc.
2017-10-25 00:38:05 +02:00
Martin
3d0a127d96 Skip TypeInfo definitions for -betterC 2017-10-25 00:38:05 +02:00
kinke
d1b30d627c Backport fix for issue #2357 (#2366)
Improve robustness for TypeInfos of speculative types by only eliding
their TypeInfo definition, not the declaration of the LL global
altogether.

`DtoTypeInfoOf()` expects the LL global to be created and otherwise
fails with an assertion or segfault (e.g., issue #2357). So now only
linker errors should result in case the TypeInfo definition is missing.

Also normalize the calls to `DtoTypeInfoOf()` and revise the following
pointer bitcasts, as the LL type of forward-declared TypeInfo globals
may be opaque.
2017-10-18 20:47:09 +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
b0fb08c43a Replace IrGlobal::type by getType()
As it can always be derived from IrGlobal::value, so the 2 fields don't
need to be kept in sync anymore.
2017-06-17 19:48:18 +02:00
Martin
383c2d3a59 Range-ify usages of front-end Arrays 2017-06-04 00:29:44 +02:00
Martin
fd7c075e3b Use DMD's typinf.d directly
Instead of letting our old copy silently go more and more out-of-sync.
In this case, we missed the upstream fix wrt. skipping the declaration of
ClassInfos for speculative class types.

There are 2 noteworthy functional changes for function
`getOrCreateTypeInfoDeclaration()`:

1) The old version always overwrote `torig->vtinfo` with `t->vtinfo` when
   declaring a new TypeInfo, whereas upstream's `genTypeInfo()` only sets
   it if it was null before.

2) The old version called `semanticTypeInfo()` during a semantic pass,
   upstream doesn't.

The LDC-specific exception for class types in `builtinTypeInfo()` is still
required.

Fixes dmd-testsuite's runnable/b16278.d.
2017-03-05 15:06:20 +01: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
Martin
b610dbc0a1 Fix TypeInfo_Struct constants for all non-x86_64 64-bit targets
Fields `m_arg{1,2}` are only declared for x86_64 targets, so there was a
size mismatch. In the best case, this lead to `m_RTInfo` containing a
TypeInfo pointer instead of the `hasPointers` flag in the least
significant bit (=> no `hasPointers`). `hasPointers` is also specified in
`m_flags` though, so I'm not sure `m_RTInfo` is actually used.
2016-12-03 12:21:16 +01:00
Martin
eab29ba173 Only define special member functions if semantic3 was run 2016-08-19 23:22:03 +02:00
Martin
642ca606c3 Run semantic3() before defining special member functions (xopEquals etc.)
This fixes issue #1698.
2016-08-19 22:58:20 +02:00
Martin
40fdf7819a Support non-trivial initializers for enums
E.g., non-zero-initialized structs encountered in issue #1581.
2016-06-26 23:29:10 +02:00
Johan Engelen
1b4b9a07c9 Fix typo: typeinf.h --> typinf.h [NFC] 2016-06-08 10:40:00 +02:00
Johan Engelen
d7ed918766 Fix codegen for static initialization with typeid(A). Resolves issue 1540. 2016-06-08 10:40:00 +02:00
Kai Nacke
763b196a72 Merge remote-tracking branch 'origin/master' into merge-2.070 2016-03-24 22:40:31 +01:00
Kai Nacke
f42273cbe1 Merge branch 'ltsmaster' 2016-03-24 21:50:15 +01:00
Johan Engelen
79d7eb68bc Define TypeInfo symbols as mutable (instead of immutable), to comply with DMD. Fixes issue #1377. 2016-03-23 22:36:08 +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
David Nadlinger
90c213b52e Adapt to changed StringExp API
Not tested yet. There is also quite a bit of potential for
further cleanup of the glue layer string manipulation code.
2016-02-14 19:35:40 +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
fa48cabedc Some more cosmetic fixes 2015-11-02 19:54:18 +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
David Nadlinger
8eab25f2fa Another speculative TypeInfo fix
No idea how to reproduce this, as it occurs within a 300 frame deep
call stack (nested typeinfo emission), and I couldn't get a smaller
test case so far.

An alternative fix would be to call the typinf.cpp functions that
emmiit the symbol directly instead of going through CodegenVisitor
(which then skips the TypeInfo because it is for a speculative
struct, so that the TypeidExp that wants to use it can't read the
global variable).
2015-10-29 16:49:00 +02:00
David Nadlinger
f8b18f538d Emit special struct member functions if referenced by speculative TypeInfo 2015-10-28 17:10:29 +02:00
Martin
b63a5e3cf8 Merge branch 'master' into merge-2.068 2015-10-22 22:39:46 +02:00
Martin
05c10d9107 Introduce DtoAlignment() and overload DtoAlloca() for VarDeclarations
Trying to get the alignment right by using the first non-default one
in the following order of descending priority:

VarDeclaration::alignment [variables only of course]
Type::alignment()
Type::alignsize()

This fixes `align(x) struct S { ... }`.
2015-10-18 14:38:09 +02:00
David Nadlinger
ab0c0820f3 Merge upstream v2.068.2 tags 2015-09-24 18:41:35 +02:00