spirv: Move nir_lower_libclc to src/compiler/spirv

This puts it in a shared place where everyone can get at it.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7034>
diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources
index f2051bf..a71abe3 100644
--- a/src/compiler/Makefile.sources
+++ b/src/compiler/Makefile.sources
@@ -377,6 +377,7 @@
 	spirv/GLSL.std.450.h \
 	spirv/gl_spirv.c \
 	spirv/nir_load_libclc.c \
+	spirv/nir_lower_libclc.c \
 	spirv/nir_spirv.h \
 	spirv/OpenCL.std.h \
 	spirv/spirv.h \
diff --git a/src/compiler/nir/meson.build b/src/compiler/nir/meson.build
index 828b235..28b372b 100644
--- a/src/compiler/nir/meson.build
+++ b/src/compiler/nir/meson.build
@@ -252,6 +252,7 @@
   '../spirv/GLSL.std.450.h',
   '../spirv/gl_spirv.c',
   '../spirv/nir_load_libclc.c',
+  '../spirv/nir_lower_libclc.c',
   '../spirv/nir_spirv.h',
   '../spirv/OpenCL.std.h',
   '../spirv/spirv.h',
diff --git a/src/gallium/frontends/clover/nir/nir_lower_libclc.c b/src/compiler/spirv/nir_lower_libclc.c
similarity index 98%
rename from src/gallium/frontends/clover/nir/nir_lower_libclc.c
rename to src/compiler/spirv/nir_lower_libclc.c
index 9d17756..ebaa54c 100644
--- a/src/gallium/frontends/clover/nir/nir_lower_libclc.c
+++ b/src/compiler/spirv/nir_lower_libclc.c
@@ -29,7 +29,7 @@
  */
 #include "nir.h"
 #include "nir_builder.h"
-#include "nir_lower_libclc.h"
+#include "nir_spirv.h"
 
 static bool
 lower_clc_call_instr(nir_instr *instr, nir_builder *b,
diff --git a/src/compiler/spirv/nir_spirv.h b/src/compiler/spirv/nir_spirv.h
index 49921fa..5964184 100644
--- a/src/compiler/spirv/nir_spirv.h
+++ b/src/compiler/spirv/nir_spirv.h
@@ -111,6 +111,8 @@
                        const struct spirv_to_nir_options *spirv_options,
                        const nir_shader_compiler_options *nir_options);
 
+bool nir_lower_libclc(nir_shader *shader, const nir_shader *clc_shader);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/gallium/frontends/clover/meson.build b/src/gallium/frontends/clover/meson.build
index 41706ac..ad5f152 100644
--- a/src/gallium/frontends/clover/meson.build
+++ b/src/gallium/frontends/clover/meson.build
@@ -85,7 +85,7 @@
 
 libclnir = static_library(
   'clnir',
-  files('nir/invocation.cpp', 'nir/invocation.hpp', 'nir/nir_lower_libclc.c', 'nir/nir_lower_libclc.h'),
+  files('nir/invocation.cpp', 'nir/invocation.hpp'),
   include_directories : [clover_incs, inc_mesa],
   dependencies : idep_nir,
   cpp_args : [clover_opencl_cpp_args, clover_spirv_cpp_args],
diff --git a/src/gallium/frontends/clover/nir/invocation.cpp b/src/gallium/frontends/clover/nir/invocation.cpp
index a5c3f99..4e7b88d 100644
--- a/src/gallium/frontends/clover/nir/invocation.cpp
+++ b/src/gallium/frontends/clover/nir/invocation.cpp
@@ -37,10 +37,6 @@
 #include <compiler/spirv/nir_spirv.h>
 #include <util/u_math.h>
 
-extern "C" {
-#include "nir_lower_libclc.h"
-}
-
 using namespace clover;
 
 #ifdef HAVE_CLOVER_SPIRV
diff --git a/src/gallium/frontends/clover/nir/nir_lower_libclc.h b/src/gallium/frontends/clover/nir/nir_lower_libclc.h
deleted file mode 100644
index 8db8d0a..0000000
--- a/src/gallium/frontends/clover/nir/nir_lower_libclc.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright © 2019 Red Hat
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- *
- */
-#ifndef NIR_LOWER_LIBCLC_H
-#define NIR_LOWER_LIBCLC_H
-
-bool
-nir_lower_libclc(nir_shader *shader,
-                 const nir_shader *clc_shader);
-
-#endif