cc: experimental -fast option for tcc/codegen in the future

pull/2607/head
Alexander Medvednikov 2019-11-01 00:37:24 +03:00
parent 987f5fd2a1
commit 91df08f56d
3 changed files with 32 additions and 26 deletions

View File

@ -64,6 +64,7 @@ fn (v mut V) cc() {
// TCC on Linux by default, unless -cc was provided // TCC on Linux by default, unless -cc was provided
// TODO if -cc = cc, TCC is still used, default compiler should be // TODO if -cc = cc, TCC is still used, default compiler should be
// used instead. // used instead.
if v.pref.fast {
$if linux { $if linux {
$if !android { $if !android {
vdir := os.dir(vexe) vdir := os.dir(vexe)
@ -85,6 +86,9 @@ fn (v mut V) cc() {
v.pref.ccompiler = tcc_path v.pref.ccompiler = tcc_path
} }
} }
} $else {
verror('-fast is only supported on Linux right now')
}
} }
//linux_host := os.user_os() == 'linux' //linux_host := os.user_os() == 'linux'
v.log('cc() isprod=$v.pref.is_prod outname=$v.out_name') v.log('cc() isprod=$v.pref.is_prod outname=$v.out_name')

View File

@ -114,6 +114,7 @@ pub mut:
// work on the builtin module itself. // work on the builtin module itself.
//generating_vh bool //generating_vh bool
comptime_define string // -D vfmt for `if $vfmt {` comptime_define string // -D vfmt for `if $vfmt {`
fast bool // use tcc/x64 codegen
} }
// Should be called by main at the end of the compilation process, to cleanup // Should be called by main at the end of the compilation process, to cleanup
@ -930,6 +931,7 @@ pub fn new_v(args[]string) &V {
is_run: 'run' in args is_run: 'run' in args
autofree: '-autofree' in args autofree: '-autofree' in args
compress: '-compress' in args compress: '-compress' in args
fast: '-fast' in args
is_repl: is_repl is_repl: is_repl
build_mode: build_mode build_mode: build_mode
cflags: cflags cflags: cflags