librustc: implement and use fixed_stack_segment
attribute for intrinsics.
This commit is contained in:
parent
4ff701b7db
commit
93c0888b6c
3 changed files with 19 additions and 2 deletions
|
@ -70,16 +70,28 @@ pub extern "rust-intrinsic" {
|
||||||
pub fn powif32(a: f32, x: i32) -> f32;
|
pub fn powif32(a: f32, x: i32) -> f32;
|
||||||
pub fn powif64(a: f64, x: i32) -> f64;
|
pub fn powif64(a: f64, x: i32) -> f64;
|
||||||
|
|
||||||
|
// the following kill the stack canary without
|
||||||
|
// `fixed_stack_segment`. This possibly only affects the f64
|
||||||
|
// variants, but it's hard to be sure since it seems to only
|
||||||
|
// occur with fairly specific arguments.
|
||||||
|
#[fixed_stack_segment]
|
||||||
pub fn sinf32(x: f32) -> f32;
|
pub fn sinf32(x: f32) -> f32;
|
||||||
|
#[fixed_stack_segment]
|
||||||
pub fn sinf64(x: f64) -> f64;
|
pub fn sinf64(x: f64) -> f64;
|
||||||
|
|
||||||
|
#[fixed_stack_segment]
|
||||||
pub fn cosf32(x: f32) -> f32;
|
pub fn cosf32(x: f32) -> f32;
|
||||||
|
#[fixed_stack_segment]
|
||||||
pub fn cosf64(x: f64) -> f64;
|
pub fn cosf64(x: f64) -> f64;
|
||||||
|
|
||||||
|
#[fixed_stack_segment]
|
||||||
pub fn powf32(a: f32, x: f32) -> f32;
|
pub fn powf32(a: f32, x: f32) -> f32;
|
||||||
|
#[fixed_stack_segment]
|
||||||
pub fn powf64(a: f64, x: f64) -> f64;
|
pub fn powf64(a: f64, x: f64) -> f64;
|
||||||
|
|
||||||
|
#[fixed_stack_segment]
|
||||||
pub fn expf32(x: f32) -> f32;
|
pub fn expf32(x: f32) -> f32;
|
||||||
|
#[fixed_stack_segment]
|
||||||
pub fn expf64(x: f64) -> f64;
|
pub fn expf64(x: f64) -> f64;
|
||||||
|
|
||||||
pub fn exp2f32(x: f32) -> f32;
|
pub fn exp2f32(x: f32) -> f32;
|
||||||
|
@ -128,4 +140,3 @@ pub extern "rust-intrinsic" {
|
||||||
pub fn bswap32(x: i32) -> i32;
|
pub fn bswap32(x: i32) -> i32;
|
||||||
pub fn bswap64(x: i64) -> i64;
|
pub fn bswap64(x: i64) -> i64;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -546,6 +546,7 @@ pub fn trans_intrinsic(ccx: @CrateContext,
|
||||||
item: @ast::foreign_item,
|
item: @ast::foreign_item,
|
||||||
path: ast_map::path,
|
path: ast_map::path,
|
||||||
substs: @param_substs,
|
substs: @param_substs,
|
||||||
|
attributes: &[ast::attribute],
|
||||||
ref_id: Option<ast::node_id>) {
|
ref_id: Option<ast::node_id>) {
|
||||||
debug!("trans_intrinsic(item.ident=%s)", *ccx.sess.str_of(item.ident));
|
debug!("trans_intrinsic(item.ident=%s)", *ccx.sess.str_of(item.ident));
|
||||||
|
|
||||||
|
@ -561,6 +562,11 @@ pub fn trans_intrinsic(ccx: @CrateContext,
|
||||||
Some(copy substs),
|
Some(copy substs),
|
||||||
Some(item.span));
|
Some(item.span));
|
||||||
|
|
||||||
|
// Set the fixed stack segment flag if necessary.
|
||||||
|
if attr::attrs_contains_name(attributes, "fixed_stack_segment") {
|
||||||
|
set_fixed_stack_segment(fcx.llfn);
|
||||||
|
}
|
||||||
|
|
||||||
let mut bcx = top_scope_block(fcx, None), lltop = bcx.llbb;
|
let mut bcx = top_scope_block(fcx, None), lltop = bcx.llbb;
|
||||||
match *ccx.sess.str_of(item.ident) {
|
match *ccx.sess.str_of(item.ident) {
|
||||||
~"atomic_cxchg" => {
|
~"atomic_cxchg" => {
|
||||||
|
|
|
@ -212,7 +212,7 @@ pub fn monomorphic_fn(ccx: @CrateContext,
|
||||||
}
|
}
|
||||||
ast_map::node_foreign_item(i, _, _, _) => {
|
ast_map::node_foreign_item(i, _, _, _) => {
|
||||||
let d = mk_lldecl();
|
let d = mk_lldecl();
|
||||||
foreign::trans_intrinsic(ccx, d, i, pt, psubsts.get(),
|
foreign::trans_intrinsic(ccx, d, i, pt, psubsts.get(), i.attrs,
|
||||||
ref_id);
|
ref_id);
|
||||||
d
|
d
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue