Commit Graph

2547 Commits

Author SHA1 Message Date
bjorn3
54920ff25e Add missing clif ir comment 2022-03-09 19:33:55 +01:00
bjorn3
01ffb98db5 Update dependencies 2022-03-08 20:08:50 +01:00
bjorn3
3ccf12acdd Update Cranelift to 0.82.0 2022-03-08 20:01:48 +01:00
bjorn3
401b03443b Fix Box deref for non-ZST allocators 2022-03-08 20:00:11 +01:00
bjorn3
5841caa6ef Fix compiletest compilation 2022-03-08 12:13:33 +01:00
bjorn3
1b75d1146f Rustup to rustc 1.61.0-nightly (03918badd 2022-03-07) 2022-03-08 11:29:17 +01:00
bjorn3
2577efb434 Sync from rust 67b3e81838 2022-03-08 11:11:51 +01:00
Nicholas Nethercote
8723fe0b6b Clarify Layout interning.
`Layout` is another type that is sometimes interned, sometimes not, and
we always use references to refer to it so we can't take any advantage
of the uniqueness properties for hashing or equality checks.

This commit renames `Layout` as `LayoutS`, and then introduces a new
`Layout` that is a newtype around an `Interned<LayoutS>`. It also
interns more layouts than before. Previously layouts within layouts
(via the `variants` field) were never interned, but now they are. Hence
the lifetime on the new `Layout` type.

Unlike other interned types, these ones are in `rustc_target` instead of
`rustc_middle`. This reflects the existing structure of the code, which
does layout-specific stuff in `rustc_target` while `TyAndLayout` is
generic over the `Ty`, allowing the type-specific stuff to occur in
`rustc_middle`.

The commit also adds a `HashStable` impl for `Interned`, which was
needed. It hashes the contents, unlike the `Hash` impl which hashes the
pointer.
2022-03-07 13:41:47 +11:00
Nicholas Nethercote
7c1a318c7b Introduce ConstAllocation.
Currently some `Allocation`s are interned, some are not, and it's very
hard to tell at a use point which is which.

This commit introduces `ConstAllocation` for the known-interned ones,
which makes the division much clearer. `ConstAllocation::inner()` is
used to get the underlying `Allocation`.

In some places it's natural to use an `Allocation`, in some it's natural
to use a `ConstAllocation`, and in some places there's no clear choice.
I've tried to make things look as nice as possible, while generally
favouring `ConstAllocation`, which is the type that embodies more
information. This does require quite a few calls to `inner()`.

The commit also tweaks how `PartialOrd` works for `Interned`. The
previous code was too clever by half, building on `T: Ord` to make the
code shorter. That caused problems with deriving `PartialOrd` and `Ord`
for `ConstAllocation`, so I changed it to build on `T: PartialOrd`,
which is slightly more verbose but much more standard and avoided the
problems.
2022-03-07 08:25:50 +11:00
bjorn3
c5ec4d353c Fix typo 2022-03-04 20:45:04 +01:00
mark
346108202d rename ErrorReported -> ErrorGuaranteed 2022-03-02 09:45:25 -06:00
Tomasz Miąsko
69bd5324ca Normalize main return type during mono item collection & codegen 2022-02-23 22:33:50 +01:00
bjorn3
057de8f12e Merge branch 'sync_from_rust' 2022-02-23 11:51:21 +01:00
bjorn3
b5cbb87e62 Merge commit '35d9c6bf256968e1b40e0d554607928bdf9cebea' into sync_cg_clif-2022-02-23 2022-02-23 11:49:34 +01:00
bjorn3
35d9c6bf25 Rustup to rustc 1.61.0-nightly (68369a041 2022-02-22) 2022-02-23 11:45:41 +01:00
bjorn3
ca1f3e752e Sync from rust bafe8d06e0 2022-02-23 11:38:28 +01:00
bjorn3
dc973aef2a Rustup to rustc 1.61.0-nightly (03a8cc7df 2022-02-21) 2022-02-22 20:37:22 +01:00
bjorn3
33cf8fafd8 Sync from rust 03a8cc7df1 2022-02-22 19:55:24 +01:00
Matthias Krüger
a063e138b6 Rollup merge of #94169 - Amanieu:asm_stuff, r=nagisa
Fix several asm! related issues

This is a combination of several fixes, each split into a separate commit. Splitting these into PRs is not practical since they conflict with each other.

Fixes #92378
Fixes #85247

r? ``@nagisa``
2022-02-22 12:16:28 +01:00
Amanieu d'Antras
73cf3aaa78 Take CodegenFnAttrs into account when validating asm! register operands
Checking of asm! register operands now properly takes function
attributes such as #[target_feature] and #[instruction_set] into
account.
2022-02-21 18:28:22 +00:00
Amanieu d'Antras
e62c26e39d On ARM, use relocation_model to detect whether r9 should be reserved
The previous approach of checking for the reserve-r9 target feature
didn't actually work because LLVM only sets this feature very late when
initializing the per-function subtarget.
2022-02-21 18:28:22 +00:00
lcnr
d34bcdd49c use List<Ty<'tcx>> for tuples 2022-02-21 07:09:11 +01:00
bjorn3
2aad0066ba Update ignored rustc tests list 2022-02-20 17:11:59 +01:00
bjorn3
4a5b069558 Rustup to rustc 1.61.0-nightly (3b348d932 2022-02-19) 2022-02-20 16:28:22 +01:00
Mark Rousskov
7e80bc3c8d Move ty::print methods to Drop-based scope guards 2022-02-16 17:24:23 -05:00
bjorn3
f606a5807c Rustup to rustc 1.60.0-nightly (09cb29c64 2022-02-15) 2022-02-16 12:43:07 +01:00
bjorn3
4563abd4f1 Sync from rust a240ccd81c 2022-02-16 12:14:53 +01:00
Nicholas Nethercote
06bc64df92 Overhaul Const.
Specifically, rename the `Const` struct as `ConstS` and re-introduce `Const` as
this:
```
pub struct Const<'tcx>(&'tcx Interned<ConstS>);
```
This now matches `Ty` and `Predicate` more closely, including using
pointer-based `eq` and `hash`.

Notable changes:
- `mk_const` now takes a `ConstS`.
- `Const` was copy, despite being 48 bytes. Now `ConstS` is not, so need a
  we need separate arena for it, because we can't use the `Dropless` one any
  more.
- Many `&'tcx Const<'tcx>`/`&Const<'tcx>` to `Const<'tcx>` changes
- Many `ct.ty` to `ct.ty()` and `ct.val` to `ct.val()` changes.
- Lots of tedious sigil fiddling.
2022-02-15 16:19:59 +11:00
Nicholas Nethercote
18e7b7ece1 Overhaul RegionKind and Region.
Specifically, change `Region` from this:
```
pub type Region<'tcx> = &'tcx RegionKind;
```
to this:
```
pub struct Region<'tcx>(&'tcx Interned<RegionKind>);
```

This now matches `Ty` and `Predicate` more closely.

Things to note
- Regions have always been interned, but we haven't been using pointer-based
  `Eq` and `Hash`. This is now happening.
- I chose to impl `Deref` for `Region` because it makes pattern matching a lot
  nicer, and `Region` can be viewed as just a smart wrapper for `RegionKind`.
- Various methods are moved from `RegionKind` to `Region`.
- There is a lot of tedious sigil changes.
- A couple of types like `HighlightBuilder`, `RegionHighlightMode` now have a
  `'tcx` lifetime because they hold a `Ty<'tcx>`, so they can call `mk_region`.
- A couple of test outputs change slightly, I'm not sure why, but the new
  outputs are a little better.
2022-02-15 16:08:52 +11:00
Nicholas Nethercote
6a20fa93b5 Overhaul TyS and Ty.
Specifically, change `Ty` from this:
```
pub type Ty<'tcx> = &'tcx TyS<'tcx>;
```
to this
```
pub struct Ty<'tcx>(Interned<'tcx, TyS<'tcx>>);
```
There are two benefits to this.
- It's now a first class type, so we can define methods on it. This
  means we can move a lot of methods away from `TyS`, leaving `TyS` as a
  barely-used type, which is appropriate given that it's not meant to
  be used directly.
- The uniqueness requirement is now explicit, via the `Interned` type.
  E.g. the pointer-based `Eq` and `Hash` comes from `Interned`, rather
  than via `TyS`, which wasn't obvious at all.

Much of this commit is boring churn. The interesting changes are in
these files:
- compiler/rustc_middle/src/arena.rs
- compiler/rustc_middle/src/mir/visit.rs
- compiler/rustc_middle/src/ty/context.rs
- compiler/rustc_middle/src/ty/mod.rs

Specifically:
- Most mentions of `TyS` are removed. It's very much a dumb struct now;
  `Ty` has all the smarts.
- `TyS` now has `crate` visibility instead of `pub`.
- `TyS::make_for_test` is removed in favour of the static `BOOL_TY`,
  which just works better with the new structure.
- The `Eq`/`Ord`/`Hash` impls are removed from `TyS`. `Interned`s impls
  of `Eq`/`Hash` now suffice. `Ord` is now partly on `Interned`
  (pointer-based, for the `Equal` case) and partly on `TyS`
  (contents-based, for the other cases).
- There are many tedious sigil adjustments, i.e. adding or removing `*`
  or `&`. They seem to be unavoidable.
2022-02-15 16:03:24 +11:00
bjorn3
d459445799 Rustup to rustc 1.60.0-nightly (5d8767cb2 2022-02-12) 2022-02-13 12:24:02 +01:00
bjorn3
2ef3114671 Sync from rust 9a60099cc4 2022-02-13 11:57:51 +01:00
bjorn3
4e39cde7f3 Unconditionally update symbols
All paths to an ArchiveBuilder::build call update_symbols first.
2022-02-10 18:27:18 +01:00
Camille GILLOT
cf9c65bb58 Make FnAbiError Copy. 2022-02-09 20:11:29 +01:00
Camille GILLOT
d416c68114 Ensure that queries only return Copy types. 2022-02-09 20:07:38 +01:00
bjorn3
75a463a583 Update Cranelift to 0.81.0 2022-02-08 18:24:50 +01:00
bjorn3
583333a2b2 Don't try to reinstall ripgrep if it is already installed 2022-02-06 15:13:32 +01:00
bjorn3
441e2e67fa Rustup to rustc 1.60.0-nightly (88fb06a1f 2022-02-05) 2022-02-06 14:50:12 +01:00
bjorn3
bccf0a1f8d Merge codegen of a couple more simd intrinsics 2022-01-30 19:44:15 +01:00
bjorn3
5a3cfb24d8 Merge codegen of several simd intrinsics
This reduces code duplication
2022-01-30 19:37:01 +01:00
bjorn3
c1d699d37b Remove the remaining simd intrinsic macros 2022-01-30 19:31:18 +01:00
bjorn3
1ae27ea6aa Remove simd_cmp macro
This reduces duplication in the codegened source file
2022-01-30 19:19:54 +01:00
bjorn3
037aafbbaf Fix simd type validation 2022-01-30 18:35:08 +01:00
bjorn3
bb1b5cdde2 Remove validate_atomic_type
By expanding it in place. Also extract a common
report_atomic_type_validation_error function to reduce code duplication.
2022-01-30 18:23:01 +01:00
bjorn3
5efd7782b3 Don't generate unnecessary let $arg=$arg for intrinsics 2022-01-30 18:00:36 +01:00
bjorn3
246998f5ec Remove some unused lint allows 2022-01-30 17:43:09 +01:00
bjorn3
1b8ea0705e Add const_allocate and const_deallocate intrinsics 2022-01-30 17:35:33 +01:00
bjorn3
3ff158e3ed Update dependencies 2022-01-30 16:57:30 +01:00
bjorn3
96dc846a7d Rustup to rustc 1.60.0-nightly (a00e130da 2022-01-29) 2022-01-30 16:52:18 +01:00
bjorn3
2d32e51d86 Sync from rust a00e130dae 2022-01-30 13:25:57 +01:00