Compare commits

..

7 Commits

Author SHA1 Message Date
David Mak 966ce7a659 standalone: Add command line flags for target properties
For testing codegen for different platforms on the host system.
2023-09-12 18:45:46 +08:00
David Mak 5ea7a672e6 core: Switch to LLVM New Pass Manager 2023-09-12 18:45:19 +08:00
David Mak 894583eb13 core: Add target field to CodeGenLLVMOptions
For specifying the target machine options when optimizing and linking.
2023-09-12 18:45:19 +08:00
David Mak cb3939634e core: Add CodeGenTargetMachineOptions
Needed in a future commit.
2023-09-12 18:45:18 +08:00
Sebastien Bourdeauducq 66f07b5bf4 flake: switch to nixos-unstable 2023-09-12 18:14:39 +08:00
David Mak 008d50995c meta: Update run_demo.sh
- Allow more than one argument to nac3standalone executable
2023-09-12 16:20:50 +08:00
David Mak 474f9050ce standalone: Expose flags in command-line 2023-09-12 16:20:49 +08:00
3 changed files with 13 additions and 7 deletions

View File

@ -2,16 +2,16 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1693636127,
"narHash": "sha256-ZlS/lFGzK7BJXX2YVGnP3yZi3T9OLOEtBCyMJsb91U8=",
"lastModified": 1694183432,
"narHash": "sha256-YyPGNapgZNNj51ylQMw9lAgvxtM2ai1HZVUu3GS8Fng=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9075cba53e86dc318d159aee55dc9a7c9a4829c1",
"rev": "db9208ab987cdeeedf78ad9b4cf3c55f5ebd269b",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.05",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}

View File

@ -1,7 +1,7 @@
{
description = "The third-generation ARTIQ compiler";
inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-23.05;
inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable;
outputs = { self, nixpkgs }:
let

View File

@ -6,7 +6,7 @@ use inkwell::{
OptimizationLevel,
};
use parking_lot::{Mutex, RwLock};
use std::{borrow::Borrow, collections::HashMap, fs, mem::transmute, path::Path, sync::Arc};
use std::{borrow::Borrow, collections::HashMap, fs, path::Path, sync::Arc};
use nac3core::{
codegen::{
@ -207,7 +207,13 @@ fn main() {
.map(|arg| if arg == "native" { host_target_machine.cpu.clone() } else { arg })
.unwrap_or_default();
let target_features = target_features.unwrap_or_default();
let opt_level: OptimizationLevel = unsafe { transmute(opt_level) };
let opt_level = match opt_level {
0 => OptimizationLevel::None,
1 => OptimizationLevel::Less,
2 => OptimizationLevel::Default,
// The default behavior for -O<n> where n>3 defaults to O3 for both Clang and GCC
_ => OptimizationLevel::Aggressive,
};
let program = match fs::read_to_string(file_name.clone()) {
Ok(program) => program,