[1/3] clover: Fix build after llvm r332881.

Submitted by Jan Vesely on May 22, 2018, 11:43 p.m.

Details

Message ID 20180522234320.31662-1-jan.vesely@rutgers.edu
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Jan Vesely May 22, 2018, 11:43 p.m.
r332881 added an extra parameter to the emit function.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106619
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
---
 .../state_trackers/clover/llvm/codegen/native.cpp      |  3 +--
 src/gallium/state_trackers/clover/llvm/compat.hpp      | 10 ++++++++++
 2 files changed, 11 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/gallium/state_trackers/clover/llvm/codegen/native.cpp b/src/gallium/state_trackers/clover/llvm/codegen/native.cpp
index 409f8ac32f..4b589ef50c 100644
--- a/src/gallium/state_trackers/clover/llvm/codegen/native.cpp
+++ b/src/gallium/state_trackers/clover/llvm/codegen/native.cpp
@@ -126,13 +126,12 @@  namespace {
       {
          compat::pass_manager pm;
          ::llvm::raw_svector_ostream os { data };
-         compat::raw_ostream_to_emit_file fos(os);
 
          mod.setDataLayout(compat::get_data_layout(*tm));
          tm->Options.MCOptions.AsmVerbose =
             (ft == TargetMachine::CGFT_AssemblyFile);
 
-         if (tm->addPassesToEmitFile(pm, fos, ft))
+	if (compat::add_passes_to_emit_file(*tm, pm, os, ft))
             fail(r_log, build_error(), "TargetMachine can't emit this file");
 
          pm.run(mod);
diff --git a/src/gallium/state_trackers/clover/llvm/compat.hpp b/src/gallium/state_trackers/clover/llvm/compat.hpp
index 2e070b2eef..96ba798970 100644
--- a/src/gallium/state_trackers/clover/llvm/compat.hpp
+++ b/src/gallium/state_trackers/clover/llvm/compat.hpp
@@ -245,6 +245,16 @@  namespace clover {
 		::llvm::WriteBitcodeToFile(mod, os);
 #else
 		::llvm::WriteBitcodeToFile(&mod, os);
+#endif
+	}
+	template<typename TM, typename PM, typename OS, typename FT>
+	bool add_passes_to_emit_file(TM &tm, PM &pm, OS &os, FT &ft)
+	{
+		compat::raw_ostream_to_emit_file fos(os);
+#if HAVE_LLVM >= 0x0700
+		return tm.addPassesToEmitFile(pm, fos, nullptr, ft);
+#else
+		return tm.addPassesToEmitFile(pm, fos, ft);
 #endif
 	}
       }

Comments

On Tue, May 22, 2018 at 6:43 PM, Jan Vesely <jan.vesely@rutgers.edu> wrote:
> r332881 added an extra parameter to the emit function.
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106619
> Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
> ---
>  .../state_trackers/clover/llvm/codegen/native.cpp      |  3 +--
>  src/gallium/state_trackers/clover/llvm/compat.hpp      | 10 ++++++++++
>  2 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/state_trackers/clover/llvm/codegen/native.cpp b/src/gallium/state_trackers/clover/llvm/codegen/native.cpp
> index 409f8ac32f..4b589ef50c 100644
> --- a/src/gallium/state_trackers/clover/llvm/codegen/native.cpp
> +++ b/src/gallium/state_trackers/clover/llvm/codegen/native.cpp
> @@ -126,13 +126,12 @@ namespace {
>        {
>           compat::pass_manager pm;
>           ::llvm::raw_svector_ostream os { data };
> -         compat::raw_ostream_to_emit_file fos(os);
>
>           mod.setDataLayout(compat::get_data_layout(*tm));
>           tm->Options.MCOptions.AsmVerbose =
>              (ft == TargetMachine::CGFT_AssemblyFile);
>
> -         if (tm->addPassesToEmitFile(pm, fos, ft))
> +       if (compat::add_passes_to_emit_file(*tm, pm, os, ft))

Looks like you need to add another space here to stay consistent with
the existing indentation.

>              fail(r_log, build_error(), "TargetMachine can't emit this file");
>
>           pm.run(mod);
> diff --git a/src/gallium/state_trackers/clover/llvm/compat.hpp b/src/gallium/state_trackers/clover/llvm/compat.hpp
> index 2e070b2eef..96ba798970 100644
> --- a/src/gallium/state_trackers/clover/llvm/compat.hpp
> +++ b/src/gallium/state_trackers/clover/llvm/compat.hpp
> @@ -245,6 +245,16 @@ namespace clover {
>                 ::llvm::WriteBitcodeToFile(mod, os);
>  #else
>                 ::llvm::WriteBitcodeToFile(&mod, os);
> +#endif
> +       }

Add an empty line before this function to separate it from the previous?

With those changes, this one is Tested/Reviewed-By: Aaron Watry
<awatry@gmail.com>

Patch 2 and 3 are Reviewed-by: Aaron Watry <awatry@gmail.com>

I've only tested patch 2 on LLVM 7 with a couple CTS tests as a smoke
test, and patch 3 is just visually reviewed/diffed with the existing
LLVM 5 configuration.

--Aaron


> +       template<typename TM, typename PM, typename OS, typename FT>
> +       bool add_passes_to_emit_file(TM &tm, PM &pm, OS &os, FT &ft)
> +       {
> +               compat::raw_ostream_to_emit_file fos(os);
> +#if HAVE_LLVM >= 0x0700
> +               return tm.addPassesToEmitFile(pm, fos, nullptr, ft);
> +#else
> +               return tm.addPassesToEmitFile(pm, fos, ft);
>  #endif
>         }
>        }
> --
> 2.17.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
On Thu, 2018-05-24 at 13:08 -0500, Aaron Watry wrote:
> On Tue, May 22, 2018 at 6:43 PM, Jan Vesely <jan.vesely@rutgers.edu> wrote:
> > r332881 added an extra parameter to the emit function.
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106619
> > Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
> > ---
> >  .../state_trackers/clover/llvm/codegen/native.cpp      |  3 +--
> >  src/gallium/state_trackers/clover/llvm/compat.hpp      | 10 ++++++++++
> >  2 files changed, 11 insertions(+), 2 deletions(-)
> > 
> > diff --git a/src/gallium/state_trackers/clover/llvm/codegen/native.cpp b/src/gallium/state_trackers/clover/llvm/codegen/native.cpp
> > index 409f8ac32f..4b589ef50c 100644
> > --- a/src/gallium/state_trackers/clover/llvm/codegen/native.cpp
> > +++ b/src/gallium/state_trackers/clover/llvm/codegen/native.cpp
> > @@ -126,13 +126,12 @@ namespace {
> >        {
> >           compat::pass_manager pm;
> >           ::llvm::raw_svector_ostream os { data };
> > -         compat::raw_ostream_to_emit_file fos(os);
> > 
> >           mod.setDataLayout(compat::get_data_layout(*tm));
> >           tm->Options.MCOptions.AsmVerbose =
> >              (ft == TargetMachine::CGFT_AssemblyFile);
> > 
> > -         if (tm->addPassesToEmitFile(pm, fos, ft))
> > +       if (compat::add_passes_to_emit_file(*tm, pm, os, ft))
> 
> Looks like you need to add another space here to stay consistent with
> the existing indentation.
> 
> >              fail(r_log, build_error(), "TargetMachine can't emit this file");
> > 
> >           pm.run(mod);
> > diff --git a/src/gallium/state_trackers/clover/llvm/compat.hpp b/src/gallium/state_trackers/clover/llvm/compat.hpp
> > index 2e070b2eef..96ba798970 100644
> > --- a/src/gallium/state_trackers/clover/llvm/compat.hpp
> > +++ b/src/gallium/state_trackers/clover/llvm/compat.hpp
> > @@ -245,6 +245,16 @@ namespace clover {
> >                 ::llvm::WriteBitcodeToFile(mod, os);
> >  #else
> >                 ::llvm::WriteBitcodeToFile(&mod, os);
> > +#endif
> > +       }
> 
> Add an empty line before this function to separate it from the previous?
> 
> With those changes, this one is Tested/Reviewed-By: Aaron Watry
> <awatry@gmail.com>
> 
> Patch 2 and 3 are Reviewed-by: Aaron Watry <awatry@gmail.com>
> 
> I've only tested patch 2 on LLVM 7 with a couple CTS tests as a smoke
> test, and patch 3 is just visually reviewed/diffed with the existing
> LLVM 5 configuration.

thanks. I've made the whitespace changes locally. I also modified patch
3 to use gcc-4.9 for build since llvm-6 package brings it in anyway
(and depends on libgcc-4.9)

Jan
> 
> --Aaron
> 
> 
> > +       template<typename TM, typename PM, typename OS, typename FT>
> > +       bool add_passes_to_emit_file(TM &tm, PM &pm, OS &os, FT &ft)
> > +       {
> > +               compat::raw_ostream_to_emit_file fos(os);
> > +#if HAVE_LLVM >= 0x0700
> > +               return tm.addPassesToEmitFile(pm, fos, nullptr, ft);
> > +#else
> > +               return tm.addPassesToEmitFile(pm, fos, ft);
> >  #endif
> >         }
> >        }
> > --
> > 2.17.0
> > 
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev