diff --git a/nac3core/src/lib.rs b/nac3core/src/lib.rs index 80a0a6535..e122233b7 100644 --- a/nac3core/src/lib.rs +++ b/nac3core/src/lib.rs @@ -559,7 +559,7 @@ impl<'ctx> CodeGen<'ctx> { self.module.print_to_stderr(); } - pub fn output(&self) { + pub fn output(&self, filename: &str) { //let triple = TargetTriple::create("riscv32-none-linux-gnu"); let triple = TargetMachine::get_default_triple(); let target = Target::from_triple(&triple) @@ -577,7 +577,7 @@ impl<'ctx> CodeGen<'ctx> { .expect("couldn't create target machine"); target_machine - .write_to_file(&self.module, FileType::Object, Path::new("test.o")) + .write_to_file(&self.module, FileType::Object, Path::new(filename)) .expect("couldn't write module to file"); } } diff --git a/nac3standalone/demo.c b/nac3standalone/demo.c index 1aa111a44..beefe0b3e 100644 --- a/nac3standalone/demo.c +++ b/nac3standalone/demo.c @@ -1,4 +1,4 @@ -// clang -Wall -o demo demo.c test.o +// clang -Wall -o demo demo.c mandelbrot.o #include #include diff --git a/nac3standalone/test.py b/nac3standalone/mandelbrot.py similarity index 100% rename from nac3standalone/test.py rename to nac3standalone/mandelbrot.py diff --git a/nac3standalone/src/main.rs b/nac3standalone/src/main.rs index bd24df383..f42a4f324 100644 --- a/nac3standalone/src/main.rs +++ b/nac3standalone/src/main.rs @@ -10,7 +10,7 @@ use nac3core::CodeGen; fn main() { Target::initialize_all(&InitializationConfig::default()); - let program = match fs::read_to_string("test.py") { + let program = match fs::read_to_string("mandelbrot.py") { Ok(program) => program, Err(err) => { println!("Cannot open input file: {}", err); return; } }; @@ -26,5 +26,5 @@ fn main() { Err(err) => { println!("Compilation error: {}", err); return; } } codegen.print_ir(); - codegen.output(); + codegen.output("mandelbrot.o"); }