Eliminate more unnecessary calls to .iter().
This commit is contained in:
@@ -57,7 +57,7 @@ pub fn run(
|
|||||||
flag_optimize: bool,
|
flag_optimize: bool,
|
||||||
flag_check: bool,
|
flag_check: bool,
|
||||||
) -> Result<(), String> {
|
) -> Result<(), String> {
|
||||||
for filename in files.iter() {
|
for filename in files {
|
||||||
let path = Path::new(&filename);
|
let path = Path::new(&filename);
|
||||||
let name = String::from(path.as_os_str().to_string_lossy());
|
let name = String::from(path.as_os_str().to_string_lossy());
|
||||||
match handle_module(
|
match handle_module(
|
||||||
@@ -148,7 +148,7 @@ fn handle_module(
|
|||||||
terminal.fg(term::color::MAGENTA).unwrap();
|
terminal.fg(term::color::MAGENTA).unwrap();
|
||||||
vprint!(flag_verbose, "Checking... ");
|
vprint!(flag_verbose, "Checking... ");
|
||||||
terminal.reset().unwrap();
|
terminal.reset().unwrap();
|
||||||
for func in translation.functions.iter() {
|
for func in &translation.functions {
|
||||||
let il = match *func {
|
let il = match *func {
|
||||||
FunctionTranslation::Import() => continue,
|
FunctionTranslation::Import() => continue,
|
||||||
FunctionTranslation::Code { ref il, .. } => il.clone(),
|
FunctionTranslation::Code { ref il, .. } => il.clone(),
|
||||||
@@ -166,7 +166,7 @@ fn handle_module(
|
|||||||
terminal.fg(term::color::MAGENTA).unwrap();
|
terminal.fg(term::color::MAGENTA).unwrap();
|
||||||
vprint!(flag_verbose, "Optimizing... ");
|
vprint!(flag_verbose, "Optimizing... ");
|
||||||
terminal.reset().unwrap();
|
terminal.reset().unwrap();
|
||||||
for func in translation.functions.iter() {
|
for func in &translation.functions {
|
||||||
let mut il = match *func {
|
let mut il = match *func {
|
||||||
FunctionTranslation::Import() => continue,
|
FunctionTranslation::Import() => continue,
|
||||||
FunctionTranslation::Code { ref il, .. } => il.clone(),
|
FunctionTranslation::Code { ref il, .. } => il.clone(),
|
||||||
|
|||||||
@@ -433,7 +433,7 @@ impl Liveness {
|
|||||||
assert!(self.ebb_args.is_empty());
|
assert!(self.ebb_args.is_empty());
|
||||||
|
|
||||||
for ebb in func.layout.ebbs() {
|
for ebb in func.layout.ebbs() {
|
||||||
for &arg in func.dfg.ebb_args(ebb).iter() {
|
for &arg in func.dfg.ebb_args(ebb) {
|
||||||
let affinity = self.ranges.get(arg).unwrap().affinity;
|
let affinity = self.ranges.get(arg).unwrap().affinity;
|
||||||
if affinity.is_none() {
|
if affinity.is_none() {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -421,7 +421,7 @@ where
|
|||||||
// `use_var`'s traversal won't revisit these predecesors.
|
// `use_var`'s traversal won't revisit these predecesors.
|
||||||
let mut preds = Vec::new();
|
let mut preds = Vec::new();
|
||||||
mem::swap(&mut preds, &mut self.predecessors_mut(dest_ebb));
|
mem::swap(&mut preds, &mut self.predecessors_mut(dest_ebb));
|
||||||
for &(pred, last_inst) in preds.iter() {
|
for &(pred, last_inst) in &preds {
|
||||||
// For each predecessor, we query what is the local SSA value corresponding
|
// For each predecessor, we query what is the local SSA value corresponding
|
||||||
// to var and we put it as an argument of the branch instruction.
|
// to var and we put it as an argument of the branch instruction.
|
||||||
let (pred_val, mut local_side_effects) =
|
let (pred_val, mut local_side_effects) =
|
||||||
|
|||||||
@@ -69,8 +69,8 @@ fn handle_module(path: PathBuf) -> Result<(), String> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
for func in translation.functions.iter() {
|
for func in translation.functions {
|
||||||
let il = match *func {
|
let il = match func {
|
||||||
FunctionTranslation::Import() => continue,
|
FunctionTranslation::Import() => continue,
|
||||||
FunctionTranslation::Code { ref il, .. } => il.clone(),
|
FunctionTranslation::Code { ref il, .. } => il.clone(),
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user