librustc: implement and use fixed_stack_segment
attribute for intrinsics.
This commit is contained in:
parent
4ff701b7db
commit
93c0888b6c
@ -70,16 +70,28 @@ pub extern "rust-intrinsic" {
|
||||
pub fn powif32(a: f32, x: i32) -> f32;
|
||||
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;
|
||||
#[fixed_stack_segment]
|
||||
pub fn sinf64(x: f64) -> f64;
|
||||
|
||||
#[fixed_stack_segment]
|
||||
pub fn cosf32(x: f32) -> f32;
|
||||
#[fixed_stack_segment]
|
||||
pub fn cosf64(x: f64) -> f64;
|
||||
|
||||
#[fixed_stack_segment]
|
||||
pub fn powf32(a: f32, x: f32) -> f32;
|
||||
#[fixed_stack_segment]
|
||||
pub fn powf64(a: f64, x: f64) -> f64;
|
||||
|
||||
#[fixed_stack_segment]
|
||||
pub fn expf32(x: f32) -> f32;
|
||||
#[fixed_stack_segment]
|
||||
pub fn expf64(x: f64) -> f64;
|
||||
|
||||
pub fn exp2f32(x: f32) -> f32;
|
||||
@ -128,4 +140,3 @@ pub extern "rust-intrinsic" {
|
||||
pub fn bswap32(x: i32) -> i32;
|
||||
pub fn bswap64(x: i64) -> i64;
|
||||
}
|
||||
|
||||
|
@ -546,6 +546,7 @@ pub fn trans_intrinsic(ccx: @CrateContext,
|
||||
item: @ast::foreign_item,
|
||||
path: ast_map::path,
|
||||
substs: @param_substs,
|
||||
attributes: &[ast::attribute],
|
||||
ref_id: Option<ast::node_id>) {
|
||||
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(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;
|
||||
match *ccx.sess.str_of(item.ident) {
|
||||
~"atomic_cxchg" => {
|
||||
|
@ -212,7 +212,7 @@ pub fn monomorphic_fn(ccx: @CrateContext,
|
||||
}
|
||||
ast_map::node_foreign_item(i, _, _, _) => {
|
||||
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);
|
||||
d
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user