Commit f4f6441
authored
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).File tree
14 files changed
+239
-169
lines changed- compiler
- rustc_codegen_gcc/src
- intrinsic
- rustc_codegen_llvm/src
- rustc_codegen_ssa/src
- mir
- traits
14 files changed
+239
-169
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
974 | 974 | | |
975 | 975 | | |
976 | 976 | | |
977 | | - | |
| 977 | + | |
978 | 978 | | |
979 | 979 | | |
980 | 980 | | |
| |||
999 | 999 | | |
1000 | 1000 | | |
1001 | 1001 | | |
1002 | | - | |
1003 | | - | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
1004 | 1005 | | |
1005 | | - | |
| 1006 | + | |
1006 | 1007 | | |
1007 | 1008 | | |
1008 | 1009 | | |
| |||
1012 | 1013 | | |
1013 | 1014 | | |
1014 | 1015 | | |
1015 | | - | |
| 1016 | + | |
1016 | 1017 | | |
1017 | | - | |
| 1018 | + | |
1018 | 1019 | | |
1019 | 1020 | | |
1020 | 1021 | | |
| |||
1027 | 1028 | | |
1028 | 1029 | | |
1029 | 1030 | | |
1030 | | - | |
1031 | | - | |
| 1031 | + | |
| 1032 | + | |
1032 | 1033 | | |
1033 | 1034 | | |
1034 | | - | |
| 1035 | + | |
1035 | 1036 | | |
1036 | 1037 | | |
1037 | 1038 | | |
| |||
1045 | 1046 | | |
1046 | 1047 | | |
1047 | 1048 | | |
1048 | | - | |
1049 | | - | |
| 1049 | + | |
| 1050 | + | |
1050 | 1051 | | |
1051 | 1052 | | |
1052 | 1053 | | |
| |||
1064 | 1065 | | |
1065 | 1066 | | |
1066 | 1067 | | |
1067 | | - | |
| 1068 | + | |
1068 | 1069 | | |
1069 | 1070 | | |
1070 | 1071 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
354 | 354 | | |
355 | 355 | | |
356 | 356 | | |
357 | | - | |
| 357 | + | |
358 | 358 | | |
359 | 359 | | |
360 | 360 | | |
| |||
388 | 388 | | |
389 | 389 | | |
390 | 390 | | |
391 | | - | |
392 | | - | |
| 391 | + | |
| 392 | + | |
393 | 393 | | |
394 | 394 | | |
395 | 395 | | |
| |||
502 | 502 | | |
503 | 503 | | |
504 | 504 | | |
505 | | - | |
| 505 | + | |
506 | 506 | | |
507 | 507 | | |
508 | 508 | | |
| |||
511 | 511 | | |
512 | 512 | | |
513 | 513 | | |
514 | | - | |
| 514 | + | |
515 | 515 | | |
516 | 516 | | |
517 | 517 | | |
| |||
539 | 539 | | |
540 | 540 | | |
541 | 541 | | |
542 | | - | |
| 542 | + | |
543 | 543 | | |
544 | 544 | | |
545 | 545 | | |
| |||
571 | 571 | | |
572 | 572 | | |
573 | 573 | | |
574 | | - | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
575 | 580 | | |
576 | 581 | | |
577 | 582 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
| 85 | + | |
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
210 | | - | |
| 210 | + | |
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
| |||
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
236 | | - | |
| 236 | + | |
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
| |||
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
268 | | - | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
269 | 274 | | |
270 | 275 | | |
271 | 276 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
535 | 535 | | |
536 | 536 | | |
537 | 537 | | |
538 | | - | |
| 538 | + | |
539 | 539 | | |
540 | 540 | | |
541 | 541 | | |
| |||
579 | 579 | | |
580 | 580 | | |
581 | 581 | | |
582 | | - | |
583 | | - | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
584 | 585 | | |
585 | 586 | | |
586 | 587 | | |
587 | 588 | | |
588 | | - | |
| 589 | + | |
589 | 590 | | |
590 | 591 | | |
591 | 592 | | |
| |||
596 | 597 | | |
597 | 598 | | |
598 | 599 | | |
599 | | - | |
| 600 | + | |
600 | 601 | | |
601 | 602 | | |
602 | 603 | | |
| |||
608 | 609 | | |
609 | 610 | | |
610 | 611 | | |
611 | | - | |
| 612 | + | |
612 | 613 | | |
613 | | - | |
| 614 | + | |
614 | 615 | | |
615 | 616 | | |
616 | 617 | | |
| |||
619 | 620 | | |
620 | 621 | | |
621 | 622 | | |
622 | | - | |
623 | | - | |
| 623 | + | |
| 624 | + | |
624 | 625 | | |
625 | 626 | | |
626 | | - | |
| 627 | + | |
627 | 628 | | |
628 | 629 | | |
629 | 630 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
264 | 264 | | |
265 | 265 | | |
266 | 266 | | |
267 | | - | |
| 267 | + | |
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
| |||
428 | 428 | | |
429 | 429 | | |
430 | 430 | | |
431 | | - | |
| 431 | + | |
432 | 432 | | |
433 | 433 | | |
434 | 434 | | |
| |||
482 | 482 | | |
483 | 483 | | |
484 | 484 | | |
485 | | - | |
| 485 | + | |
486 | 486 | | |
487 | 487 | | |
488 | 488 | | |
| |||
1065 | 1065 | | |
1066 | 1066 | | |
1067 | 1067 | | |
1068 | | - | |
| 1068 | + | |
1069 | 1069 | | |
1070 | 1070 | | |
1071 | 1071 | | |
| |||
0 commit comments