rust/compiler
Matthias Krüger f4f644182b
Rollup merge of #123775 - scottmcm:place-val, r=cjgillot
Make `PlaceRef` and `OperandValue::Ref` share a common `PlaceValue` type

Both `PlaceRef` and `OperandValue::Ref` need the triple of the backend pointer immediate, the optional backend metadata for DSTs, and the actual alignment of the place (since it can differ from the ABI alignment).

This PR introduces a new `PlaceValue` type for those three values, leaving [`PlaceRef`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_codegen_ssa/mir/place/struct.PlaceRef.html) with the `TyAndLayout` and a `PlaceValue`, just like how [`OperandRef`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_codegen_ssa/mir/operand/struct.OperandRef.html) is a `TyAndLayout` and an `OperandValue`.

This means that various places that use `Ref`s as places can just pass the `PlaceValue` along, like in the below excerpt from the diff:
```diff
        match operand.val {
-            OperandValue::Ref(ptr, meta, align) => {
-                debug_assert_eq!(meta, None);
+            OperandValue::Ref(source_place_val) => {
+                debug_assert_eq!(source_place_val.llextra, None);
                debug_assert!(matches!(operand_kind, OperandValueKind::Ref));
-                let fake_place = PlaceRef::new_sized_aligned(ptr, cast, align);
+                let fake_place = PlaceRef { val: source_place_val, layout: cast };
                Some(bx.load_operand(fake_place).val)
            }
```

There's more refactoring that I'd like to do after this, but I wanted to stop the PR here where it's hopefully easy (albeit probably not quick) to review since I tried to keep every change line-by-line clear.  (Most are just adding `.val` to get to a field.)

You can also go commit-at-a-time if you'd like.  Each passed tidy and the codegen tests on my machine (though I didn't run the cg_gcc ones).
2024-04-12 04:38:21 +02:00
..
rustc
rustc_abi Use the Align type when parsing alignment attributes 2024-04-01 03:05:55 +01:00
rustc_arena rename ptr::invalid -> ptr::without_provenance 2024-02-21 20:15:52 +01:00
rustc_ast Deduplicate is_comparison impl between BinOpKind and AssocOp 2024-04-11 07:36:34 +00:00
rustc_ast_ir introduce Mutability::ptr_str 2024-04-10 18:51:09 +02:00
rustc_ast_lowering Actually create ranged int types in the type system. 2024-04-08 12:02:19 +00:00
rustc_ast_passes Add a helper for extending a span to include any trailing whitespace 2024-04-09 14:06:09 -04:00
rustc_ast_pretty Add pattern types to ast 2024-04-08 11:54:22 +00:00
rustc_attr Use the Align type when parsing alignment attributes 2024-04-01 03:05:55 +01:00
rustc_baked_icu_data
rustc_borrowck Rollup merge of #123599 - matthiaskrgr:rm, r=cjgillot 2024-04-12 04:38:21 +02:00
rustc_builtin_macros remove some things that do not need to be 2024-04-11 21:09:52 +02:00
rustc_codegen_cranelift Merge commit '89f54caacf90e99fc8ba0d60a28bdadea3cfdf1e' into sync_cg_clif-2024-04-11 2024-04-11 10:42:48 +00:00
rustc_codegen_gcc Put PlaceValue into OperandValue::Ref, rather than 3 tuple fields 2024-04-11 00:10:10 -07:00
rustc_codegen_llvm Rollup merge of #123775 - scottmcm:place-val, r=cjgillot 2024-04-12 04:38:21 +02:00
rustc_codegen_ssa Add load/store helpers that take PlaceValue 2024-04-11 00:10:10 -07:00
rustc_const_eval Actually create ranged int types in the type system. 2024-04-08 12:02:19 +00:00
rustc_data_structures rustc_index: Add a ZERO constant to index types 2024-04-03 19:06:22 +03:00
rustc_driver
rustc_driver_impl Disable Ctrl-C handling on WASM 2024-04-11 12:35:47 +00:00
rustc_error_codes Use the more informative generic type inference failure error on method calls on raw pointers 2024-03-20 15:53:06 +00:00
rustc_error_messages Rename SubdiagnosticMessage as SubdiagMessage. 2024-03-05 12:14:49 +11:00
rustc_errors Add redundant_lifetime_args lint 2024-04-09 12:15:27 -04:00
rustc_expand Check x86_64 size assertions on aarch64, too 2024-04-03 16:53:03 +11:00
rustc_feature remove some things that do not need to be 2024-04-11 21:09:52 +02:00
rustc_fluent_macro Rename SubdiagnosticMessage as SubdiagMessage. 2024-03-05 12:14:49 +11:00
rustc_fs_util
rustc_graphviz
rustc_hir Actually create ranged int types in the type system. 2024-04-08 12:02:19 +00:00
rustc_hir_analysis remove some things that do not need to be 2024-04-11 21:09:52 +02:00
rustc_hir_pretty Remove bin_op_to_assoc_op and invoke AssocOp::from_ast_binop directly 2024-04-11 07:36:34 +00:00
rustc_hir_typeck Rollup merge of #123804 - compiler-errors:podcrab-fix, r=jieyouxu 2024-04-11 22:38:56 +02:00
rustc_incremental Auto merge of #122070 - Zoxc:dep-edges-from-previous, r=cjgillot 2024-04-05 11:11:17 +00:00
rustc_index Check x86_64 size assertions on aarch64, too 2024-04-03 16:53:03 +11:00
rustc_index_macros rustc_index: Add a ZERO constant to index types 2024-04-03 19:06:22 +03:00
rustc_infer Rollup merge of #123703 - estebank:diag-changes-2, r=Nadrieril 2024-04-11 01:56:26 +02:00
rustc_interface Ensure we do not accidentally insert new early aborts in the analysis passes 2024-04-08 14:44:10 +00:00
rustc_lexer Silence redundant error on char literal that was meant to be a string in 2021 edition 2024-03-17 23:35:19 +00:00
rustc_lint Rollup merge of #123314 - surechen:fix_120642, r=Nadrieril 2024-04-11 01:56:24 +02:00
rustc_lint_defs Split back out unused_lifetimes -> redundant_lifetimes 2024-04-09 12:17:34 -04:00
rustc_llvm Rollup merge of #123612 - kxxt:riscv-target-abi, r=jieyouxu,nikic,DianQK 2024-04-10 04:27:40 +02:00
rustc_log bump tracing-tree to 0.3 2024-03-30 17:39:43 +03:00
rustc_macros Rename diagnostic derive things. 2024-03-11 10:06:34 +11:00
rustc_metadata remove some things that do not need to be 2024-04-11 21:09:52 +02:00
rustc_middle Rollup merge of #123660 - compiler-errors:coroutine-closure-env, r=oli-obk 2024-04-11 16:57:40 +02:00
rustc_mir_build Actually create ranged int types in the type system. 2024-04-08 12:02:19 +00:00
rustc_mir_dataflow Actually create ranged int types in the type system. 2024-04-08 12:02:19 +00:00
rustc_mir_transform Use a helper to zip together parent and child captures for coroutine-closures 2024-04-10 13:39:52 -04:00
rustc_monomorphize Only collect mono items from reachable blocks 2024-04-07 14:36:42 -04:00
rustc_next_trait_solver Auto merge of #122077 - oli-obk:eager_opaque_checks4, r=lcnr 2024-04-08 23:01:50 +00:00
rustc_parse remove some things that do not need to be 2024-04-11 21:09:52 +02:00
rustc_parse_format Check x86_64 size assertions on aarch64, too 2024-04-03 16:53:03 +11:00
rustc_passes Actually create ranged int types in the type system. 2024-04-08 12:02:19 +00:00
rustc_pattern_analysis Actually create ranged int types in the type system. 2024-04-08 12:02:19 +00:00
rustc_privacy Actually create ranged int types in the type system. 2024-04-08 12:02:19 +00:00
rustc_query_impl Verify that query keys result in unique dep nodes 2024-03-12 05:31:41 +01:00
rustc_query_system remove some things that do not need to be 2024-04-11 21:09:52 +02:00
rustc_resolve Silence unused_imports lint for redundant imports 2024-04-11 14:38:21 -04:00
rustc_sanitizers sanitizers: Create the rustc_sanitizers crate 2024-04-08 12:05:41 -07:00
rustc_serialize Stabilize associated type bounds 2024-03-08 20:56:25 +00:00
rustc_session Auto merge of #123099 - oli-obk:span_tcx, r=petrochenkov 2024-04-09 03:04:20 +00:00
rustc_smir Rollup merge of #123659 - celinval:smir-fix-intrinsic, r=oli-obk 2024-04-10 16:15:23 +02:00
rustc_span Add a helper for extending a span to include any trailing whitespace 2024-04-09 14:06:09 -04:00
rustc_symbol_mangling Rollup merge of #123649 - maurer:kcfi-v0, r=compiler-errors 2024-04-09 06:02:24 +02:00
rustc_target Rollup merge of #123740 - veera-sivarajan:reduce-size-of-modifierinfo, r=petrochenkov 2024-04-11 20:20:50 +02:00
rustc_trait_selection Add a helper for extending a span to include any trailing whitespace 2024-04-09 14:06:09 -04:00
rustc_traits Merge check_mod_impl_wf and check_mod_type_wf 2024-03-07 06:27:09 +00:00
rustc_transmute Rollup merge of #123367 - jswrenn:layoutify, r=compiler-errors 2024-04-08 22:06:21 +02:00
rustc_ty_utils Handle const generic pattern types 2024-04-09 16:42:45 -03:00
rustc_type_ir introduce Mutability::ptr_str 2024-04-10 18:51:09 +02:00
stable_mir Rollup merge of #123659 - celinval:smir-fix-intrinsic, r=oli-obk 2024-04-10 16:15:23 +02:00