Compare commits
3 Commits
71e6fd65ab
...
2110638bfe
Author | SHA1 | Date |
---|---|---|
|
2110638bfe | |
|
2209702a06 | |
|
0d2eacb332 |
|
@ -9,6 +9,7 @@ use inkwell::{
|
||||||
memory_buffer::MemoryBuffer,
|
memory_buffer::MemoryBuffer,
|
||||||
module::{Linkage, Module},
|
module::{Linkage, Module},
|
||||||
passes::PassBuilderOptions,
|
passes::PassBuilderOptions,
|
||||||
|
support::is_multithreaded,
|
||||||
targets::*,
|
targets::*,
|
||||||
OptimizationLevel,
|
OptimizationLevel,
|
||||||
};
|
};
|
||||||
|
@ -582,7 +583,8 @@ impl Nac3 {
|
||||||
membuffer.lock().push(buffer);
|
membuffer.lock().push(buffer);
|
||||||
})));
|
})));
|
||||||
let size_t = if self.isa == Isa::Host { 64 } else { 32 };
|
let size_t = if self.isa == Isa::Host { 64 } else { 32 };
|
||||||
let thread_names: Vec<String> = (0..4).map(|_| "main".to_string()).collect();
|
let num_threads = if is_multithreaded() { 4 } else { 1 };
|
||||||
|
let thread_names: Vec<String> = (0..num_threads).map(|_| "main".to_string()).collect();
|
||||||
let threads: Vec<_> = thread_names
|
let threads: Vec<_> = thread_names
|
||||||
.iter()
|
.iter()
|
||||||
.map(|s| Box::new(ArtiqCodeGenerator::new(s.to_string(), size_t, self.time_fns)))
|
.map(|s| Box::new(ArtiqCodeGenerator::new(s.to_string(), size_t, self.time_fns)))
|
||||||
|
|
|
@ -2,6 +2,7 @@ use clap::Parser;
|
||||||
use inkwell::{
|
use inkwell::{
|
||||||
memory_buffer::MemoryBuffer,
|
memory_buffer::MemoryBuffer,
|
||||||
passes::PassBuilderOptions,
|
passes::PassBuilderOptions,
|
||||||
|
support::is_multithreaded,
|
||||||
targets::*,
|
targets::*,
|
||||||
OptimizationLevel,
|
OptimizationLevel,
|
||||||
};
|
};
|
||||||
|
@ -39,7 +40,7 @@ struct CommandLineArgs {
|
||||||
file_name: String,
|
file_name: String,
|
||||||
|
|
||||||
/// The number of threads allocated to processing the source file.
|
/// The number of threads allocated to processing the source file.
|
||||||
#[arg(default_value_t = 1)]
|
#[arg(short = 'T', default_value_t = 1)]
|
||||||
threads: u32,
|
threads: u32,
|
||||||
|
|
||||||
/// The level to optimize the LLVM IR.
|
/// The level to optimize the LLVM IR.
|
||||||
|
@ -207,6 +208,14 @@ fn main() {
|
||||||
.map(|arg| if arg == "native" { host_target_machine.cpu.clone() } else { arg })
|
.map(|arg| if arg == "native" { host_target_machine.cpu.clone() } else { arg })
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
let target_features = target_features.unwrap_or_default();
|
let target_features = target_features.unwrap_or_default();
|
||||||
|
let threads = if is_multithreaded() {
|
||||||
|
threads
|
||||||
|
} else {
|
||||||
|
if threads > 1 {
|
||||||
|
println!("Warning: Number of threads specified in command-line but multithreading is disabled in LLVM at build time! Defaulting to single-threaded compilation")
|
||||||
|
}
|
||||||
|
1
|
||||||
|
};
|
||||||
let opt_level = match opt_level {
|
let opt_level = match opt_level {
|
||||||
0 => OptimizationLevel::None,
|
0 => OptimizationLevel::None,
|
||||||
1 => OptimizationLevel::Less,
|
1 => OptimizationLevel::Less,
|
||||||
|
|
|
@ -112,7 +112,7 @@ in stdenv.mkDerivation (rec {
|
||||||
"-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
|
"-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
|
||||||
"-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
|
"-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
|
||||||
"-DLLVM_ENABLE_UNWIND_TABLES=OFF"
|
"-DLLVM_ENABLE_UNWIND_TABLES=OFF"
|
||||||
"-DLLVM_ENABLE_THREADS=OFF"
|
"-DLLVM_ENABLE_THREADS=ON"
|
||||||
"-DLLVM_INCLUDE_BENCHMARKS=OFF"
|
"-DLLVM_INCLUDE_BENCHMARKS=OFF"
|
||||||
"-DLLVM_BUILD_TOOLS=OFF"
|
"-DLLVM_BUILD_TOOLS=OFF"
|
||||||
"-DLLVM_TARGETS_TO_BUILD=X86;ARM;RISCV"
|
"-DLLVM_TARGETS_TO_BUILD=X86;ARM;RISCV"
|
||||||
|
|
Loading…
Reference in New Issue