Commit graph

36 commits

Author SHA1 Message Date
Martin Kinkelin
fc28d2db91
Fix equality/identity comparisons of vectors with length >= 32 (#3209)
And downgrade the 2nd Travis Mac job to LLVM 7 to test all supported LLVM versions again.
2019-10-29 22:43:45 +01:00
Martin Kinkelin
8fd69da8fb Make all DtoGEP helpers use implicit inbounds
Single functional change: always emit inbounds when computing the base
pointer of a SliceExp.
2019-09-10 22:36:25 +02:00
Stefanos Baziotis
eedde0ab16 Add inbounds where possible 2019-09-10 22:27:36 +02:00
Martin Kinkelin
a44c78fb88 Disallow some vector ops and fix integral vector identity comparisons
Bail out on unsupported vector ops (not checking the rhs type for binops
though) in the frontend instead of causing LLVM errors.

Also precompute the target's critical section size once at startup, like
DMD.
2019-05-26 05:11:16 +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
6dc59c78e0
Account for AST binop quirks (#2540)
This fixes issue #2537.
2018-01-30 20:31:37 +01:00
Martin
db8797e1ce Allow vectors to be compared for (not-)equality
I don't know how much sense that makes, as the front-end expects a result
expression of a single bool.
LLVM returns a vector of i1 values, the pair-wise results.
From my experience with SIMD on x86_64, what's mostly needed is a vector
bit mask, as that's what the CPU returns and which is later used to mask
accesses/writes.

Anyway, due to new `Target.isVectorOpSupported()` simply allowing all ops,
(not-)equality comparisons of vectors now land here, and I reduce the
pair-wise results via integer bitcast and an additional integer
comparison.
2017-08-04 21:32:25 +02:00
Martin
2a0a6631a8 Clarify some non-obvious points wrt. binops/binassign 2016-07-18 20:23:24 +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
ffaeb09188 Binassign: Always use the lvalue subexpression for the binop lhs
Just cast it to the full lhs type, except for shift-assignments (always
perform the shift op in the lvalue precision).

The front-end likes to cast the lhs to the type it wants for the
intermediate binop. E.g., incrementing a ubyte lvalue by an integer leads
to `lval += 3` being rewritten to `cast(int)lval += 3`.

Now if we use the full lhs value for the binop, we get an rvalue result
due to the cast. I.e., `cast(int)lval` before evaluating the rhs. So what
we actually want is to load the lhs lvalue `lval` AFTER evaluating the rhs
and cast it to an integer so that the binop is performed in that
precision. The result is casted back to the lvalue type when assigning.
2016-07-17 23:28:12 +02:00
Martin
add49d5957 Fix evaluation order for pointer += and -= 2016-07-17 19:13:17 +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
7e770f7c59 Refactor bitwise binary operators 2016-07-16 16:42:27 +02:00
Martin
df34beb59b Refactor binops and binassigns 2016-07-16 16:42:23 +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
de9149f1b6 Remove getLVal() from DValue and add DtoL/RVal() overloads 2016-06-13 22:30:16 +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
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
Andreas Hollandt
6db62ee8a9 remove all the "tmp" IR names 2014-10-02 14:36:51 +02:00
kai
45fca1f3b5 Add line number to error message of -nogc switch.
This was suggested by bearophile in the news group.
It also changes all Loc objects to be passed by reference.
2014-07-04 07:15:05 +02:00
kai
1e4a8fffc2 Remove DMDV1 and DMDV2. 2013-03-06 10:20:24 +01:00
David Nadlinger
0a96aea868 Sort includes according to style guidelines:
1. Main include corresponding to .cpp file, if any.
 2. DMD and LDC includes.
 3. LLVM includes.
 4. System includes.

Also updated a few include guards to match the default format.
2013-02-07 21:20:55 +01:00
David Nadlinger
1bb14c45d2 Removed trailing whitespace. 2012-12-16 17:19:15 +01:00
David Nadlinger
9458911839 Added LLVM-style license headers to all our files. 2012-12-16 17:19:14 +01:00
David Nadlinger
c6abdcf4a4 Don't set TypePointer::isunsigned to true in the frontend.
The previous solution was problematic because the change was language-
visble via the isUnsigned trait. Now, pointers are simply explicitly
checked for in the relevant places. (Note that there might be cases in
the diff where a direct isunsigned() call would have been appropriate –
I only checked for instances where the type clearly cannot be a pointer,
but chose to go the safe route in replicating existing behavior
otherwise).

Fixes DMD testcase 'traits'.
2012-09-28 00:28:49 +02:00
Alexey Prokhin
fb77c05dfd DMD Issue 3632 - modify float is float to do a bitwise compare 2011-09-15 13:56:22 +04:00
Moritz Warning
90d9d11def removed erroneous asserts 2010-10-29 23:06:01 +02:00
Moritz Warning
c151d37365 fixes #434 :: add llvm 2.8 support 2010-10-23 13:38:26 +02:00
Christian Kamm
7dbe9baa37 Made is and !is use the same numeric comparison as == and !=, fixes #328
Factored out common code from EqualExp and IdentityExp into
DtoBinNumericEquals in binexp.cpp.
2009-06-16 23:00:27 +02:00
Christian Kamm
521a988e43 Binary ops had the wrong result type for real op imaginary.
Fixes:
run/creal_03
2008-08-17 12:21:53 +02:00
Tomas Lindquist Olsen
8b83eda2a2 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
Did a lot of smaller cleans up here and there.
Replaced more llvm::Foo with LLFoo for common stuff.
Split up tollvm.cpp.
2008-06-09 09:37:08 +02:00
Tomas Lindquist Olsen
b4bb3aaec4 [svn r229] Updated the object.d implementation to the latest Tango.
Fixed a bunch of the built-in typeinfos for arrays, they did not inherit TypeInfo_Array.
Applied patch to tango/text/convert/Layout.d by fvbommel, closes #47 .
Cleaned up some type code.
Replaced uses of llvm::Type with LLType (a typedef), same for Value and Constant.
Fixed a few cases where typeinfo for user structs could be emitted multiple times, seems to still be some cases of this :/
2008-05-30 19:32:04 +02:00
Tomas Lindquist Olsen
5e9f5034ff [svn r108] Now basic suppport for complex types. =,+,-,*,/ are supported. 2007-11-19 02:58:58 +01:00
Tomas Lindquist Olsen
48492229ec [svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
Lots of bugfixes.
Added support for special foreach on strings.
Added std.array, std.utf, std.ctype and std.uni to phobos.
Changed all the .c files in the gen dir to .cpp (it *is* C++ after all)
2007-11-03 14:44:58 +01:00