Commit graph

408 commits

Author SHA1 Message Date
kinke
a2fdffaf0d Merge pull request #1562 from kinke/dvalue
Continue with DValue refactoring and fix issue #1327
2016-06-26 21:24:43 +02:00
Martin
99384dde9b Tighten NRVO detection for VarDeclarations
The D types of the variable and the right-hand-side of the init AssignExp
must match; this fixes issue #1548.
Don't restrict it to memory-only types anymore though; the sret-check
performed by DtoIsReturnInArg() should suffice and makes more sense to me.
2016-06-25 23:40:58 +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
f70f11fac5 Handle internal ref variables in class DSpecialRefValue 2016-06-13 22:30:16 +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
c1c285782d Streamline DSliceValue
All DValues are now required to have a (main) LL value, which allows
to conveniently refactor the DValue hierarchy.

DSliceValue now represents a LL struct instead of separate values for
length and pointer.
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
Johan Engelen
1b4b9a07c9 Fix typo: typeinf.h --> typinf.h [NFC] 2016-06-08 10:40:00 +02:00
Johan Engelen
04b89e642c Windows: Move the prepending of 0x1 to C++ mangled functions from frontend to the backend.
Windows x64 ABI: remove unnecessary \01 from mangled symbol name.

This removes the 0x1 byte from `.mangleof` accessible from user code.
Resolves issue #1519

Also let mangleForLLVM take a std::string, to enable C++11's moves.
2016-05-30 10:18:39 +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
Johan Engelen
c77c16ef59 C++11 a few loops [NFC] 2016-04-24 14:45:06 +02:00
Kai Nacke
ee8c6b106b Fix merge errors 2016-04-23 14:58:39 +02:00
Kai Nacke
e55823fd09 Merge remote-tracking branch 'origin/ltsmaster' 2016-04-23 11:19:20 +02:00
Rainer Schuetze
eaa9e8130c create our own global context, it's been removed from LLVM
(cherry picked from commit 26a4e2bd13)
2016-04-21 22:34:08 +02:00
Johan Engelen
9955d8e4e4 For LDC_inline_ir functions: instantiate a new "alwaysinline" function for each call, which is the current behavior for inline ASM too.
When certain attributes are applied to the calling function, like "unsafe-fp-math", the inlined inlineIR function has to have the same attributes otherwise the calling function attribute will be reset to the safe merge of the two: "false". Because the same inlineIR function can be called in different functions using an alias definition, a new function (with possibly different attributes) has to be instantiated upon every call.

Related GH issue #1438
2016-04-21 10:16:33 +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
David Nadlinger
d89419445d gen: Fix buildStringLiteralConstant() for zeroTerm enabled
Apparently, this has not been triggered on the 2.070 branch
so far by chance, but Phobos 2.071 hits it.
2016-04-02 19:22:29 +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
6c15b4bc8e Random comment cleanup [nfc] 2016-03-29 09:08:55 +01: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
David Nadlinger
32864c47a5 Re-clang-format some files [nfc] 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
782dd77110 Fix merge error 2016-03-22 19:31:29 +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
acdcc4a8c1 Merge branch 'master' into merge-2.069 2016-02-13 20:12:17 +01:00
David Nadlinger
994da2e98f DtoCast: Implement struct repainting casts
The assoiative array case seems to be mostly triggered by some
remaining parts of the old shared/immutable AA type canonicalization
issue.
2016-01-31 00:57:34 +01:00
David Nadlinger
660cefaaf6 llvmhelpers: Re-clang-format [nfc]
GitHub: Fixes #1211.
2016-01-31 00:57:34 +01:00
David Nadlinger
9d4c65270f DtoCast: Condense if chain into switch [nfc] 2016-01-31 00:57:27 +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
ddfaac10b3 Rename DtoAggrCopy/ZeroInit() to DtoMemCpy/SetZero() overloads
And replace some obvious load->store combos by a memcpy.
2015-12-04 22:23:09 +01:00
Martin
740a21eb8f Rename DtoIsPassedByRef() to DtoIsInMemoryOnly()
Motivation: issue #937
2015-12-04 22:23:09 +01:00
Johan Engelen
70a6e73188 Cleanup runtime fwd decls and use ABI functiontype rewriting 2015-11-22 01:27:26 +01:00
Martin
2dfa5e8569 Some more cosmetic fixes
Found by searching for lines > 80 chars.
2015-11-05 19:12:32 +01:00
David Nadlinger
4f2f1f87e5 Implement @ldc.attributes.section(...) for variables
This now uses actual struct literals for attributes that can be generated
by arbitrary CTFE expressions. This should allow for quite a bit of
flexibility when targeting multiple compilers.
2015-11-03 21:33:05 +02:00
David Nadlinger
ca51f514e4 Convert some C-style casts 2015-11-02 11:30:40 +02: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
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
Martin
b63a5e3cf8 Merge branch 'master' into merge-2.068 2015-10-22 22:39:46 +02:00
Martin
a39997d326 Use the target pointer size as lower bound for the alignment of LL globals
This is apparently assumed by a std.conv unittest.

Using DtoAlignment() here instead of checking for an explicit
vd->alignment != STRUCTALIGN_DEFAULT is not only nice for consistency,
but also leads to a `struct S { align(16) int a; }` global being correctly
aligned on a 16-bytes boundary. The struct itself has no explicit
alignment, but alignsize() is 16; so the upstream code doesn't set any
explicit alignment for the global.
2015-10-19 23:25:25 +02:00