Commit Graph

2620 Commits

Author SHA1 Message Date
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
pierwill
2c26139bbc Use an indexmap to avoid sorting LocalDefIds
Update `indexmap` to 1.8.0.

Bless test
2022-01-22 22:34:16 -06:00
bjorn3
cc24cea101 Rustfmt 2022-01-19 16:38:58 +01:00
bjorn3
c6e607a947 Implement unchecked_mul intrinsic 2022-01-19 15:45:04 +01:00
bjorn3
7a8227ecf9 Rustup to rustc 1.60.0-nightly (9ad5d82f8 2022-01-18) 2022-01-19 15:36:14 +01:00
bjorn3
400f122709 Sync from rust 2f004d2d40 2022-01-19 15:26:05 +01:00
lcnr
513d72d007 remove is_noop 2022-01-19 13:58:29 +01:00
bjorn3
78b65718bc Split compile_fn out of codegen_fn 2022-01-18 19:07:26 +01:00
bjorn3
5f6c59e63f Pass only the Function to write_clif_file 2022-01-18 18:58:37 +01:00
bjorn3
f3b2d37e77 Record object file artifact size in self profile data 2022-01-18 15:24:11 +01:00
bjorn3
b91ecc78bf Update rustc test ignore list 2022-01-18 13:59:40 +01:00
bjorn3
0472f6c91c Use 2021 edition for libcore tests 2022-01-18 13:41:01 +01:00
bjorn3
b85cbddf75 Rustup to rustc 1.60.0-nightly (ee5d8d37b 2022-01-17) 2022-01-18 13:02:02 +01:00
bjorn3
489bff5543 Sync from rust 7531d2fdd4 2022-01-18 12:49:50 +01:00
bjorn3
e59b024e02 Pass target_features set instead of has_feature closure
This avoids unnecessary monomorphizations in codegen backends
2022-01-17 18:06:30 +01:00
bjorn3
48abe3c6fa Use Symbol for target features in asm handling
This saves a couple of Symbol::intern calls
2022-01-17 18:06:27 +01:00
bors
0b58e52786 Auto merge of #92816 - tmiasko:rm-llvm-asm, r=Amanieu
Remove deprecated LLVM-style inline assembly

The `llvm_asm!` was deprecated back in #87590 1.56.0, with intention to remove
it once `asm!` was stabilized, which already happened in #91728 1.59.0. Now it
is time to remove `llvm_asm!` to avoid continued maintenance cost.

Closes #70173.
Closes #92794.
Closes #87612.
Closes #82065.

cc `@rust-lang/wg-inline-asm`

r? `@Amanieu`
2022-01-17 09:40:29 +00:00
Ellen
eef35308ef initial revert 2022-01-15 01:16:55 +00:00
Tomasz Miąsko
7ec4de3ab8 Remove deprecated LLVM-style inline assembly 2022-01-12 18:51:31 +01:00
Aaron Hill
409276cf55 Store a Symbol instead of an Ident in VariantDef/FieldDef
The field is also renamed from `ident` to `name. In most cases,
we don't actually need the `Span`. A new `ident` method is added
to `VariantDef` and `FieldDef`, which constructs the full `Ident`
using `tcx.def_ident_span()`. This method is used in the cases
where we actually need an `Ident`.

This makes incremental compilation properly track changes
to the `Span`, without all of the invalidations caused by storing
a `Span` directly via an `Ident`.
2022-01-11 10:16:22 -05:00
bjorn3
8f02c4e2ee Add y.bin to clean_all.sh 2022-01-10 12:26:23 +01:00
bjorn3
759c4ac08f Update to Cranelift 0.80.0 2022-01-10 12:26:03 +01:00
bjorn3
4dbd3196f9 Move most code from y.rs to build_system/mod.rs
y.rs can't be rustfmt'ed without making it no longer be a valid bash
script.
2022-01-09 19:30:07 +01:00
bjorn3
f328359787
Merge pull request #1216 from bjorn3/reduce_cg_clif_compile_times
Refactor the intrinsics module for slightly better build times
2022-01-09 19:25:10 +01:00
bjorn3
b7cda373d5 Pass Ty instead of TyAndLayout to the closure of various simd helpers
This reduces the total amount of llvm ir lines for simd related
functions from 9604 to 9467.
2022-01-09 19:07:15 +01:00
bjorn3
2633024850 Don't monomorphize the simd helpers for each closure
This halves the total amount of llvm ir lines for simd related functions
from 18227 to 9604.
2022-01-09 18:55:57 +01:00
bjorn3
b60eced405 Return Value instead of CValue from the simd_for_each_lane closure 2022-01-09 18:43:08 +01:00
bjorn3
57d25ef60e Use simplified version of bool_to_zero_or_max_uint in simd_cmp 2022-01-09 18:32:27 +01:00