diff options
| author | Jubilee Young <workingjubilee@gmail.com> | 2024-05-04 15:41:52 -0700 |
|---|---|---|
| committer | Jubilee Young <workingjubilee@gmail.com> | 2024-06-23 00:36:33 -0700 |
| commit | 7c0b5cf99fc8c0f575d6e6304d4b3fc247beb298 (patch) | |
| tree | 4f6bbab1a4b0054dc1bec2469b6aa2aea4febbf3 | |
| parent | acb62737aca7045f331e7a05adc38bed213e278d (diff) | |
| download | rust-7c0b5cf99fc8c0f575d6e6304d4b3fc247beb298.tar.gz rust-7c0b5cf99fc8c0f575d6e6304d4b3fc247beb298.zip | |
compiler: Add FramePointer::ratchet
| -rw-r--r-- | compiler/rustc_target/src/spec/mod.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index 62ccc57f421..81ada30a594 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -1413,6 +1413,20 @@ pub enum FramePointer { MayOmit, } +impl FramePointer { + /// It is intended that the "force frame pointer" transition is "one way" + /// so this convenience assures such if used + #[inline] + pub fn ratchet(&mut self, rhs: FramePointer) -> FramePointer { + *self = match (*self, rhs) { + (FramePointer::Always, _) | (_, FramePointer::Always) => FramePointer::Always, + (FramePointer::NonLeaf, _) | (_, FramePointer::NonLeaf) => FramePointer::NonLeaf, + _ => FramePointer::MayOmit, + }; + *self + } +} + impl FromStr for FramePointer { type Err = (); fn from_str(s: &str) -> Result<Self, ()> { |
