nac3standalone: renames

This commit is contained in:
Sebastien Bourdeauducq 2020-12-18 22:35:59 +08:00
parent 947a528656
commit 703059adab
4 changed files with 5 additions and 5 deletions

View File

@ -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");
}
}

View File

@ -1,4 +1,4 @@
// clang -Wall -o demo demo.c test.o
// clang -Wall -o demo demo.c mandelbrot.o
#include <stdio.h>
#include <string.h>

View File

@ -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");
}