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 debug: DebugOptions,
pub execution_method: ExecutionMethod,
pub debug_stages: HashSet<String>,
pub debug_passes: HashSet<String>,
}
#[derive(Debug, Serialize, Deserialize)]
pub enum ExecutionMethod {
@ -167,7 +167,7 @@ macro_rules! pass_chain_helper {
{
let pass_name = stringify!($pass);
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) {
Some(&mut $comp)
} else {

View File

@ -288,25 +288,25 @@ impl Repl {
}
}
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) {
Some(&"stages") => Some(stages.into_iter().intersperse(format!(" -> ")).collect()),
Some(&"passes") => Some(passes.into_iter().intersperse(format!(" -> ")).collect()),
b @ Some(&"show") | b @ Some(&"hide") => {
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(),
None => return Some(format!("Must specify a stage to debug")),
};
if let Some(stage) = stages.iter().find(|stage_name| **stage_name == debug_stage) {
let msg = format!("{} debug for stage {}", if show { "Enabling" } else { "Disabling" }, 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_pass);
if show {
self.options.debug_stages.insert(stage.clone());
self.options.debug_passes.insert(stage.clone());
} else {
self.options.debug_stages.remove(stage);
self.options.debug_passes.remove(stage);
}
Some(msg)
} else {
Some(format!("Couldn't find stage: {}", debug_stage))
Some(format!("Couldn't find stage: {}", debug_pass))
}
},
_ => Some(format!("Unknown debug command"))