stage -> pass

This commit is contained in:
greg 2018-05-03 09:40:11 -07:00
parent 86e88ee1bf
commit 73c3eeb69d
2 changed files with 10 additions and 10 deletions

View File

@ -8,7 +8,7 @@ pub struct LLVMCodeString(pub String);
pub struct EvalOptions { pub struct EvalOptions {
pub debug: DebugOptions, pub debug: DebugOptions,
pub execution_method: ExecutionMethod, pub execution_method: ExecutionMethod,
pub debug_stages: HashSet<String>, pub debug_passes: HashSet<String>,
} }
#[derive(Debug, Serialize, Deserialize)] #[derive(Debug, Serialize, Deserialize)]
pub enum ExecutionMethod { pub enum ExecutionMethod {
@ -167,7 +167,7 @@ macro_rules! pass_chain_helper {
{ {
let pass_name = stringify!($pass); let pass_name = stringify!($pass);
let output = { let output = {
let ref debug_set = $options.debug_stages; let ref debug_set = $options.debug_passes;
let debug_handle: Option<&mut UnfinishedComputation> = if debug_set.contains(pass_name) { let debug_handle: Option<&mut UnfinishedComputation> = if debug_set.contains(pass_name) {
Some(&mut $comp) Some(&mut $comp)
} else { } else {

View File

@ -288,25 +288,25 @@ impl Repl {
} }
} }
fn handle_debug(&mut self, commands: Vec<&str>) -> Option<String> { fn handle_debug(&mut self, commands: Vec<&str>) -> Option<String> {
let stages = self.get_cur_language().get_stages(); let passes = self.get_cur_language().get_stages();
match commands.get(1) { match commands.get(1) {
Some(&"stages") => Some(stages.into_iter().intersperse(format!(" -> ")).collect()), Some(&"passes") => Some(passes.into_iter().intersperse(format!(" -> ")).collect()),
b @ Some(&"show") | b @ Some(&"hide") => { b @ Some(&"show") | b @ Some(&"hide") => {
let show = b == Some(&"show"); let show = b == Some(&"show");
let debug_stage: String = match commands.get(2) { let debug_pass: String = match commands.get(2) {
Some(s) => s.to_string(), Some(s) => s.to_string(),
None => return Some(format!("Must specify a stage to debug")), None => return Some(format!("Must specify a stage to debug")),
}; };
if let Some(stage) = stages.iter().find(|stage_name| **stage_name == debug_stage) { if let Some(stage) = passes.iter().find(|stage_name| **stage_name == debug_pass) {
let msg = format!("{} debug for stage {}", if show { "Enabling" } else { "Disabling" }, debug_stage); let msg = format!("{} debug for stage {}", if show { "Enabling" } else { "Disabling" }, debug_pass);
if show { if show {
self.options.debug_stages.insert(stage.clone()); self.options.debug_passes.insert(stage.clone());
} else { } else {
self.options.debug_stages.remove(stage); self.options.debug_passes.remove(stage);
} }
Some(msg) Some(msg)
} else { } else {
Some(format!("Couldn't find stage: {}", debug_stage)) Some(format!("Couldn't find stage: {}", debug_pass))
} }
}, },
_ => Some(format!("Unknown debug command")) _ => Some(format!("Unknown debug command"))