Commit graph

164 commits

Author SHA1 Message Date
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
1c3cb2bade Refactoring: Replace isMusl() by triple.isMusl()
As LLVM 3.9 is the min required version now.
2019-05-31 10:49:45 +02:00
Martin Kinkelin
39b46d7b69 Replace old-school header guards by #pragma once 2018-10-20 16:19:46 +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
9fe95daeea Improve diagnostics for multiple function decls with IR type mismatch 2018-08-18 20:41:41 +02:00
Martin Kinkelin
5557278ba2 Adapt to refactored defaultInit() (method => free-standing) 2018-08-17 21:34:46 +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
joakim-noah
04cd029bb9 Pull in Musl's assert function for betterC mode. (#2604) 2018-03-04 20:48:07 +01:00
Martin
1941ea0b7b Refactoring: Make DtoAllocaDump(DValue*) overloads handle DLValues 2018-01-14 22:42:27 +01:00
Martin Kinkelin
11dfc4b5d7
Get rid of dead code (arrayops + DtoCallFunction() overload) (#2500) 2018-01-14 00:02:42 +01:00
Martin
30b858781b -betterC: Use C assert function
Instead of druntime's _d_assert[_msg], _d_arraybounds and
_d_switch_error.

Tested by dmd-testsuite's runnable/cassert and compilable/betterCarray.
2017-10-25 00:38:05 +02:00
kinke
ab37d5ba99 Fix issue #2235 - IR struct packedness (#2247)
Unnaturally aligned aggregates were potentially not marked as packed,
leading to LLVM inserting additional padding and screwing up the memory
layout.
2017-08-11 19:05:09 +02:00
Martin
1fb269f940 Drop support for LLVM < 3.7 2017-07-16 02:18:00 +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
Martin
0de021fe32 Fix check if nested function can access outer function frame
The previous check wouldn't check intermediate aggregates for static-ness,
that was one problem. The other was the assertion that the outer function
can be reached as long as there are no static functions inbetween, which
isn't always the case, as issue #1864 clearly shows, which is resolved by
this.
2016-11-18 18:05:56 +01:00
Martin
7a0bba00d9 Fix in-place construction of structs returned by inline assembly
Fixes #1823.
2016-10-11 22:10:30 +02:00
David Nadlinger
53cdc9a68e gen: Const-ify a loc parameter [nfc] 2016-08-18 16:27:34 +02:00
Martin
54cab47890 Revise DtoAssign() 2016-07-28 01:03:53 +02:00
Martin
951040cc36 Get rid of local AST pre-evaluation
We only needed that findLvalueExp() thing to 1. skip over casts and 2. to
use a (bin)assign's lhs instead of the (bin)assign's result.

Well, by making sure most (bin)assign expression actually return the lhs
lvalue, we don't have this problem anymore and only need to skip over casts
to get to the nested lvalue.

This gets rid of a hacky workaround and brings our AST traversal order
back to normal again.
2016-07-18 02:35:34 +02:00
Martin
df34beb59b Refactor binops and binassigns 2016-07-16 16:42:23 +02:00
Martin
08fa2f093c Enable in-place construction for struct literals 2016-07-03 00:23:03 +02:00
Martin
50b89a47fe Extract helper toDirectSretConstruction() 2016-07-02 12:52:28 +02:00
Martin
879fb97d56 Rename retvar to sretPointer 2016-07-02 12:52:21 +02:00
Martin
a3adb403de Fix evaluation/load order of binary operators
Fixes issue #1327 by loading immediately from lvalues resulting from
left- and right-hand sides.
2016-06-26 21:19:06 +02:00
Martin
7fec36b51f Continue with DValue refactoring
* Introduce a DRValue base class to be able to discriminate between
  DLValues and DRValues (e.g., function parameters).
* Let DValue::getRVal() return each DValue's value as DRValue.
  This allows to convert a DLValue to a DRValue, a snapshot of the
  lvalue's current state, while retaining the D type, something we've
  previously lost when returning the low-level rvalue directly.
* Let the DtoR/LVal() helpers be the only way to convert a DValue to a
  low-level value.
2016-06-25 15:33:57 +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
039560bd83 Introduce DtoRVal/DtoLVal convenience functions
No functional changes intended.
2016-06-13 22:30:13 +02:00
Johan Engelen
7657e5f7d8 Move ArrayParam helper type to llvmhelpers.h to make it available for use elsewhere. 2016-04-18 09:50:19 +02:00
Rainer Schuetze
26a4e2bd13 create our own global context, it's been removed from LLVM 2016-04-16 10:02:13 +02:00
David Nadlinger
209b6fc2b0 Merge pull request #1393 from kinke/nullArray
Optimize array comparisons against null
2016-04-09 23:22:53 +01:00
Johan Engelen
15aebef5be Merge branch 'master' into merge-2.070 2016-03-29 11:48:14 +02:00
Johan Engelen
823a9efe26 Merge branch 'ltsmaster'
Solved merge conflicts in:
	gen/abi.cpp
	gen/toir.cpp
	runtime/druntime
	tests/d2/dmd-testsuite
	tests/lit.site.cfg.in
2016-03-29 11:40:20 +02:00
David Nadlinger
b47aee1750 refactor: Remove last bits of direct connection between DVarValue and VarDeclaration
The relationship between them is at best tenuous; DVarValue should
probably be renamed to DLValue and is used right now to describe
a general lvalue, of which variables are just one example.
2016-03-29 09:08:55 +01:00
Martin
0440bd20db Optimize array comparisons against null
This fixes issue #894 and includes some refactorings.
2016-03-28 15:30:55 +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
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
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
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
Martin
9e194bfe2c Refactor store-to-new-alloca code occurrences. 2015-09-25 17:12:42 +02:00
Kai Nacke
ab2e8e3646 Refactor new COMDAT code.
Linkage and the COMDAT flag is now returned as std::pair<>.
Also adds more COMDATs.
2015-09-17 21:04:40 +02:00
kai
cf8875fad1 Fix for issue #988.
Starting with LLVM 3.7, linkage and COMDAT are 2 different concepts.
This means that LinkageODROnce does not put the object into a COMDAT.
On Windows this resulted in linker error messages.

This PR places all template functions, TypeInfo objects and other
objects into a COMDAT.
2015-09-09 16:46:49 +02:00
David Nadlinger
159a1d0f30 Factor out handling of "magic" intrinsics to separate function 2015-08-19 19:56:39 +02:00
David Nadlinger
4236ae9ce5 The big catch/finally rework, part 1
Never generates any landing pads or invoke instructions right now
for simplicity. The code for emitting them will be added back in
the next step.

The "after..." blocks without any precedessors remain for now, as
we need a clean way to suppress any codegen for that block (but
not new blocks, which might resolve labels) before tackling that
one.

Builds druntime/Phobos on OS X x86_64 (albeit without EH, of course).
2015-08-19 19:56:39 +02:00
David Nadlinger
63ca3c7eb4 Always zero struct padding as required by TDPL
We already generated the memsets for zeroing the padding,
but because we relied on the native LLVM type allignment
where possible instead of generating explicit padding
values, LLVM did not always copy those bytes around (e.g.
when spilling/reloading registers).
2015-08-10 20:49:30 +02:00