Use function attribute "frame-pointer" instead of "no-frame-pointer-elim"
LLVM 8 (D56351) introduced "frame-pointer". In LLVM 10 (D71863), "no-frame-pointer-elim"/"no-frame-pointer-elim-non-leaf" will be ignored.
This commit is contained in:
parent
a9dd56ff9a
commit
b40dc30a3e
3 changed files with 19 additions and 9 deletions
|
@ -66,6 +66,14 @@ fn naked(val: &'ll Value, is_naked: bool) {
|
||||||
|
|
||||||
pub fn set_frame_pointer_elimination(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
|
pub fn set_frame_pointer_elimination(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
|
||||||
if cx.sess().must_not_eliminate_frame_pointers() {
|
if cx.sess().must_not_eliminate_frame_pointers() {
|
||||||
|
if llvm_util::get_major_version() >= 8 {
|
||||||
|
llvm::AddFunctionAttrStringValue(
|
||||||
|
llfn,
|
||||||
|
llvm::AttributePlace::Function,
|
||||||
|
const_cstr!("frame-pointer"),
|
||||||
|
const_cstr!("all"),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
llvm::AddFunctionAttrStringValue(
|
llvm::AddFunctionAttrStringValue(
|
||||||
llfn,
|
llfn,
|
||||||
llvm::AttributePlace::Function,
|
llvm::AttributePlace::Function,
|
||||||
|
@ -73,6 +81,7 @@ pub fn set_frame_pointer_elimination(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value)
|
||||||
const_cstr!("true"),
|
const_cstr!("true"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Tell LLVM what instrument function to insert.
|
/// Tell LLVM what instrument function to insert.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//
|
// min-llvm-version 8.0
|
||||||
// compile-flags: -C no-prepopulate-passes -C force-frame-pointers=y
|
// compile-flags: -C no-prepopulate-passes -C force-frame-pointers=y
|
||||||
|
|
||||||
#![crate_type="lib"]
|
#![crate_type="lib"]
|
||||||
|
|
||||||
// CHECK: attributes #{{.*}} "no-frame-pointer-elim"="true"
|
// CHECK: attributes #{{.*}} "frame-pointer"="all"
|
||||||
pub fn foo() {}
|
pub fn foo() {}
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
|
// min-llvm-version 8.0
|
||||||
// ignore-tidy-linelength
|
// ignore-tidy-linelength
|
||||||
// compile-flags: -Z instrument-mcount
|
// compile-flags: -Z instrument-mcount
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
// CHECK: attributes #{{.*}} "instrument-function-entry-inlined"="{{.*}}mcount{{.*}}" "no-frame-pointer-elim"="true"
|
// CHECK: attributes #{{.*}} "frame-pointer"="all" "instrument-function-entry-inlined"="{{.*}}mcount{{.*}}"
|
||||||
pub fn foo() {}
|
pub fn foo() {}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue