forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#136684 - matthiaskrgr:rollup-mlpzre5, r=matth…
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#135973 (fix tail call checks wrt `#[track_caller]`) - rust-lang#136191 (compiler: replace few consts arrays with statics to remove const dupes) - rust-lang#136565 (compiler: Clean up weird `rustc_abi` reexports) - rust-lang#136582 (Revert "CI: build FreeBSD artifacts on FreeBSD 13.4") - rust-lang#136627 (MIR validation: add comment explaining the limitations of CfgChecker) - rust-lang#136634 (Stabilise `Cursor::{get_mut, set_position}` in `const` scenarios.) - rust-lang#136643 (ping me for attribute-related changes) - rust-lang#136644 (Add `rustc_hir_pretty::item_to_string` function) r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
46 changed files
with
369 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#[cfg(feature = "nightly")] | ||
use rustc_macros::HashStable_Generic; | ||
|
||
use crate::{Align, HasDataLayout, Size}; | ||
|
||
#[cfg_attr(feature = "nightly", derive(HashStable_Generic))] | ||
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] | ||
pub enum RegKind { | ||
Integer, | ||
Float, | ||
Vector, | ||
} | ||
|
||
#[cfg_attr(feature = "nightly", derive(HashStable_Generic))] | ||
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] | ||
pub struct Reg { | ||
pub kind: RegKind, | ||
pub size: Size, | ||
} | ||
|
||
macro_rules! reg_ctor { | ||
($name:ident, $kind:ident, $bits:expr) => { | ||
pub fn $name() -> Reg { | ||
Reg { kind: RegKind::$kind, size: Size::from_bits($bits) } | ||
} | ||
}; | ||
} | ||
|
||
impl Reg { | ||
reg_ctor!(i8, Integer, 8); | ||
reg_ctor!(i16, Integer, 16); | ||
reg_ctor!(i32, Integer, 32); | ||
reg_ctor!(i64, Integer, 64); | ||
reg_ctor!(i128, Integer, 128); | ||
|
||
reg_ctor!(f32, Float, 32); | ||
reg_ctor!(f64, Float, 64); | ||
} | ||
|
||
impl Reg { | ||
pub fn align<C: HasDataLayout>(&self, cx: &C) -> Align { | ||
let dl = cx.data_layout(); | ||
match self.kind { | ||
RegKind::Integer => match self.size.bits() { | ||
1 => dl.i1_align.abi, | ||
2..=8 => dl.i8_align.abi, | ||
9..=16 => dl.i16_align.abi, | ||
17..=32 => dl.i32_align.abi, | ||
33..=64 => dl.i64_align.abi, | ||
65..=128 => dl.i128_align.abi, | ||
_ => panic!("unsupported integer: {self:?}"), | ||
}, | ||
RegKind::Float => match self.size.bits() { | ||
16 => dl.f16_align.abi, | ||
32 => dl.f32_align.abi, | ||
64 => dl.f64_align.abi, | ||
128 => dl.f128_align.abi, | ||
_ => panic!("unsupported float: {self:?}"), | ||
}, | ||
RegKind::Vector => dl.vector_align(self.size).abi, | ||
} | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.