Skip to content
Snippets Groups Projects
Commit f3a9cae8 authored by rarbore2's avatar rarbore2
Browse files

Merge branch 'fix-frontend' into 'main'

fix Xdot check, get frontend to compile

See merge request !43
parents 374dbfd3 add16b35
No related branches found
No related tags found
1 merge request!43fix Xdot check, get frontend to compile
...@@ -14,7 +14,7 @@ mod types; ...@@ -14,7 +14,7 @@ mod types;
use codegen::*; use codegen::*;
use std::path::PathBuf; use std::path::Path;
extern crate hercules_ir; extern crate hercules_ir;
...@@ -62,7 +62,9 @@ fn main() { ...@@ -62,7 +62,9 @@ fn main() {
pm.add_pass(hercules_opt::pass::Pass::Verify); pm.add_pass(hercules_opt::pass::Pass::Verify);
} }
add_verified_pass!(pm, args, PhiElim); 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, CCP);
add_pass!(pm, args, DCE); add_pass!(pm, args, DCE);
add_pass!(pm, args, GVN); add_pass!(pm, args, GVN);
...@@ -77,17 +79,15 @@ fn main() { ...@@ -77,17 +79,15 @@ fn main() {
if args.x_dot { if args.x_dot {
pm.add_pass(hercules_opt::pass::Pass::Xdot(true)); pm.add_pass(hercules_opt::pass::Pass::Xdot(true));
} }
match args.output {
Some(file) => pm.add_pass(hercules_opt::pass::Pass::Codegen(file)), let src_file_path = Path::new(&src_file);
None => { let module_name = String::from(src_file_path.file_stem().unwrap().to_str().unwrap());
let mut path = PathBuf::from(src_file); let output_folder = match args.output {
path.set_extension("hbin"); Some(output_folder) => output_folder,
println!("{:?}", path); None => String::from(src_file_path.parent().unwrap().to_str().unwrap())
pm.add_pass(hercules_opt::pass::Pass::Codegen( };
path.to_str().unwrap().to_string(), pm.add_pass(hercules_opt::pass::Pass::Codegen(output_folder, module_name));
));
}
}
let _ = pm.run_passes(); let _ = pm.run_passes();
} }
Err(errs) => { 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