@@ -440,23 +440,36 @@ pub fn set_inline_hint(f: ValueRef) {
440
440
lib:: llvm:: SetFunctionAttribute ( f, lib:: llvm:: InlineHintAttribute )
441
441
}
442
442
443
- pub fn set_inline_hint_if_appr ( attrs : & [ ast:: Attribute ] ,
444
- llfn : ValueRef ) {
443
+ pub fn set_llvm_fn_attrs ( attrs : & [ ast:: Attribute ] , llfn : ValueRef ) {
445
444
use syntax:: attr:: * ;
445
+ // Set the inline hint if there is one
446
446
match find_inline_attr ( attrs) {
447
447
InlineHint => set_inline_hint ( llfn) ,
448
448
InlineAlways => set_always_inline ( llfn) ,
449
449
InlineNever => set_no_inline ( llfn) ,
450
450
InlineNone => { /* fallthrough */ }
451
451
}
452
+
453
+ // Add the no-split-stack attribute if requested
454
+ if contains_name ( attrs, "no_split_stack" ) {
455
+ set_no_split_stack ( llfn) ;
456
+ }
452
457
}
453
458
454
459
pub fn set_always_inline ( f : ValueRef ) {
455
460
lib:: llvm:: SetFunctionAttribute ( f, lib:: llvm:: AlwaysInlineAttribute )
456
461
}
457
462
458
463
pub fn set_fixed_stack_segment ( f : ValueRef ) {
459
- lib:: llvm:: SetFixedStackSegmentAttribute ( f) ;
464
+ do "fixed-stack-segment" . to_c_str ( ) . with_ref |buf| {
465
+ unsafe { llvm:: LLVMAddFunctionAttrString ( f, buf) ; }
466
+ }
467
+ }
468
+
469
+ pub fn set_no_split_stack ( f : ValueRef ) {
470
+ do "no-split-stack" . to_c_str ( ) . with_ref |buf| {
471
+ unsafe { llvm:: LLVMAddFunctionAttrString ( f, buf) ; }
472
+ }
460
473
}
461
474
462
475
pub fn set_glue_inlining ( f : ValueRef , t : ty:: t ) {
@@ -2444,7 +2457,7 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef {
2444
2457
} else {
2445
2458
foreign:: register_foreign_fn ( ccx, i. span , sym, i. id )
2446
2459
} ;
2447
- set_inline_hint_if_appr ( i. attrs , llfn) ;
2460
+ set_llvm_fn_attrs ( i. attrs , llfn) ;
2448
2461
llfn
2449
2462
}
2450
2463
@@ -2579,7 +2592,7 @@ pub fn register_method(ccx: @mut CrateContext,
2579
2592
let sym = exported_name ( ccx, path, mty, m. attrs ) ;
2580
2593
2581
2594
let llfn = register_fn ( ccx, m. span , sym, id, mty) ;
2582
- set_inline_hint_if_appr ( m. attrs , llfn) ;
2595
+ set_llvm_fn_attrs ( m. attrs , llfn) ;
2583
2596
llfn
2584
2597
}
2585
2598
0 commit comments