Compare commits
2 Commits
a034844b1a
...
71e6fd65ab
Author | SHA1 | Date |
---|---|---|
|
71e6fd65ab | |
|
a96d5f78a3 |
|
@ -31,8 +31,9 @@ else
|
||||||
nac3standalone=../../target/x86_64-unknown-linux-gnu/release/nac3standalone
|
nac3standalone=../../target/x86_64-unknown-linux-gnu/release/nac3standalone
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f ./*.o ./*.bc demo
|
|
||||||
if [ -z "$use_lli" ]; then
|
if [ -z "$use_lli" ]; then
|
||||||
|
rm -f "*.o" demo
|
||||||
|
|
||||||
$nac3standalone "${nac3args[@]}"
|
$nac3standalone "${nac3args[@]}"
|
||||||
|
|
||||||
clang -c -std=gnu11 -Wall -Wextra -O3 -o demo.o demo.c
|
clang -c -std=gnu11 -Wall -Wextra -O3 -o demo.o demo.c
|
||||||
|
@ -44,19 +45,15 @@ if [ -z "$use_lli" ]; then
|
||||||
./demo > "$outfile"
|
./demo > "$outfile"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
rm -f "*.o" "*.bc" demo
|
||||||
|
|
||||||
$nac3standalone --emit-llvm "${nac3args[@]}"
|
$nac3standalone --emit-llvm "${nac3args[@]}"
|
||||||
|
|
||||||
clang -c -std=gnu11 -Wall -Wextra -O3 -emit-llvm -o demo.bc demo.c
|
clang -c -std=gnu11 -Wall -Wextra -O3 -emit-llvm -o demo.bc demo.c
|
||||||
|
|
||||||
if ls module*.bc >/dev/null 2>&1; then
|
|
||||||
llvm-link -o module.bc module*.bc main.bc
|
|
||||||
else
|
|
||||||
cp main.bc module.bc
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$outfile" ]; then
|
if [ -z "$outfile" ]; then
|
||||||
lli --extra-module demo.bc --extra-module irrt.bc module.bc
|
lli --extra-module demo.bc --extra-module irrt.bc main.bc
|
||||||
else
|
else
|
||||||
lli --extra-module demo.bc --extra-module irrt.bc module.bc > "$outfile"
|
lli --extra-module demo.bc --extra-module irrt.bc main.bc > "$outfile"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -39,9 +39,8 @@ struct CommandLineArgs {
|
||||||
/// The name of the input file.
|
/// The name of the input file.
|
||||||
file_name: String,
|
file_name: String,
|
||||||
|
|
||||||
/// The number of threads allocated to processing the source file. If 0 is passed to this
|
/// The number of threads allocated to processing the source file.
|
||||||
/// parameter, all available threads will be used for compilation.
|
#[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.
|
||||||
|
@ -49,8 +48,6 @@ struct CommandLineArgs {
|
||||||
opt_level: u32,
|
opt_level: u32,
|
||||||
|
|
||||||
/// Whether to emit LLVM IR at the end of every module.
|
/// Whether to emit LLVM IR at the end of every module.
|
||||||
///
|
|
||||||
/// If multithreaded compilation is also enabled, each thread will emit its own module.
|
|
||||||
#[arg(long, default_value_t = false)]
|
#[arg(long, default_value_t = false)]
|
||||||
emit_llvm: bool,
|
emit_llvm: bool,
|
||||||
|
|
||||||
|
@ -212,15 +209,9 @@ fn main() {
|
||||||
.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() {
|
let threads = if is_multithreaded() {
|
||||||
if threads == 0 {
|
|
||||||
std::thread::available_parallelism()
|
|
||||||
.map(|threads| threads.get() as u32)
|
|
||||||
.unwrap_or(1u32)
|
|
||||||
} else {
|
|
||||||
threads
|
threads
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if threads != 1 {
|
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")
|
println!("Warning: Number of threads specified in command-line but multithreading is disabled in LLVM at build time! Defaulting to single-threaded compilation")
|
||||||
}
|
}
|
||||||
1
|
1
|
||||||
|
|
Loading…
Reference in New Issue