[SHAVE] Pass all -f, -g, -O, -W options through directly to moviCompile.

Differential Revision: http://reviews.llvm.org/D11581

llvm-svn: 243878
This commit is contained in:
Douglas Katzman 2015-08-03 14:34:22 +00:00
parent 17376c4e02
commit f607111d95
2 changed files with 18 additions and 17 deletions

View File

@ -9482,26 +9482,21 @@ void tools::SHAVE::Compiler::ConstructJob(Compilation &C, const JobAction &JA,
assert(II.getType() == types::TY_C || II.getType() == types::TY_CXX);
assert(Output.getType() == types::TY_PP_Asm); // Require preprocessed asm.
// Append all -I, -iquote, -isystem paths, and defines/undefines.
// These are spelled the same way in clang and moviCompile.
Args.AddAllArgs(CmdArgs,
{options::OPT_clang_i_Group, options::OPT_D, options::OPT_U});
CmdArgs.push_back("-DMYRIAD2");
CmdArgs.push_back("-mcpu=myriad2");
CmdArgs.push_back("-S");
// Any -O option passes through without translation. What about -Ofast ?
if (Arg *A = Args.getLastArg(options::OPT_O_Group))
A->render(Args, CmdArgs);
if (Args.hasFlag(options::OPT_ffunction_sections,
options::OPT_fno_function_sections)) {
CmdArgs.push_back("-ffunction-sections");
}
if (Args.hasArg(options::OPT_fno_inline_functions))
CmdArgs.push_back("-fno-inline-functions");
// Append all -I, -iquote, -isystem paths, defines/undefines,
// 'f' flags, optimize flags, and warning options.
// These are spelled the same way in clang and moviCompile.
Args.AddAllArgs(CmdArgs,
{options::OPT_I_Group, options::OPT_clang_i_Group,
options::OPT_D, options::OPT_U,
options::OPT_f_Group,
options::OPT_f_clang_Group,
options::OPT_g_Group,
options::OPT_O_Group,
options::OPT_W_Group});
CmdArgs.push_back("-fno-exceptions"); // Always do this even if unspecified.
CmdArgs.push_back(II.getFilename());

View File

@ -10,7 +10,7 @@
// RUN: %clang -target shave -c -### %s -Icommon 2>&1 \
// RUN: | FileCheck %s -check-prefix=movicompile
// movicompile: moviCompile" "-DMYRIAD2"
// movicompile: moviCompile" "-DMYRIAD2" "-mcpu=myriad2" "-S" "-I" "common"
// movicompile: moviAsm" "-no6thSlotCompression" "-cv:myriad2" "-noSPrefixing" "-a" "-i:common" "-elf"
// RUN: %clang -target shave -c -### %s -DEFINE_ME -UNDEFINE_ME 2>&1 \
@ -20,3 +20,9 @@
// RUN: %clang -target shave -c -### %s -Icommon -iquote quotepath -isystem syspath 2>&1 \
// RUN: | FileCheck %s -check-prefix=includes
// includes: "-iquote" "quotepath" "-isystem" "syspath"
// RUN: %clang -target shave -c -### %s -g -fno-inline-functions \
// RUN: -fno-inline-functions-called-once -Os -Wall \
// RUN: -ffunction-sections 2>&1 | FileCheck %s -check-prefix=F_G_O_W_OPTIONS
// F_G_O_W_OPTIONS: "-g" "-fno-inline-functions" "-fno-inline-functions-called-once"
// F_G_O_W_OPTIONS: "-Os" "-Wall" "-ffunction-sections"