auto merge of #9717 : blake2-ppc/rust/rustc-static-str, r=alexcrichton
rustc: Use static strings in a few literals Avoid allocating extra copies of strings by using "" instead of ~"" for the debug options list and for the `time` function. This is a small change, but it is in a path that's always executed.
This commit is contained in:
commit
c5295f9c47
6 changed files with 90 additions and 91 deletions
|
@ -1007,9 +1007,9 @@ pub fn link_args(sess: Session,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let dir = cratepath.dirname();
|
let dir = cratepath.dirname();
|
||||||
if dir != ~"" { args.push(~"-L" + dir); }
|
if !dir.is_empty() { args.push("-L" + dir); }
|
||||||
let libarg = unlib(sess.targ_cfg, cratepath.filestem().unwrap().to_owned());
|
let libarg = unlib(sess.targ_cfg, cratepath.filestem().unwrap().to_owned());
|
||||||
args.push(~"-l" + libarg);
|
args.push("-l" + libarg);
|
||||||
}
|
}
|
||||||
|
|
||||||
let ula = cstore::get_used_link_args(cstore);
|
let ula = cstore::get_used_link_args(cstore);
|
||||||
|
@ -1032,12 +1032,12 @@ pub fn link_args(sess: Session,
|
||||||
// forces to make sure that library can be found at runtime.
|
// forces to make sure that library can be found at runtime.
|
||||||
|
|
||||||
for path in sess.opts.addl_lib_search_paths.iter() {
|
for path in sess.opts.addl_lib_search_paths.iter() {
|
||||||
args.push(~"-L" + path.to_str());
|
args.push("-L" + path.to_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
let rustpath = filesearch::rust_path();
|
let rustpath = filesearch::rust_path();
|
||||||
for path in rustpath.iter() {
|
for path in rustpath.iter() {
|
||||||
args.push(~"-L" + path.to_str());
|
args.push("-L" + path.to_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// The names of the extern libraries
|
// The names of the extern libraries
|
||||||
|
@ -1050,7 +1050,7 @@ pub fn link_args(sess: Session,
|
||||||
// On mac we need to tell the linker to let this library
|
// On mac we need to tell the linker to let this library
|
||||||
// be rpathed
|
// be rpathed
|
||||||
if sess.targ_cfg.os == session::OsMacos {
|
if sess.targ_cfg.os == session::OsMacos {
|
||||||
args.push(~"-Wl,-install_name,@rpath/"
|
args.push("-Wl,-install_name,@rpath/"
|
||||||
+ output.filename().unwrap());
|
+ output.filename().unwrap());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,7 @@ pub enum input {
|
||||||
|
|
||||||
pub fn phase_1_parse_input(sess: Session, cfg: ast::CrateConfig, input: &input)
|
pub fn phase_1_parse_input(sess: Session, cfg: ast::CrateConfig, input: &input)
|
||||||
-> ast::Crate {
|
-> ast::Crate {
|
||||||
time(sess.time_passes(), ~"parsing", (), |_| {
|
time(sess.time_passes(), "parsing", (), |_| {
|
||||||
match *input {
|
match *input {
|
||||||
file_input(ref file) => {
|
file_input(ref file) => {
|
||||||
parse::parse_crate_from_file(&(*file), cfg.clone(), sess.parse_sess)
|
parse::parse_crate_from_file(&(*file), cfg.clone(), sess.parse_sess)
|
||||||
|
@ -167,29 +167,29 @@ pub fn phase_2_configure_and_expand(sess: Session,
|
||||||
// mod bar { macro_rules! baz!(() => {{}}) }
|
// mod bar { macro_rules! baz!(() => {{}}) }
|
||||||
//
|
//
|
||||||
// baz! should not use this definition unless foo is enabled.
|
// baz! should not use this definition unless foo is enabled.
|
||||||
crate = time(time_passes, ~"std macros injection", crate, |crate|
|
crate = time(time_passes, "std macros injection", crate, |crate|
|
||||||
syntax::ext::expand::inject_std_macros(sess.parse_sess,
|
syntax::ext::expand::inject_std_macros(sess.parse_sess,
|
||||||
cfg.clone(),
|
cfg.clone(),
|
||||||
crate));
|
crate));
|
||||||
|
|
||||||
crate = time(time_passes, ~"configuration 1", crate, |crate|
|
crate = time(time_passes, "configuration 1", crate, |crate|
|
||||||
front::config::strip_unconfigured_items(crate));
|
front::config::strip_unconfigured_items(crate));
|
||||||
|
|
||||||
crate = time(time_passes, ~"expansion", crate, |crate|
|
crate = time(time_passes, "expansion", crate, |crate|
|
||||||
syntax::ext::expand::expand_crate(sess.parse_sess, cfg.clone(),
|
syntax::ext::expand::expand_crate(sess.parse_sess, cfg.clone(),
|
||||||
crate));
|
crate));
|
||||||
|
|
||||||
// strip again, in case expansion added anything with a #[cfg].
|
// strip again, in case expansion added anything with a #[cfg].
|
||||||
crate = time(time_passes, ~"configuration 2", crate, |crate|
|
crate = time(time_passes, "configuration 2", crate, |crate|
|
||||||
front::config::strip_unconfigured_items(crate));
|
front::config::strip_unconfigured_items(crate));
|
||||||
|
|
||||||
crate = time(time_passes, ~"maybe building test harness", crate, |crate|
|
crate = time(time_passes, "maybe building test harness", crate, |crate|
|
||||||
front::test::modify_for_testing(sess, crate));
|
front::test::modify_for_testing(sess, crate));
|
||||||
|
|
||||||
crate = time(time_passes, ~"std injection", crate, |crate|
|
crate = time(time_passes, "std injection", crate, |crate|
|
||||||
front::std_inject::maybe_inject_libstd_ref(sess, crate));
|
front::std_inject::maybe_inject_libstd_ref(sess, crate));
|
||||||
|
|
||||||
crate = time(time_passes, ~"assigning node ids", crate, |crate|
|
crate = time(time_passes, "assigning node ids", crate, |crate|
|
||||||
front::assign_node_ids::assign_node_ids(sess, crate));
|
front::assign_node_ids::assign_node_ids(sess, crate));
|
||||||
|
|
||||||
return crate;
|
return crate;
|
||||||
|
@ -211,17 +211,17 @@ pub fn phase_3_run_analysis_passes(sess: Session,
|
||||||
|
|
||||||
let time_passes = sess.time_passes();
|
let time_passes = sess.time_passes();
|
||||||
|
|
||||||
let ast_map = time(time_passes, ~"ast indexing", (), |_|
|
let ast_map = time(time_passes, "ast indexing", (), |_|
|
||||||
syntax::ast_map::map_crate(sess.diagnostic(), crate));
|
syntax::ast_map::map_crate(sess.diagnostic(), crate));
|
||||||
|
|
||||||
time(time_passes, ~"external crate/lib resolution", (), |_|
|
time(time_passes, "external crate/lib resolution", (), |_|
|
||||||
creader::read_crates(sess.diagnostic(), crate, sess.cstore,
|
creader::read_crates(sess.diagnostic(), crate, sess.cstore,
|
||||||
sess.filesearch,
|
sess.filesearch,
|
||||||
session::sess_os_to_meta_os(sess.targ_cfg.os),
|
session::sess_os_to_meta_os(sess.targ_cfg.os),
|
||||||
sess.opts.is_static,
|
sess.opts.is_static,
|
||||||
token::get_ident_interner()));
|
token::get_ident_interner()));
|
||||||
|
|
||||||
let lang_items = time(time_passes, ~"language item collection", (), |_|
|
let lang_items = time(time_passes, "language item collection", (), |_|
|
||||||
middle::lang_items::collect_language_items(crate, sess));
|
middle::lang_items::collect_language_items(crate, sess));
|
||||||
|
|
||||||
let middle::resolve::CrateMap {
|
let middle::resolve::CrateMap {
|
||||||
|
@ -229,19 +229,19 @@ pub fn phase_3_run_analysis_passes(sess: Session,
|
||||||
exp_map2: exp_map2,
|
exp_map2: exp_map2,
|
||||||
trait_map: trait_map
|
trait_map: trait_map
|
||||||
} =
|
} =
|
||||||
time(time_passes, ~"resolution", (), |_|
|
time(time_passes, "resolution", (), |_|
|
||||||
middle::resolve::resolve_crate(sess, lang_items, crate));
|
middle::resolve::resolve_crate(sess, lang_items, crate));
|
||||||
|
|
||||||
time(time_passes, ~"looking for entry point", (),
|
time(time_passes, "looking for entry point", (),
|
||||||
|_| middle::entry::find_entry_point(sess, crate, ast_map));
|
|_| middle::entry::find_entry_point(sess, crate, ast_map));
|
||||||
|
|
||||||
let freevars = time(time_passes, ~"freevar finding", (), |_|
|
let freevars = time(time_passes, "freevar finding", (), |_|
|
||||||
freevars::annotate_freevars(def_map, crate));
|
freevars::annotate_freevars(def_map, crate));
|
||||||
|
|
||||||
let region_map = time(time_passes, ~"region resolution", (), |_|
|
let region_map = time(time_passes, "region resolution", (), |_|
|
||||||
middle::region::resolve_crate(sess, def_map, crate));
|
middle::region::resolve_crate(sess, def_map, crate));
|
||||||
|
|
||||||
let rp_set = time(time_passes, ~"region parameterization inference", (), |_|
|
let rp_set = time(time_passes, "region parameterization inference", (), |_|
|
||||||
middle::region::determine_rp_in_crate(sess, ast_map, def_map, crate));
|
middle::region::determine_rp_in_crate(sess, ast_map, def_map, crate));
|
||||||
|
|
||||||
let ty_cx = ty::mk_ctxt(sess, def_map, ast_map, freevars,
|
let ty_cx = ty::mk_ctxt(sess, def_map, ast_map, freevars,
|
||||||
|
@ -252,53 +252,53 @@ pub fn phase_3_run_analysis_passes(sess: Session,
|
||||||
ty_cx, trait_map, crate);
|
ty_cx, trait_map, crate);
|
||||||
|
|
||||||
// These next two const passes can probably be merged
|
// These next two const passes can probably be merged
|
||||||
time(time_passes, ~"const marking", (), |_|
|
time(time_passes, "const marking", (), |_|
|
||||||
middle::const_eval::process_crate(crate, ty_cx));
|
middle::const_eval::process_crate(crate, ty_cx));
|
||||||
|
|
||||||
time(time_passes, ~"const checking", (), |_|
|
time(time_passes, "const checking", (), |_|
|
||||||
middle::check_const::check_crate(sess, crate, ast_map, def_map,
|
middle::check_const::check_crate(sess, crate, ast_map, def_map,
|
||||||
method_map, ty_cx));
|
method_map, ty_cx));
|
||||||
|
|
||||||
let exported_items =
|
let exported_items =
|
||||||
time(time_passes, ~"privacy checking", (), |_|
|
time(time_passes, "privacy checking", (), |_|
|
||||||
middle::privacy::check_crate(ty_cx, &method_map, &exp_map2, crate));
|
middle::privacy::check_crate(ty_cx, &method_map, &exp_map2, crate));
|
||||||
|
|
||||||
time(time_passes, ~"effect checking", (), |_|
|
time(time_passes, "effect checking", (), |_|
|
||||||
middle::effect::check_crate(ty_cx, method_map, crate));
|
middle::effect::check_crate(ty_cx, method_map, crate));
|
||||||
|
|
||||||
time(time_passes, ~"loop checking", (), |_|
|
time(time_passes, "loop checking", (), |_|
|
||||||
middle::check_loop::check_crate(ty_cx, crate));
|
middle::check_loop::check_crate(ty_cx, crate));
|
||||||
|
|
||||||
time(time_passes, ~"stack checking", (), |_|
|
time(time_passes, "stack checking", (), |_|
|
||||||
middle::stack_check::stack_check_crate(ty_cx, crate));
|
middle::stack_check::stack_check_crate(ty_cx, crate));
|
||||||
|
|
||||||
let middle::moves::MoveMaps {moves_map, moved_variables_set,
|
let middle::moves::MoveMaps {moves_map, moved_variables_set,
|
||||||
capture_map} =
|
capture_map} =
|
||||||
time(time_passes, ~"compute moves", (), |_|
|
time(time_passes, "compute moves", (), |_|
|
||||||
middle::moves::compute_moves(ty_cx, method_map, crate));
|
middle::moves::compute_moves(ty_cx, method_map, crate));
|
||||||
|
|
||||||
time(time_passes, ~"match checking", (), |_|
|
time(time_passes, "match checking", (), |_|
|
||||||
middle::check_match::check_crate(ty_cx, method_map,
|
middle::check_match::check_crate(ty_cx, method_map,
|
||||||
moves_map, crate));
|
moves_map, crate));
|
||||||
|
|
||||||
time(time_passes, ~"liveness checking", (), |_|
|
time(time_passes, "liveness checking", (), |_|
|
||||||
middle::liveness::check_crate(ty_cx, method_map,
|
middle::liveness::check_crate(ty_cx, method_map,
|
||||||
capture_map, crate));
|
capture_map, crate));
|
||||||
|
|
||||||
let (root_map, write_guard_map) =
|
let (root_map, write_guard_map) =
|
||||||
time(time_passes, ~"borrow checking", (), |_|
|
time(time_passes, "borrow checking", (), |_|
|
||||||
middle::borrowck::check_crate(ty_cx, method_map,
|
middle::borrowck::check_crate(ty_cx, method_map,
|
||||||
moves_map, moved_variables_set,
|
moves_map, moved_variables_set,
|
||||||
capture_map, crate));
|
capture_map, crate));
|
||||||
|
|
||||||
time(time_passes, ~"kind checking", (), |_|
|
time(time_passes, "kind checking", (), |_|
|
||||||
kind::check_crate(ty_cx, method_map, crate));
|
kind::check_crate(ty_cx, method_map, crate));
|
||||||
|
|
||||||
let reachable_map =
|
let reachable_map =
|
||||||
time(time_passes, ~"reachability checking", (), |_|
|
time(time_passes, "reachability checking", (), |_|
|
||||||
reachable::find_reachable(ty_cx, method_map, crate));
|
reachable::find_reachable(ty_cx, method_map, crate));
|
||||||
|
|
||||||
time(time_passes, ~"lint checking", (), |_|
|
time(time_passes, "lint checking", (), |_|
|
||||||
lint::check_crate(ty_cx, crate));
|
lint::check_crate(ty_cx, crate));
|
||||||
|
|
||||||
CrateAnalysis {
|
CrateAnalysis {
|
||||||
|
@ -328,7 +328,7 @@ pub fn phase_4_translate_to_llvm(sess: Session,
|
||||||
crate: ast::Crate,
|
crate: ast::Crate,
|
||||||
analysis: &CrateAnalysis,
|
analysis: &CrateAnalysis,
|
||||||
outputs: &OutputFilenames) -> CrateTranslation {
|
outputs: &OutputFilenames) -> CrateTranslation {
|
||||||
time(sess.time_passes(), ~"translation", crate, |crate|
|
time(sess.time_passes(), "translation", crate, |crate|
|
||||||
trans::base::trans_crate(sess, crate, analysis,
|
trans::base::trans_crate(sess, crate, analysis,
|
||||||
&outputs.obj_filename))
|
&outputs.obj_filename))
|
||||||
}
|
}
|
||||||
|
@ -349,7 +349,7 @@ pub fn phase_5_run_llvm_passes(sess: Session,
|
||||||
let output_type = link::output_type_assembly;
|
let output_type = link::output_type_assembly;
|
||||||
let asm_filename = outputs.obj_filename.with_filetype("s");
|
let asm_filename = outputs.obj_filename.with_filetype("s");
|
||||||
|
|
||||||
time(sess.time_passes(), ~"LLVM passes", (), |_|
|
time(sess.time_passes(), "LLVM passes", (), |_|
|
||||||
link::write::run_passes(sess,
|
link::write::run_passes(sess,
|
||||||
trans.context,
|
trans.context,
|
||||||
trans.module,
|
trans.module,
|
||||||
|
@ -363,7 +363,7 @@ pub fn phase_5_run_llvm_passes(sess: Session,
|
||||||
os::remove_file(&asm_filename);
|
os::remove_file(&asm_filename);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
time(sess.time_passes(), ~"LLVM passes", (), |_|
|
time(sess.time_passes(), "LLVM passes", (), |_|
|
||||||
link::write::run_passes(sess,
|
link::write::run_passes(sess,
|
||||||
trans.context,
|
trans.context,
|
||||||
trans.module,
|
trans.module,
|
||||||
|
@ -377,7 +377,7 @@ pub fn phase_5_run_llvm_passes(sess: Session,
|
||||||
pub fn phase_6_link_output(sess: Session,
|
pub fn phase_6_link_output(sess: Session,
|
||||||
trans: &CrateTranslation,
|
trans: &CrateTranslation,
|
||||||
outputs: &OutputFilenames) {
|
outputs: &OutputFilenames) {
|
||||||
time(sess.time_passes(), ~"linking", (), |_|
|
time(sess.time_passes(), "linking", (), |_|
|
||||||
link::link_binary(sess,
|
link::link_binary(sess,
|
||||||
&outputs.obj_filename,
|
&outputs.obj_filename,
|
||||||
&outputs.out_filename,
|
&outputs.out_filename,
|
||||||
|
@ -596,12 +596,12 @@ pub fn build_target_config(sopts: @session::options,
|
||||||
-> @session::config {
|
-> @session::config {
|
||||||
let os = match get_os(sopts.target_triple) {
|
let os = match get_os(sopts.target_triple) {
|
||||||
Some(os) => os,
|
Some(os) => os,
|
||||||
None => early_error(demitter, ~"unknown operating system")
|
None => early_error(demitter, "unknown operating system")
|
||||||
};
|
};
|
||||||
let arch = match get_arch(sopts.target_triple) {
|
let arch = match get_arch(sopts.target_triple) {
|
||||||
Some(arch) => arch,
|
Some(arch) => arch,
|
||||||
None => early_error(demitter,
|
None => early_error(demitter,
|
||||||
~"unknown architecture: " + sopts.target_triple)
|
"unknown architecture: " + sopts.target_triple)
|
||||||
};
|
};
|
||||||
let (int_type, uint_type) = match arch {
|
let (int_type, uint_type) = match arch {
|
||||||
abi::X86 => (ast::ty_i32, ast::ty_u32),
|
abi::X86 => (ast::ty_i32, ast::ty_u32),
|
||||||
|
@ -686,7 +686,7 @@ pub fn build_session_options(binary: @str,
|
||||||
let mut this_bit = 0u;
|
let mut this_bit = 0u;
|
||||||
for tuple in debug_map.iter() {
|
for tuple in debug_map.iter() {
|
||||||
let (name, bit) = match *tuple { (ref a, _, b) => (a, b) };
|
let (name, bit) = match *tuple { (ref a, _, b) => (a, b) };
|
||||||
if name == debug_flag { this_bit = bit; break; }
|
if *name == *debug_flag { this_bit = bit; break; }
|
||||||
}
|
}
|
||||||
if this_bit == 0u {
|
if this_bit == 0u {
|
||||||
early_error(demitter, format!("unknown debug flag: {}", *debug_flag))
|
early_error(demitter, format!("unknown debug flag: {}", *debug_flag))
|
||||||
|
@ -726,7 +726,7 @@ pub fn build_session_options(binary: @str,
|
||||||
No
|
No
|
||||||
} else if matches.opt_present("O") {
|
} else if matches.opt_present("O") {
|
||||||
if matches.opt_present("opt-level") {
|
if matches.opt_present("opt-level") {
|
||||||
early_error(demitter, ~"-O and --opt-level both provided");
|
early_error(demitter, "-O and --opt-level both provided");
|
||||||
}
|
}
|
||||||
Default
|
Default
|
||||||
} else if matches.opt_present("opt-level") {
|
} else if matches.opt_present("opt-level") {
|
||||||
|
@ -736,7 +736,7 @@ pub fn build_session_options(binary: @str,
|
||||||
~"2" => Default,
|
~"2" => Default,
|
||||||
~"3" => Aggressive,
|
~"3" => Aggressive,
|
||||||
_ => {
|
_ => {
|
||||||
early_error(demitter, ~"optimization level needs to be between 0-3")
|
early_error(demitter, "optimization level needs to be between 0-3")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else { No }
|
} else { No }
|
||||||
|
@ -1030,7 +1030,7 @@ pub fn build_output_filenames(input: &input,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn early_error(emitter: @diagnostic::Emitter, msg: ~str) -> ! {
|
pub fn early_error(emitter: @diagnostic::Emitter, msg: &str) -> ! {
|
||||||
emitter.emit(None, msg, diagnostic::fatal);
|
emitter.emit(None, msg, diagnostic::fatal);
|
||||||
fail2!();
|
fail2!();
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,61 +81,60 @@ pub static no_vectorize_slp: uint = 1 << 28;
|
||||||
pub static no_prepopulate_passes: uint = 1 << 29;
|
pub static no_prepopulate_passes: uint = 1 << 29;
|
||||||
pub static use_softfp: uint = 1 << 30;
|
pub static use_softfp: uint = 1 << 30;
|
||||||
|
|
||||||
pub fn debugging_opts_map() -> ~[(~str, ~str, uint)] {
|
pub fn debugging_opts_map() -> ~[(&'static str, &'static str, uint)] {
|
||||||
~[(~"verbose", ~"in general, enable more debug printouts", verbose),
|
~[("verbose", "in general, enable more debug printouts", verbose),
|
||||||
(~"time-passes", ~"measure time of each rustc pass", time_passes),
|
("time-passes", "measure time of each rustc pass", time_passes),
|
||||||
(~"count-llvm-insns", ~"count where LLVM \
|
("count-llvm-insns", "count where LLVM \
|
||||||
instrs originate", count_llvm_insns),
|
instrs originate", count_llvm_insns),
|
||||||
(~"time-llvm-passes", ~"measure time of each LLVM pass",
|
("time-llvm-passes", "measure time of each LLVM pass",
|
||||||
time_llvm_passes),
|
time_llvm_passes),
|
||||||
(~"trans-stats", ~"gather trans statistics", trans_stats),
|
("trans-stats", "gather trans statistics", trans_stats),
|
||||||
(~"asm-comments", ~"generate comments into the assembly (may change behavior)", asm_comments),
|
("asm-comments", "generate comments into the assembly (may change behavior)", asm_comments),
|
||||||
(~"no-verify", ~"skip LLVM verification", no_verify),
|
("no-verify", "skip LLVM verification", no_verify),
|
||||||
(~"trace", ~"emit trace logs", trace),
|
("trace", "emit trace logs", trace),
|
||||||
(~"coherence", ~"perform coherence checking", coherence),
|
("coherence", "perform coherence checking", coherence),
|
||||||
(~"borrowck-stats", ~"gather borrowck statistics", borrowck_stats),
|
("borrowck-stats", "gather borrowck statistics", borrowck_stats),
|
||||||
(~"borrowck-note-pure", ~"note where purity is req'd",
|
("borrowck-note-pure", "note where purity is req'd",
|
||||||
borrowck_note_pure),
|
borrowck_note_pure),
|
||||||
(~"borrowck-note-loan", ~"note where loans are req'd",
|
("borrowck-note-loan", "note where loans are req'd",
|
||||||
borrowck_note_loan),
|
borrowck_note_loan),
|
||||||
(~"no-landing-pads", ~"omit landing pads for unwinding",
|
("no-landing-pads", "omit landing pads for unwinding",
|
||||||
no_landing_pads),
|
no_landing_pads),
|
||||||
(~"debug-llvm", ~"enable debug output from LLVM", debug_llvm),
|
("debug-llvm", "enable debug output from LLVM", debug_llvm),
|
||||||
(~"count-type-sizes", ~"count the sizes of aggregate types",
|
("count-type-sizes", "count the sizes of aggregate types",
|
||||||
count_type_sizes),
|
count_type_sizes),
|
||||||
(~"meta-stats", ~"gather metadata statistics", meta_stats),
|
("meta-stats", "gather metadata statistics", meta_stats),
|
||||||
(~"no-opt", ~"do not optimize, even if -O is passed", no_opt),
|
("no-opt", "do not optimize, even if -O is passed", no_opt),
|
||||||
(~"print-link-args", ~"Print the arguments passed to the linker", print_link_args),
|
("print-link-args", "Print the arguments passed to the linker", print_link_args),
|
||||||
(~"gc", ~"Garbage collect shared data (experimental)", gc),
|
("gc", "Garbage collect shared data (experimental)", gc),
|
||||||
(~"jit", ~"Execute using JIT (experimental)", jit),
|
("jit", "Execute using JIT (experimental)", jit),
|
||||||
(~"extra-debug-info", ~"Extra debugging info (experimental)",
|
("extra-debug-info", "Extra debugging info (experimental)",
|
||||||
extra_debug_info),
|
extra_debug_info),
|
||||||
(~"debug-info", ~"Produce debug info (experimental)", debug_info),
|
("debug-info", "Produce debug info (experimental)", debug_info),
|
||||||
(~"static", ~"Use or produce static libraries or binaries " +
|
("static", "Use or produce static libraries or binaries (experimental)", statik),
|
||||||
"(experimental)", statik),
|
("no-debug-borrows",
|
||||||
(~"no-debug-borrows",
|
"do not show where borrow checks fail",
|
||||||
~"do not show where borrow checks fail",
|
|
||||||
no_debug_borrows),
|
no_debug_borrows),
|
||||||
(~"lint-llvm",
|
("lint-llvm",
|
||||||
~"Run the LLVM lint pass on the pre-optimization IR",
|
"Run the LLVM lint pass on the pre-optimization IR",
|
||||||
lint_llvm),
|
lint_llvm),
|
||||||
(~"once-fns",
|
("once-fns",
|
||||||
~"Allow 'once fn' closures to deinitialize captured variables",
|
"Allow 'once fn' closures to deinitialize captured variables",
|
||||||
once_fns),
|
once_fns),
|
||||||
(~"print-llvm-passes",
|
("print-llvm-passes",
|
||||||
~"Prints the llvm optimization passes being run",
|
"Prints the llvm optimization passes being run",
|
||||||
print_llvm_passes),
|
print_llvm_passes),
|
||||||
(~"no-prepopulate-passes",
|
("no-prepopulate-passes",
|
||||||
~"Don't pre-populate the pass managers with a list of passes, only use \
|
"Don't pre-populate the pass managers with a list of passes, only use \
|
||||||
the passes from --passes",
|
the passes from --passes",
|
||||||
no_prepopulate_passes),
|
no_prepopulate_passes),
|
||||||
(~"no-vectorize-loops",
|
("no-vectorize-loops",
|
||||||
~"Don't run the loop vectorization optimization passes",
|
"Don't run the loop vectorization optimization passes",
|
||||||
no_vectorize_loops),
|
no_vectorize_loops),
|
||||||
(~"no-vectorize-slp",
|
("no-vectorize-slp",
|
||||||
~"Don't run LLVM's SLP vectorization passes",
|
"Don't run LLVM's SLP vectorization passes",
|
||||||
no_vectorize_slp),
|
no_vectorize_slp),
|
||||||
(~"soft-float", ~"Generate software floating point library calls", use_softfp),
|
("soft-float", "Generate software floating point library calls", use_softfp),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -447,17 +447,17 @@ pub fn check_crate(tcx: ty::ctxt,
|
||||||
tcx: tcx
|
tcx: tcx
|
||||||
};
|
};
|
||||||
|
|
||||||
time(time_passes, ~"type collecting", (), |_|
|
time(time_passes, "type collecting", (), |_|
|
||||||
collect::collect_item_types(ccx, crate));
|
collect::collect_item_types(ccx, crate));
|
||||||
|
|
||||||
// this ensures that later parts of type checking can assume that items
|
// this ensures that later parts of type checking can assume that items
|
||||||
// have valid types and not error
|
// have valid types and not error
|
||||||
tcx.sess.abort_if_errors();
|
tcx.sess.abort_if_errors();
|
||||||
|
|
||||||
time(time_passes, ~"coherence checking", (), |_|
|
time(time_passes, "coherence checking", (), |_|
|
||||||
coherence::check_coherence(ccx, crate));
|
coherence::check_coherence(ccx, crate));
|
||||||
|
|
||||||
time(time_passes, ~"type checking", (), |_|
|
time(time_passes, "type checking", (), |_|
|
||||||
check::check_item_types(ccx, crate));
|
check::check_item_types(ccx, crate));
|
||||||
|
|
||||||
check_for_entry_fn(ccx);
|
check_for_entry_fn(ccx);
|
||||||
|
|
|
@ -243,7 +243,7 @@ pub fn run_compiler(args: &[~str], demitter: @diagnostic::Emitter) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let input = match matches.free.len() {
|
let input = match matches.free.len() {
|
||||||
0u => early_error(demitter, ~"no input filename given"),
|
0u => early_error(demitter, "no input filename given"),
|
||||||
1u => {
|
1u => {
|
||||||
let ifile = matches.free[0].as_slice();
|
let ifile = matches.free[0].as_slice();
|
||||||
if "-" == ifile {
|
if "-" == ifile {
|
||||||
|
@ -253,7 +253,7 @@ pub fn run_compiler(args: &[~str], demitter: @diagnostic::Emitter) {
|
||||||
file_input(Path(ifile))
|
file_input(Path(ifile))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => early_error(demitter, ~"multiple input filenames provided")
|
_ => early_error(demitter, "multiple input filenames provided")
|
||||||
};
|
};
|
||||||
|
|
||||||
let sopts = build_session_options(binary, matches, demitter);
|
let sopts = build_session_options(binary, matches, demitter);
|
||||||
|
@ -278,7 +278,7 @@ pub fn run_compiler(args: &[~str], demitter: @diagnostic::Emitter) {
|
||||||
list_metadata(sess, &(*ifile), io::stdout());
|
list_metadata(sess, &(*ifile), io::stdout());
|
||||||
}
|
}
|
||||||
str_input(_) => {
|
str_input(_) => {
|
||||||
early_error(demitter, ~"can not list metadata for stdin");
|
early_error(demitter, "can not list metadata for stdin");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -17,7 +17,7 @@ use syntax::visit::Visitor;
|
||||||
use std::hashmap::HashSet;
|
use std::hashmap::HashSet;
|
||||||
use extra;
|
use extra;
|
||||||
|
|
||||||
pub fn time<T, U>(do_it: bool, what: ~str, u: U, f: &fn(U) -> T) -> T {
|
pub fn time<T, U>(do_it: bool, what: &str, u: U, f: &fn(U) -> T) -> T {
|
||||||
if !do_it { return f(u); }
|
if !do_it { return f(u); }
|
||||||
let start = extra::time::precise_time_s();
|
let start = extra::time::precise_time_s();
|
||||||
let rv = f(u);
|
let rv = f(u);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue