Skip to content
Snippets Groups Projects
Commit add16b35 authored by Ryan Ziegler's avatar Ryan Ziegler
Browse files

fix Xdot check, get frontend to compile

parent 374dbfd3
No related branches found
No related tags found
1 merge request!43fix Xdot check, get frontend to compile
......@@ -14,7 +14,7 @@ mod types;
use codegen::*;
use std::path::PathBuf;
use std::path::Path;
extern crate hercules_ir;
......@@ -62,7 +62,9 @@ fn main() {
pm.add_pass(hercules_opt::pass::Pass::Verify);
}
add_verified_pass!(pm, args, PhiElim);
pm.add_pass(hercules_opt::pass::Pass::Xdot(true));
if args.x_dot {
pm.add_pass(hercules_opt::pass::Pass::Xdot(true));
}
add_pass!(pm, args, CCP);
add_pass!(pm, args, DCE);
add_pass!(pm, args, GVN);
......@@ -77,17 +79,15 @@ fn main() {
if args.x_dot {
pm.add_pass(hercules_opt::pass::Pass::Xdot(true));
}
match args.output {
Some(file) => pm.add_pass(hercules_opt::pass::Pass::Codegen(file)),
None => {
let mut path = PathBuf::from(src_file);
path.set_extension("hbin");
println!("{:?}", path);
pm.add_pass(hercules_opt::pass::Pass::Codegen(
path.to_str().unwrap().to_string(),
));
}
}
let src_file_path = Path::new(&src_file);
let module_name = String::from(src_file_path.file_stem().unwrap().to_str().unwrap());
let output_folder = match args.output {
Some(output_folder) => output_folder,
None => String::from(src_file_path.parent().unwrap().to_str().unwrap())
};
pm.add_pass(hercules_opt::pass::Pass::Codegen(output_folder, module_name));
let _ = pm.run_passes();
}
Err(errs) => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment