r253647 - [Myriad]: handle Preprocess job action (-E)

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 25 17:56:56 PDT 2016


On Thu, Nov 19, 2015 at 8:58 PM, Douglas Katzman via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> Author: dougk
> Date: Thu Nov 19 22:58:12 2015
> New Revision: 253647
>
> URL: http://llvm.org/viewvc/llvm-project?rev=253647&view=rev
> Log:
> [Myriad]: handle Preprocess job action (-E)
>
> Modified:
>     cfe/trunk/lib/Driver/ToolChains.cpp
>     cfe/trunk/lib/Driver/Tools.cpp
>     cfe/trunk/test/Driver/myriad-toolchain.c
>
> Modified: cfe/trunk/lib/Driver/ToolChains.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/
> ToolChains.cpp?rev=253647&r1=253646&r2=253647&view=diff
> ============================================================
> ==================
> --- cfe/trunk/lib/Driver/ToolChains.cpp (original)
> +++ cfe/trunk/lib/Driver/ToolChains.cpp Thu Nov 19 22:58:12 2015
> @@ -4434,6 +4434,7 @@ Tool *MyriadToolChain::SelectTool(const
>    if (!isShaveCompilation(getTriple()))
>      return ToolChain::SelectTool(JA);
>    switch (JA.getKind()) {
> +  case Action::PreprocessJobClass:
>    case Action::CompileJobClass:
>      if (!Compiler)
>        Compiler.reset(new tools::SHAVE::Compiler(*this));
>
> Modified: cfe/trunk/lib/Driver/Tools.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/
> Tools.cpp?rev=253647&r1=253646&r2=253647&view=diff
> ============================================================
> ==================
> --- cfe/trunk/lib/Driver/Tools.cpp (original)
> +++ cfe/trunk/lib/Driver/Tools.cpp Thu Nov 19 22:58:12 2015
> @@ -9895,17 +9895,22 @@ void tools::SHAVE::Compiler::ConstructJo
>                                            const InputInfoList &Inputs,
>                                            const ArgList &Args,
>                                            const char *LinkingOutput)
> const {
> -
>    ArgStringList CmdArgs;
> -
>    assert(Inputs.size() == 1);
>    const InputInfo &II = Inputs[0];
> -  assert(II.getType() == types::TY_C || II.getType() == types::TY_CXX);
> -  assert(Output.getType() == types::TY_PP_Asm); // Require preprocessed
> asm.
> +  assert(II.getType() == types::TY_C || II.getType() == types::TY_CXX ||
> +         II.getType() == types::TY_PP_CXX);
>

This assert fails when compiling a .i file (TY_PP_C).


> -  CmdArgs.push_back("-DMYRIAD2");
> +  if (JA.getKind() == Action::PreprocessJobClass) {
> +    Args.ClaimAllArgs();
> +    CmdArgs.push_back("-E");
> +  } else {
> +    assert(Output.getType() == types::TY_PP_Asm); // Require preprocessed
> asm.
> +    CmdArgs.push_back("-S");
> +    CmdArgs.push_back("-fno-exceptions"); // Always do this even if
> unspecified.
> +  }
>    CmdArgs.push_back("-mcpu=myriad2");
> -  CmdArgs.push_back("-S");
> +  CmdArgs.push_back("-DMYRIAD2");
>
>    // Append all -I, -iquote, -isystem paths, defines/undefines,
>    // 'f' flags, optimize flags, and warning options.
> @@ -9931,8 +9936,6 @@ void tools::SHAVE::Compiler::ConstructJo
>      }
>    }
>
> -  CmdArgs.push_back("-fno-exceptions"); // Always do this even if
> unspecified.
> -
>    CmdArgs.push_back(II.getFilename());
>    CmdArgs.push_back("-o");
>    CmdArgs.push_back(Output.getFilename());
>
> Modified: cfe/trunk/test/Driver/myriad-toolchain.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/
> myriad-toolchain.c?rev=253647&r1=253646&r2=253647&view=diff
> ============================================================
> ==================
> --- cfe/trunk/test/Driver/myriad-toolchain.c (original)
> +++ cfe/trunk/test/Driver/myriad-toolchain.c Thu Nov 19 22:58:12 2015
> @@ -38,7 +38,7 @@
>
>  // RUN: %clang -target shave-myriad -c -### %s -isystem somewhere
> -Icommon -Wa,-yippee 2>&1 \
>  // RUN:   | FileCheck %s -check-prefix=MOVICOMPILE
> -// MOVICOMPILE: moviCompile" "-DMYRIAD2" "-mcpu=myriad2" "-S" "-isystem"
> "somewhere" "-I" "common"
> +// MOVICOMPILE: moviCompile" "-S" "-fno-exceptions" "-mcpu=myriad2"
> "-DMYRIAD2" "-isystem" "somewhere" "-I" "common"
>  // MOVICOMPILE: moviAsm" "-no6thSlotCompression" "-cv:myriad2"
> "-noSPrefixing" "-a"
>  // MOVICOMPILE: "-yippee" "-i:somewhere" "-i:common" "-elf"
>
> @@ -58,11 +58,15 @@
>
>  // RUN: %clang -target shave-myriad -c %s -o foo.o -### -MD -MF dep.d
> 2>&1 \
>  // RUN:   | FileCheck %s -check-prefix=MDMF
> -// MDMF: "-S" "-MD" "-MF" "dep.d" "-MT" "foo.o"
> +// MDMF: "-S" "-fno-exceptions" "-mcpu=myriad2" "-DMYRIAD2" "-MD" "-MF"
> "dep.d" "-MT" "foo.o"
>
>  // RUN: %clang -target shave-myriad -std=gnu++11 -S %s -o foo.o -### 2>&1
> \
>  // RUN:   | FileCheck %s -check-prefix=STDEQ
> -// STDEQ: "-mcpu=myriad2" "-S" "-std=gnu++11"
> +// STDEQ: "-S" "-fno-exceptions" "-mcpu=myriad2" "-DMYRIAD2"
> "-std=gnu++11"
> +
> +// RUN: %clang -target shave-myriad -E -Ifoo %s -o foo.i -### 2>&1 \
> +// RUN:   | FileCheck %s -check-prefix=PREPROCESS
> +// PREPROCESS: "-E" "-mcpu=myriad2" "-DMYRIAD2" "-I" "foo"
>
>  // RUN: %clang -target sparc-myriad -### --driver-mode=g++ %s 2>&1 |
> FileCheck %s --check-prefix=STDLIBCXX
>  // STDLIBCXX: "-lstdc++" "-lc" "-lgcc"
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160825/316aba13/attachment.html>


More information about the cfe-commits mailing list