rustc: Add a -noverify option
This commit is contained in:
parent
d1b9ddc8d4
commit
1080ac5349
2 changed files with 20 additions and 11 deletions
|
|
@ -61,6 +61,7 @@ fn compile_input(session.session sess,
|
|||
str input, str output,
|
||||
bool shared,
|
||||
bool optimize,
|
||||
bool verify,
|
||||
trans.output_type ot,
|
||||
vec[str] library_search_paths) {
|
||||
auto def = tup(0, 0);
|
||||
|
|
@ -76,7 +77,7 @@ fn compile_input(session.session sess,
|
|||
// FIXME: uncomment once typestate_check works
|
||||
// crate = typestate_check.check_crate(crate);
|
||||
trans.trans_crate(sess, crate, type_cache, output, shared, optimize,
|
||||
ot);
|
||||
verify, ot);
|
||||
}
|
||||
|
||||
fn pretty_print_input(session.session sess,
|
||||
|
|
@ -106,6 +107,7 @@ options:
|
|||
-pp pretty-print the input instead of compiling
|
||||
-ls list the symbols defined by a crate file
|
||||
-L <path> add a directory to the library search path
|
||||
-noverify suppress LLVM verification step (slight speedup)
|
||||
-h display this message\n\n");
|
||||
}
|
||||
|
||||
|
|
@ -140,6 +142,7 @@ fn main(vec[str] args) {
|
|||
let bool ls = false;
|
||||
auto ot = trans.output_type_bitcode;
|
||||
let bool glue = false;
|
||||
let bool verify = true;
|
||||
|
||||
// FIXME: Maybe we should support -O0, -O1, -Os, etc
|
||||
let bool optimize = false;
|
||||
|
|
@ -185,6 +188,8 @@ fn main(vec[str] args) {
|
|||
usage(sess, args.(0));
|
||||
sess.err("-L requires an argument");
|
||||
}
|
||||
} else if (_str.eq(arg, "-noverify")) {
|
||||
verify = false;
|
||||
} else if (_str.eq(arg, "-h")) {
|
||||
usage(sess, args.(0));
|
||||
} else {
|
||||
|
|
@ -212,10 +217,11 @@ fn main(vec[str] args) {
|
|||
if (glue) {
|
||||
alt (output_file) {
|
||||
case (none[str]) {
|
||||
middle.trans.make_common_glue("glue.bc", optimize, ot);
|
||||
middle.trans.make_common_glue("glue.bc", optimize, verify,
|
||||
ot);
|
||||
}
|
||||
case (some[str](?s)) {
|
||||
middle.trans.make_common_glue(s, optimize, ot);
|
||||
middle.trans.make_common_glue(s, optimize, verify, ot);
|
||||
}
|
||||
}
|
||||
ret;
|
||||
|
|
@ -241,12 +247,12 @@ fn main(vec[str] args) {
|
|||
parts += vec(".bc");
|
||||
auto ofile = _str.concat(parts);
|
||||
compile_input(sess, env, ifile, ofile, shared,
|
||||
optimize, ot,
|
||||
optimize, verify, ot,
|
||||
library_search_paths);
|
||||
}
|
||||
case (some[str](?ofile)) {
|
||||
compile_input(sess, env, ifile, ofile, shared,
|
||||
optimize, ot,
|
||||
optimize, verify, ot,
|
||||
library_search_paths);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6965,7 +6965,7 @@ fn is_object_or_assembly(output_type ot) -> bool {
|
|||
ret false;
|
||||
}
|
||||
|
||||
fn run_passes(ModuleRef llmod, bool opt, str output,
|
||||
fn run_passes(ModuleRef llmod, bool opt, bool verify, str output,
|
||||
output_type ot) {
|
||||
auto pm = mk_pass_manager();
|
||||
|
||||
|
|
@ -7030,7 +7030,10 @@ fn run_passes(ModuleRef llmod, bool opt, str output,
|
|||
llvm.LLVMAddDeadTypeEliminationPass(pm.llpm);
|
||||
llvm.LLVMAddConstantMergePass(pm.llpm);
|
||||
}
|
||||
llvm.LLVMAddVerifierPass(pm.llpm);
|
||||
|
||||
if (verify) {
|
||||
llvm.LLVMAddVerifierPass(pm.llpm);
|
||||
}
|
||||
|
||||
if (is_object_or_assembly(ot)) {
|
||||
let int LLVMAssemblyFile = 0;
|
||||
|
|
@ -7385,7 +7388,7 @@ fn make_glues(ModuleRef llmod, type_names tn) -> @glue_fns {
|
|||
vec_append_glue = make_vec_append_glue(llmod, tn));
|
||||
}
|
||||
|
||||
fn make_common_glue(str output, bool optimize,
|
||||
fn make_common_glue(str output, bool optimize, bool verify,
|
||||
output_type ot) {
|
||||
// FIXME: part of this is repetitive and is probably a good idea
|
||||
// to autogen it, but things like the memcpy implementation are not
|
||||
|
|
@ -7412,7 +7415,7 @@ fn make_common_glue(str output, bool optimize,
|
|||
|
||||
trans_exit_task_glue(glues, new_str_hash[ValueRef](), tn, llmod);
|
||||
|
||||
run_passes(llmod, optimize, output, ot);
|
||||
run_passes(llmod, optimize, verify, output, ot);
|
||||
}
|
||||
|
||||
fn create_module_map(@crate_ctxt ccx) -> ValueRef {
|
||||
|
|
@ -7465,7 +7468,7 @@ fn create_crate_map(@crate_ctxt ccx) -> ValueRef {
|
|||
|
||||
fn trans_crate(session.session sess, @ast.crate crate,
|
||||
&ty.type_cache type_cache, str output, bool shared,
|
||||
bool optimize, output_type ot) {
|
||||
bool optimize, bool verify, output_type ot) {
|
||||
auto llmod =
|
||||
llvm.LLVMModuleCreateWithNameInContext(_str.buf("rust_out"),
|
||||
llvm.LLVMGetGlobalContext());
|
||||
|
|
@ -7535,7 +7538,7 @@ fn trans_crate(session.session sess, @ast.crate crate,
|
|||
// Translate the metadata.
|
||||
middle.metadata.write_metadata(cx.ccx, crate);
|
||||
|
||||
run_passes(llmod, optimize, output, ot);
|
||||
run_passes(llmod, optimize, verify, output, ot);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue