提交 e9287e55 编写于 作者: P Patrick Walton

rustc: Stub a --stack-growth option; it's behind a flag for now because it...

rustc: Stub a --stack-growth option; it's behind a flag for now because it requires patches to LLVM.
上级 f525f6e9
......@@ -263,6 +263,7 @@ fn usage(argv0: str) {
--no-typestate don't run the typestate pass (unsafe!)
--test build test harness
--gc garbage collect shared data (experimental/temporary)
--stack-growth perform stack checks (experimental)
");
}
......@@ -386,6 +387,7 @@ fn build_session_options(binary: str, match: getopts::match)
let cfg = parse_cfgspecs(getopts::opt_strs(match, "cfg"));
let test = opt_present(match, "test");
let do_gc = opt_present(match, "gc");
let stack_growth = opt_present(match, "stack-growth");
let sopts: @session::options =
@{library: library,
static: static,
......@@ -405,7 +407,8 @@ fn build_session_options(binary: str, match: getopts::match)
test: test,
parse_only: parse_only,
no_trans: no_trans,
do_gc: do_gc};
do_gc: do_gc,
stack_growth: stack_growth};
ret sopts;
}
......@@ -439,7 +442,8 @@ fn opts() -> [getopts::opt] {
optflag("time-passes"), optflag("time-llvm-passes"),
optflag("no-typestate"), optflag("noverify"),
optmulti("cfg"), optflag("test"),
optflag("lib"), optflag("static"), optflag("gc")];
optflag("lib"), optflag("static"), optflag("gc"),
optflag("stack-growth")];
}
fn main(args: [str]) {
......
......@@ -39,7 +39,8 @@
test: bool,
parse_only: bool,
no_trans: bool,
do_gc: bool};
do_gc: bool,
stack_growth: bool};
type crate_metadata = {name: str, data: [u8]};
......
......@@ -455,9 +455,9 @@ fn LLVMAddFunction(M: ModuleRef, Name: sbuf, FunctionTy: TypeRef) ->
fn LLVMSetFunctionCallConv(Fn: ValueRef, CC: uint);
fn LLVMGetGC(Fn: ValueRef) -> sbuf;
fn LLVMSetGC(Fn: ValueRef, Name: sbuf);
fn LLVMAddFunctionAttr(Fn: ValueRef, PA: Attribute);
fn LLVMAddFunctionAttr(Fn: ValueRef, PA: Attribute, HighPA: uint);
fn LLVMGetFunctionAttr(Fn: ValueRef) -> Attribute;
fn LLVMRemoveFunctionAttr(Fn: ValueRef, PA: Attribute);
fn LLVMRemoveFunctionAttr(Fn: ValueRef, PA: Attribute, HighPA: uint);
/* Operations on parameters */
fn LLVMCountParams(Fn: ValueRef) -> uint;
......
......@@ -1087,7 +1087,8 @@ fn get_static_tydesc(cx: @block_ctxt, orig_t: ty::t, ty_params: [uint],
fn set_no_inline(f: ValueRef) {
llvm::LLVMAddFunctionAttr(f,
lib::llvm::LLVMNoInlineAttribute as
lib::llvm::llvm::Attribute);
lib::llvm::llvm::Attribute,
0u);
}
// Tell LLVM to emit the information necessary to unwind the stack for the
......@@ -1095,13 +1096,20 @@ fn set_no_inline(f: ValueRef) {
fn set_uwtable(f: ValueRef) {
llvm::LLVMAddFunctionAttr(f,
lib::llvm::LLVMUWTableAttribute as
lib::llvm::llvm::Attribute);
lib::llvm::llvm::Attribute,
0u);
}
fn set_always_inline(f: ValueRef) {
llvm::LLVMAddFunctionAttr(f,
lib::llvm::LLVMAlwaysInlineAttribute as
lib::llvm::llvm::Attribute);
lib::llvm::llvm::Attribute,
0u);
}
fn set_custom_stack_growth_fn(f: ValueRef) {
// TODO: Remove this hack to work around the lack of u64 in the FFI.
llvm::LLVMAddFunctionAttr(f, 0 as lib::llvm::llvm::Attribute, 1u);
}
fn set_glue_inlining(cx: @local_ctxt, f: ValueRef, t: ty::t) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册