File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import DiagnosticHostInstance from "./diagnostic.host";
1010import UnsupportedError from "./backend/error/unsupported.error" ;
1111import { existsSync , mkdirSync , unlinkSync } from "fs" ;
1212import { execFileSync } from "child_process" ;
13+ import { executeLLCSync } from "./utils" ;
1314
1415interface CommandLineArguments {
1516 args : string [ ] ;
7374
7475 const optimizationLevel = `-O${ cliOptions . optimizationLevel } ` ;
7576
76- execFileSync ( 'llc' , [
77+ executeLLCSync ( [
7778 optimizationLevel ,
7879 '-filetype=obj' , path . join ( outputPath , 'main.bc' ) ,
7980 '-o' , path . join ( outputPath , 'main.o' ) ,
Original file line number Diff line number Diff line change 1+
2+ import * as child_process from "child_process" ;
3+ import * as path from "path" ;
4+
5+ let llvmBinDir : string | undefined ;
6+
7+ function getLLVMBinDirectory ( ) : string {
8+ if ( ! llvmBinDir ) {
9+ llvmBinDir = child_process . execFileSync ( 'llvm-config' , [ "--bindir" ] ) . toString ( ) . trim ( ) ;
10+ }
11+
12+ return llvmBinDir ;
13+ }
14+
15+ export function executeLLCSync ( options : Array < any > ) {
16+ child_process . execFileSync (
17+ path . join ( getLLVMBinDirectory ( ) , 'llc' ) ,
18+ options
19+ )
20+ }
You can’t perform that action at this time.
0 commit comments