Skip to content

Commit b9eb6fd

Browse files
compiler: Add FramePointer::ratchet
1 parent 1a851da commit b9eb6fd

File tree

1 file changed

+14
-0
lines changed
  • compiler/rustc_target/src/spec

1 file changed

+14
-0
lines changed

compiler/rustc_target/src/spec/mod.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,6 +1385,20 @@ pub enum FramePointer {
13851385
MayOmit,
13861386
}
13871387

1388+
impl FramePointer {
1389+
/// It is intended that the "force frame pointer" transition is "one way"
1390+
/// so this convenience assures such if used
1391+
#[inline]
1392+
pub fn ratchet(&mut self, rhs: FramePointer) -> FramePointer {
1393+
*self = match (*self, rhs) {
1394+
(FramePointer::Always, _) | (_, FramePointer::Always) => FramePointer::Always,
1395+
(FramePointer::NonLeaf, _) | (_, FramePointer::NonLeaf) => FramePointer::NonLeaf,
1396+
_ => FramePointer::MayOmit,
1397+
};
1398+
*self
1399+
}
1400+
}
1401+
13881402
impl FromStr for FramePointer {
13891403
type Err = ();
13901404
fn from_str(s: &str) -> Result<Self, ()> {

0 commit comments

Comments
 (0)