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

Douglas Katzman dougk at google.com
Mon Aug 3 07:34:22 PDT 2015


Author: dougk
Date: Mon Aug  3 09:34:22 2015
New Revision: 243878

URL: http://llvm.org/viewvc/llvm-project?rev=243878&view=rev
Log:
[SHAVE] Pass all -f, -g, -O, -W options through directly to moviCompile.

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

Modified:
    cfe/trunk/lib/Driver/Tools.cpp
    cfe/trunk/test/Driver/shave-toolchain.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=243878&r1=243877&r2=243878&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Mon Aug  3 09:34:22 2015
@@ -9482,26 +9482,21 @@ void tools::SHAVE::Compiler::ConstructJo
   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());

Modified: cfe/trunk/test/Driver/shave-toolchain.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/shave-toolchain.c?rev=243878&r1=243877&r2=243878&view=diff
==============================================================================
--- cfe/trunk/test/Driver/shave-toolchain.c (original)
+++ cfe/trunk/test/Driver/shave-toolchain.c Mon Aug  3 09:34:22 2015
@@ -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"





More information about the cfe-commits mailing list