Add support for leaf fn frame pointer elimination
This PR adds ability for the target specifications to specify frame pointer emission type that's not just “always” or “whatever cg decides”. In particular there's a new mode that allows omission of the frame pointer for leaf functions (those that don't call any other functions). We then set this new mode for Aarch64-based Apple targets. Fixes #86196
This commit is contained in:
parent
3ddb78a346
commit
9b67cba4f6
24 changed files with 149 additions and 60 deletions
|
@ -792,18 +792,6 @@ impl Session {
|
|||
!self.target.is_like_windows && !self.target.is_like_osx
|
||||
}
|
||||
|
||||
pub fn must_not_eliminate_frame_pointers(&self) -> bool {
|
||||
// "mcount" function relies on stack pointer.
|
||||
// See <https://sourceware.org/binutils/docs/gprof/Implementation.html>.
|
||||
if self.instrument_mcount() {
|
||||
true
|
||||
} else if let Some(x) = self.opts.cg.force_frame_pointers {
|
||||
x
|
||||
} else {
|
||||
!self.target.eliminate_frame_pointer
|
||||
}
|
||||
}
|
||||
|
||||
pub fn must_emit_unwind_tables(&self) -> bool {
|
||||
// This is used to control the emission of the `uwtable` attribute on
|
||||
// LLVM functions.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue