From: Emil Velikov <emil.veli...@collabora.com>

Signed-off-by: Emil Velikov <emil.veli...@collabora.com>
---
 Android.mk                                         |   1 +
 configure.ac                                       |   1 +
 src/Makefile.am                                    |   1 +
 src/{glsl => compiler}/nir/.gitignore              |   0
 src/compiler/nir/Android.gen.mk                    |  83 +++++++++++++++++
 src/compiler/nir/Android.mk                        |  52 +++++++++++
 src/compiler/nir/Makefile.am                       | 100 +++++++++++++++++++++
 src/compiler/nir/Makefile.sources                  |  71 +++++++++++++++
 src/{glsl => compiler}/nir/README                  |   0
 src/{glsl => compiler}/nir/glsl_to_nir.cpp         |   8 +-
 src/{glsl => compiler}/nir/glsl_to_nir.h           |   2 +-
 src/{glsl => compiler}/nir/nir.c                   |   0
 src/{glsl => compiler}/nir/nir.h                   |   2 +-
 src/{glsl => compiler}/nir/nir_algebraic.py        |   0
 src/{glsl => compiler}/nir/nir_array.h             |   0
 src/{glsl => compiler}/nir/nir_builder.h           |   0
 .../nir/nir_builder_opcodes_h.py                   |   0
 src/{glsl => compiler}/nir/nir_clone.c             |   0
 .../nir/nir_constant_expressions.h                 |   0
 .../nir/nir_constant_expressions.py                |   0
 src/{glsl => compiler}/nir/nir_control_flow.c      |   0
 src/{glsl => compiler}/nir/nir_control_flow.h      |   0
 .../nir/nir_control_flow_private.h                 |   0
 src/{glsl => compiler}/nir/nir_dominance.c         |   0
 src/{glsl => compiler}/nir/nir_from_ssa.c          |   0
 src/{glsl => compiler}/nir/nir_gs_count_vertices.c |   0
 src/{glsl => compiler}/nir/nir_instr_set.c         |   0
 src/{glsl => compiler}/nir/nir_instr_set.h         |   0
 src/{glsl => compiler}/nir/nir_intrinsics.c        |   0
 src/{glsl => compiler}/nir/nir_intrinsics.h        |   0
 src/{glsl => compiler}/nir/nir_liveness.c          |   0
 .../nir/nir_lower_alu_to_scalar.c                  |   0
 src/{glsl => compiler}/nir/nir_lower_atomics.c     |   6 +-
 src/{glsl => compiler}/nir/nir_lower_clip.c        |   0
 .../nir/nir_lower_global_vars_to_local.c           |   0
 .../nir/nir_lower_gs_intrinsics.c                  |   0
 src/{glsl => compiler}/nir/nir_lower_idiv.c        |   0
 src/{glsl => compiler}/nir/nir_lower_io.c          |   0
 .../nir/nir_lower_load_const_to_scalar.c           |   0
 .../nir/nir_lower_locals_to_regs.c                 |   0
 .../nir/nir_lower_outputs_to_temporaries.c         |   0
 .../nir/nir_lower_phis_to_scalar.c                 |   0
 src/{glsl => compiler}/nir/nir_lower_samplers.c    |  10 +--
 .../nir/nir_lower_system_values.c                  |   0
 src/{glsl => compiler}/nir/nir_lower_tex.c         |   0
 .../nir/nir_lower_to_source_mods.c                 |   0
 .../nir/nir_lower_two_sided_color.c                |   0
 src/{glsl => compiler}/nir/nir_lower_var_copies.c  |   0
 src/{glsl => compiler}/nir/nir_lower_vars_to_ssa.c |   0
 src/{glsl => compiler}/nir/nir_lower_vec_to_movs.c |   0
 src/{glsl => compiler}/nir/nir_metadata.c          |   0
 .../nir/nir_move_vec_src_uses_to_dest.c            |   0
 .../nir/nir_normalize_cubemap_coords.c             |   0
 src/{glsl => compiler}/nir/nir_opcodes.py          |   0
 src/{glsl => compiler}/nir/nir_opcodes_c.py        |   0
 src/{glsl => compiler}/nir/nir_opcodes_h.py        |   0
 src/{glsl => compiler}/nir/nir_opt_algebraic.py    |   0
 .../nir/nir_opt_constant_folding.c                 |   0
 .../nir/nir_opt_copy_propagate.c                   |   0
 src/{glsl => compiler}/nir/nir_opt_cse.c           |   0
 src/{glsl => compiler}/nir/nir_opt_dce.c           |   0
 src/{glsl => compiler}/nir/nir_opt_dead_cf.c       |   0
 src/{glsl => compiler}/nir/nir_opt_gcm.c           |   0
 .../nir/nir_opt_global_to_local.c                  |   0
 .../nir/nir_opt_peephole_select.c                  |   0
 src/{glsl => compiler}/nir/nir_opt_remove_phis.c   |   0
 src/{glsl => compiler}/nir/nir_opt_undef.c         |   0
 src/{glsl => compiler}/nir/nir_print.c             |   0
 .../nir/nir_remove_dead_variables.c                |   0
 src/{glsl => compiler}/nir/nir_search.c            |   0
 src/{glsl => compiler}/nir/nir_search.h            |   0
 src/{glsl => compiler}/nir/nir_split_var_copies.c  |   0
 src/{glsl => compiler}/nir/nir_sweep.c             |   0
 src/{glsl => compiler}/nir/nir_to_ssa.c            |   0
 src/{glsl => compiler}/nir/nir_validate.c          |   0
 src/{glsl => compiler}/nir/nir_vla.h               |   0
 src/{glsl => compiler}/nir/nir_worklist.c          |   0
 src/{glsl => compiler}/nir/nir_worklist.h          |   0
 .../nir/tests/control_flow_tests.cpp               |   0
 src/gallium/auxiliary/Makefile.am                  |   2 +-
 src/gallium/auxiliary/nir/tgsi_to_nir.c            |   6 +-
 src/gallium/auxiliary/nir/tgsi_to_nir.h            |   2 +-
 src/gallium/drivers/freedreno/Makefile.am          |   4 +-
 src/gallium/drivers/freedreno/ir3/ir3_nir.h        |   2 +-
 .../drivers/freedreno/ir3/ir3_nir_lower_if_else.c  |   4 +-
 src/gallium/drivers/vc4/Makefile.am                |   2 +-
 src/gallium/drivers/vc4/vc4_nir_lower_blend.c      |   5 +-
 src/gallium/drivers/vc4/vc4_nir_lower_io.c         |   5 +-
 src/gallium/drivers/vc4/vc4_program.c              |   5 +-
 src/gallium/drivers/vc4/vc4_qir.h                  |   2 +-
 src/gallium/targets/pipe-loader/Makefile.am        |   2 +-
 src/gallium/targets/xa/Makefile.am                 |   2 +-
 src/glsl/Android.gen.mk                            |  56 +-----------
 src/glsl/Android.mk                                |   5 +-
 src/glsl/Makefile.am                               |  62 +------------
 src/glsl/Makefile.sources                          |  71 ---------------
 src/glsl/ir_hierarchical_visitor.h                 |   2 +
 src/glsl/ir_visitor.h                              |   2 +
 src/mesa/Android.libmesa_dricore.mk                |   1 -
 src/mesa/Android.libmesa_glsl_utils.mk             |   2 -
 src/mesa/Android.libmesa_st_mesa.mk                |   1 -
 src/mesa/Makefile.sources                          |   2 -
 src/mesa/drivers/dri/i965/Makefile.am              |   3 +-
 src/mesa/drivers/dri/i965/brw_fs.h                 |   2 +-
 src/mesa/drivers/dri/i965/brw_nir.c                |   2 +-
 src/mesa/drivers/dri/i965/brw_nir.h                |   2 +-
 src/mesa/drivers/dri/i965/brw_vec4.h               |   3 +-
 src/mesa/drivers/dri/i965/intel_asm_annotation.c   |   2 +-
 src/mesa/drivers/dri/i965/intel_screen.c           |   2 +-
 src/mesa/program/Android.mk                        |   1 -
 src/mesa/program/prog_to_nir.c                     |   4 +-
 111 files changed, 367 insertions(+), 238 deletions(-)
 rename src/{glsl => compiler}/nir/.gitignore (100%)
 create mode 100644 src/compiler/nir/Android.gen.mk
 create mode 100644 src/compiler/nir/Android.mk
 create mode 100644 src/compiler/nir/Makefile.am
 create mode 100644 src/compiler/nir/Makefile.sources
 rename src/{glsl => compiler}/nir/README (100%)
 rename src/{glsl => compiler}/nir/glsl_to_nir.cpp (99%)
 rename src/{glsl => compiler}/nir/glsl_to_nir.h (97%)
 rename src/{glsl => compiler}/nir/nir.c (100%)
 rename src/{glsl => compiler}/nir/nir.h (99%)
 rename src/{glsl => compiler}/nir/nir_algebraic.py (100%)
 rename src/{glsl => compiler}/nir/nir_array.h (100%)
 rename src/{glsl => compiler}/nir/nir_builder.h (100%)
 rename src/{glsl => compiler}/nir/nir_builder_opcodes_h.py (100%)
 rename src/{glsl => compiler}/nir/nir_clone.c (100%)
 rename src/{glsl => compiler}/nir/nir_constant_expressions.h (100%)
 rename src/{glsl => compiler}/nir/nir_constant_expressions.py (100%)
 rename src/{glsl => compiler}/nir/nir_control_flow.c (100%)
 rename src/{glsl => compiler}/nir/nir_control_flow.h (100%)
 rename src/{glsl => compiler}/nir/nir_control_flow_private.h (100%)
 rename src/{glsl => compiler}/nir/nir_dominance.c (100%)
 rename src/{glsl => compiler}/nir/nir_from_ssa.c (100%)
 rename src/{glsl => compiler}/nir/nir_gs_count_vertices.c (100%)
 rename src/{glsl => compiler}/nir/nir_instr_set.c (100%)
 rename src/{glsl => compiler}/nir/nir_instr_set.h (100%)
 rename src/{glsl => compiler}/nir/nir_intrinsics.c (100%)
 rename src/{glsl => compiler}/nir/nir_intrinsics.h (100%)
 rename src/{glsl => compiler}/nir/nir_liveness.c (100%)
 rename src/{glsl => compiler}/nir/nir_lower_alu_to_scalar.c (100%)
 rename src/{glsl => compiler}/nir/nir_lower_atomics.c (99%)
 rename src/{glsl => compiler}/nir/nir_lower_clip.c (100%)
 rename src/{glsl => compiler}/nir/nir_lower_global_vars_to_local.c (100%)
 rename src/{glsl => compiler}/nir/nir_lower_gs_intrinsics.c (100%)
 rename src/{glsl => compiler}/nir/nir_lower_idiv.c (100%)
 rename src/{glsl => compiler}/nir/nir_lower_io.c (100%)
 rename src/{glsl => compiler}/nir/nir_lower_load_const_to_scalar.c (100%)
 rename src/{glsl => compiler}/nir/nir_lower_locals_to_regs.c (100%)
 rename src/{glsl => compiler}/nir/nir_lower_outputs_to_temporaries.c (100%)
 rename src/{glsl => compiler}/nir/nir_lower_phis_to_scalar.c (100%)
 rename src/{glsl => compiler}/nir/nir_lower_samplers.c (99%)
 rename src/{glsl => compiler}/nir/nir_lower_system_values.c (100%)
 rename src/{glsl => compiler}/nir/nir_lower_tex.c (100%)
 rename src/{glsl => compiler}/nir/nir_lower_to_source_mods.c (100%)
 rename src/{glsl => compiler}/nir/nir_lower_two_sided_color.c (100%)
 rename src/{glsl => compiler}/nir/nir_lower_var_copies.c (100%)
 rename src/{glsl => compiler}/nir/nir_lower_vars_to_ssa.c (100%)
 rename src/{glsl => compiler}/nir/nir_lower_vec_to_movs.c (100%)
 rename src/{glsl => compiler}/nir/nir_metadata.c (100%)
 rename src/{glsl => compiler}/nir/nir_move_vec_src_uses_to_dest.c (100%)
 rename src/{glsl => compiler}/nir/nir_normalize_cubemap_coords.c (100%)
 rename src/{glsl => compiler}/nir/nir_opcodes.py (100%)
 rename src/{glsl => compiler}/nir/nir_opcodes_c.py (100%)
 rename src/{glsl => compiler}/nir/nir_opcodes_h.py (100%)
 rename src/{glsl => compiler}/nir/nir_opt_algebraic.py (100%)
 rename src/{glsl => compiler}/nir/nir_opt_constant_folding.c (100%)
 rename src/{glsl => compiler}/nir/nir_opt_copy_propagate.c (100%)
 rename src/{glsl => compiler}/nir/nir_opt_cse.c (100%)
 rename src/{glsl => compiler}/nir/nir_opt_dce.c (100%)
 rename src/{glsl => compiler}/nir/nir_opt_dead_cf.c (100%)
 rename src/{glsl => compiler}/nir/nir_opt_gcm.c (100%)
 rename src/{glsl => compiler}/nir/nir_opt_global_to_local.c (100%)
 rename src/{glsl => compiler}/nir/nir_opt_peephole_select.c (100%)
 rename src/{glsl => compiler}/nir/nir_opt_remove_phis.c (100%)
 rename src/{glsl => compiler}/nir/nir_opt_undef.c (100%)
 rename src/{glsl => compiler}/nir/nir_print.c (100%)
 rename src/{glsl => compiler}/nir/nir_remove_dead_variables.c (100%)
 rename src/{glsl => compiler}/nir/nir_search.c (100%)
 rename src/{glsl => compiler}/nir/nir_search.h (100%)
 rename src/{glsl => compiler}/nir/nir_split_var_copies.c (100%)
 rename src/{glsl => compiler}/nir/nir_sweep.c (100%)
 rename src/{glsl => compiler}/nir/nir_to_ssa.c (100%)
 rename src/{glsl => compiler}/nir/nir_validate.c (100%)
 rename src/{glsl => compiler}/nir/nir_vla.h (100%)
 rename src/{glsl => compiler}/nir/nir_worklist.c (100%)
 rename src/{glsl => compiler}/nir/nir_worklist.h (100%)
 rename src/{glsl => compiler}/nir/tests/control_flow_tests.cpp (100%)

diff --git a/Android.mk b/Android.mk
index 9b140a7..9b0d7bf 100644
--- a/Android.mk
+++ b/Android.mk
@@ -87,6 +87,7 @@ SUBDIRS := \
        src/loader \
        src/mapi \
        src/compiler \
+       src/compiler/nir \
        src/glsl \
        src/mesa \
        src/util \
diff --git a/configure.ac b/configure.ac
index fcffc19..266d9b6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2347,6 +2347,7 @@ dnl Substitute the config
 AC_CONFIG_FILES([Makefile
                src/Makefile
                src/compiler/Makefile
+               src/compiler/nir/Makefile
                src/egl/Makefile
                src/egl/main/egl.pc
                src/egl/wayland/wayland-drm/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index 6357d10..c7f274a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -23,6 +23,7 @@ SUBDIRS = . gtest util mapi/glapi/gen mapi
 
 # XXX: conditionally include
 SUBDIRS += compiler
+SUBDIRS += compiler/nir
 
 if NEED_OPENGL_COMMON
 SUBDIRS += glsl mesa
diff --git a/src/glsl/nir/.gitignore b/src/compiler/nir/.gitignore
similarity index 100%
rename from src/glsl/nir/.gitignore
rename to src/compiler/nir/.gitignore
diff --git a/src/compiler/nir/Android.gen.mk b/src/compiler/nir/Android.gen.mk
new file mode 100644
index 0000000..b229776
--- /dev/null
+++ b/src/compiler/nir/Android.gen.mk
@@ -0,0 +1,83 @@
+# Mesa 3-D graphics library
+#
+# Copyright (C) 2010-2011 Chia-I Wu <olva...@gmail.com>
+# Copyright (C) 2010-2011 LunarG Inc.
+# Copyright (C) 2015 Intel Corporation
+#
+# 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 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.
+
+ifeq ($(LOCAL_MODULE_CLASS),)
+LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+endif
+
+intermediates := $(call local-generated-sources-dir)
+
+LOCAL_SRC_FILES := $(LOCAL_SRC_FILES)
+
+LOCAL_EXPORT_C_INCLUDE_DIRS += $(intermediates)
+
+LOCAL_GENERATED_SOURCES += $(addprefix $(intermediates)/, \
+       $(NIR_GENERATED_FILES))
+
+nir_builder_opcodes_gen := $(LOCAL_PATH)/nir_builder_opcodes_h.py
+nir_builder_opcodes_deps := \
+       $(LOCAL_PATH)/nir_opcodes.py \
+       $(LOCAL_PATH)/nir_builder_opcodes_h.py
+
+$(intermediates)/nir_builder_opcodes.h: $(nir_builder_opcodes_deps)
+       @mkdir -p $(dir $@)
+       $(hide) $(MESA_PYTHON2) $(nir_builder_opcodes_gen) $< > $@
+
+nir_constant_expressions_gen := $(LOCAL_PATH)/nir_constant_expressions.py
+nir_constant_expressions_deps := \
+       $(LOCAL_PATH)/nir_opcodes.py \
+       $(LOCAL_PATH)/nir_constant_expressions.py
+
+$(intermediates)/nir_constant_expressions.c: $(nir_constant_expressions_deps)
+       @mkdir -p $(dir $@)
+       $(hide) $(MESA_PYTHON2) $(nir_constant_expressions_gen) $< > $@
+
+nir_opcodes_h_gen := $(LOCAL_PATH)/nir_opcodes_h.py
+nir_opcodes_h_deps := \
+       $(LOCAL_PATH)/nir_opcodes.py \
+       $(LOCAL_PATH)/nir_opcodes_h.py
+
+$(intermediates)/nir_opcodes.h: $(nir_opcodes_h_deps)
+       @mkdir -p $(dir $@)
+       $(hide) $(MESA_PYTHON2) $(nir_opcodes_h_gen) $< > $@
+
+$(LOCAL_PATH)/nir.h: $(intermediates)/nir_opcodes.h
+
+nir_opcodes_c_gen := $(LOCAL_PATH)/nir_opcodes_c.py
+nir_opcodes_c_deps := \
+       $(LOCAL_PATH)/nir_opcodes.py \
+       $(LOCAL_PATH)/nir_opcodes_c.py
+
+$(intermediates)/nir_opcodes.c: $(nir_opcodes_c_deps)
+       @mkdir -p $(dir $@)
+       $(hide) $(MESA_PYTHON2) $(nir_opcodes_c_gen) $< > $@
+
+nir_opt_algebraic_gen := $(LOCAL_PATH)/nir_opt_algebraic.py
+nir_opt_algebraic_deps := \
+       $(LOCAL_PATH)/nir_opt_algebraic.py \
+       $(LOCAL_PATH)/nir_algebraic.py
+
+$(intermediates)/nir_opt_algebraic.c: $(nir_opt_algebraic_deps)
+       @mkdir -p $(dir $@)
+       $(hide) $(MESA_PYTHON2) $(nir_opt_algebraic_gen) $< > $@
diff --git a/src/compiler/nir/Android.mk b/src/compiler/nir/Android.mk
new file mode 100644
index 0000000..e5f8046
--- /dev/null
+++ b/src/compiler/nir/Android.mk
@@ -0,0 +1,52 @@
+# Mesa 3-D graphics library
+#
+# Copyright (C) 2010-2011 Chia-I Wu <olva...@gmail.com>
+# Copyright (C) 2010-2011 LunarG Inc.
+# Copyright (C) 2015 Intel Corporation
+#
+# 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 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.
+
+# Android.mk for nir
+
+LOCAL_PATH := $(call my-dir)
+
+include $(LOCAL_PATH)/Makefile.sources
+
+# ---------------------------------------
+# Build libmesa_nir
+# ---------------------------------------
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+       $(NIR_FILES)
+
+LOCAL_C_INCLUDES := \
+       $(MESA_TOP)/src/mapi \
+       $(MESA_TOP)/src/mesa \
+       $(MESA_TOP)/src/gallium/include \
+       $(MESA_TOP)/src/gallium/auxiliary
+
+LOCAL_STATIC_LIBRARIES := libmesa_compiler
+
+LOCAL_MODULE := libmesa_nir
+
+include $(LOCAL_PATH)/Android.gen.mk
+include $(MESA_COMMON_MK)
+include $(BUILD_STATIC_LIBRARY)
diff --git a/src/compiler/nir/Makefile.am b/src/compiler/nir/Makefile.am
new file mode 100644
index 0000000..fbcbf08
--- /dev/null
+++ b/src/compiler/nir/Makefile.am
@@ -0,0 +1,100 @@
+# Copyright © 2012 Jon TURNEY
+# Copyright (C) 2015 Intel Corporation
+#
+# 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.
+
+include Makefile.sources
+
+AM_CPPFLAGS = \
+       -I$(top_srcdir)/include \
+       -I$(top_srcdir)/src \
+       -I$(top_srcdir)/src/mapi \
+       -I$(top_srcdir)/src/mesa/ \
+       -I$(top_srcdir)/src/gallium/include \
+       -I$(top_srcdir)/src/gallium/auxiliary \
+       -I$(top_srcdir)/src/gtest/include \
+       $(DEFINES)
+
+AM_CFLAGS = \
+       $(VISIBILITY_CFLAGS) \
+       $(MSVC2013_COMPAT_CFLAGS)
+
+AM_CXXFLAGS = \
+       $(VISIBILITY_CXXFLAGS) \
+       $(MSVC2013_COMPAT_CXXFLAGS)
+
+noinst_LTLIBRARIES = libnir.la
+
+libnir_la_SOURCES = \
+       $(NIR_FILES) \
+       $(NIR_GENERATED_FILES)
+
+libnir_la_LIBADD = $(top_builddir)/src/compiler/libcompiler.la
+
+
+check_PROGRAMS = tests/control_flow_tests
+TESTS = $(check_PROGRAMS)
+
+tests_control_flow_tests_SOURCES = tests/control_flow_tests.cpp
+tests_control_flow_tests_CFLAGS = $(PTHREAD_CFLAGS)
+tests_control_flow_tests_LDADD = \
+       libnir.la \
+       $(top_builddir)/src/gtest/libgtest.la \
+       $(top_builddir)/src/util/libmesautil.la \
+       $(PTHREAD_LIBS)
+
+
+BUILT_SOURCES = $(NIR_GENERATED_FILES)
+CLEANFILES = $(BUILT_SOURCES)
+
+
+MKDIR_GEN = $(AM_V_at)$(MKDIR_P) $(@D)
+PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
+
+nir_builder_opcodes.h: nir_opcodes.py nir_builder_opcodes_h.py
+       $(MKDIR_GEN)
+       $(PYTHON_GEN) $(srcdir)/nir_builder_opcodes_h.py > $@
+
+nir_constant_expressions.c: nir_opcodes.py nir_constant_expressions.py
+       $(MKDIR_GEN)
+       $(PYTHON_GEN) $(srcdir)/nir_constant_expressions.py > $@
+
+nir_opcodes.h: nir_opcodes.py nir_opcodes_h.py
+       $(MKDIR_GEN)
+       $(PYTHON_GEN) $(srcdir)/nir_opcodes_h.py > $@
+
+nir_opcodes.c: nir_opcodes.py nir_opcodes_c.py
+       $(MKDIR_GEN)
+       $(PYTHON_GEN) $(srcdir)/nir_opcodes_c.py > $@
+
+nir_opt_algebraic.c: nir_opt_algebraic.py nir_algebraic.py
+       $(MKDIR_GEN)
+       $(PYTHON_GEN) $(srcdir)/nir_opt_algebraic.py > $@
+
+
+EXTRA_DIST = \
+       nir_algebraic.py \
+       nir_builder_opcodes_h.py \
+       nir_constant_expressions.py \
+       nir_opcodes.py \
+       nir_opcodes_c.py \
+       nir_opcodes_h.py \
+       nir_opt_algebraic.py \
+       tests
diff --git a/src/compiler/nir/Makefile.sources 
b/src/compiler/nir/Makefile.sources
new file mode 100644
index 0000000..0755a10
--- /dev/null
+++ b/src/compiler/nir/Makefile.sources
@@ -0,0 +1,71 @@
+NIR_GENERATED_FILES = \
+       nir_builder_opcodes.h \
+       nir_constant_expressions.c \
+       nir_opcodes.c \
+       nir_opcodes.h \
+       nir_opt_algebraic.c
+
+NIR_FILES = \
+       glsl_to_nir.cpp \
+       glsl_to_nir.h \
+       nir.c \
+       nir.h \
+       nir_array.h \
+       nir_builder.h \
+       nir_clone.c \
+       nir_constant_expressions.h \
+       nir_control_flow.c \
+       nir_control_flow.h \
+       nir_control_flow_private.h \
+       nir_dominance.c \
+       nir_from_ssa.c \
+       nir_gs_count_vertices.c \
+       nir_intrinsics.c \
+       nir_intrinsics.h \
+       nir_instr_set.c \
+       nir_instr_set.h \
+       nir_liveness.c \
+       nir_lower_alu_to_scalar.c \
+       nir_lower_atomics.c \
+       nir_lower_clip.c \
+       nir_lower_global_vars_to_local.c \
+       nir_lower_gs_intrinsics.c \
+       nir_lower_load_const_to_scalar.c \
+       nir_lower_locals_to_regs.c \
+       nir_lower_idiv.c \
+       nir_lower_io.c \
+       nir_lower_outputs_to_temporaries.c \
+       nir_lower_phis_to_scalar.c \
+       nir_lower_samplers.c \
+       nir_lower_system_values.c \
+       nir_lower_tex.c \
+       nir_lower_to_source_mods.c \
+       nir_lower_two_sided_color.c \
+       nir_lower_vars_to_ssa.c \
+       nir_lower_var_copies.c \
+       nir_lower_vec_to_movs.c \
+       nir_metadata.c \
+       nir_move_vec_src_uses_to_dest.c \
+       nir_normalize_cubemap_coords.c \
+       nir_opt_constant_folding.c \
+       nir_opt_copy_propagate.c \
+       nir_opt_cse.c \
+       nir_opt_dce.c \
+       nir_opt_dead_cf.c \
+       nir_opt_gcm.c \
+       nir_opt_global_to_local.c \
+       nir_opt_peephole_select.c \
+       nir_opt_remove_phis.c \
+       nir_opt_undef.c \
+       nir_print.c \
+       nir_remove_dead_variables.c \
+       nir_search.c \
+       nir_search.h \
+       nir_split_var_copies.c \
+       nir_sweep.c \
+       nir_to_ssa.c \
+       nir_validate.c \
+       nir_vla.h \
+       nir_worklist.c \
+       nir_worklist.h
+
diff --git a/src/glsl/nir/README b/src/compiler/nir/README
similarity index 100%
rename from src/glsl/nir/README
rename to src/compiler/nir/README
diff --git a/src/glsl/nir/glsl_to_nir.cpp b/src/compiler/nir/glsl_to_nir.cpp
similarity index 99%
rename from src/glsl/nir/glsl_to_nir.cpp
rename to src/compiler/nir/glsl_to_nir.cpp
index 45d045c..f5c5d50 100644
--- a/src/glsl/nir/glsl_to_nir.cpp
+++ b/src/compiler/nir/glsl_to_nir.cpp
@@ -25,13 +25,13 @@
  *
  */
 
+#include "glsl/ir_visitor.h"
+#include "glsl/ir_hierarchical_visitor.h"
+#include "glsl/ir.h"
 #include "glsl_to_nir.h"
+#include "main/imports.h"
 #include "nir_control_flow.h"
 #include "nir_builder.h"
-#include "ir_visitor.h"
-#include "ir_hierarchical_visitor.h"
-#include "ir.h"
-#include "main/imports.h"
 
 /*
  * pass to lower GLSL IR to NIR
diff --git a/src/glsl/nir/glsl_to_nir.h b/src/compiler/nir/glsl_to_nir.h
similarity index 97%
rename from src/glsl/nir/glsl_to_nir.h
rename to src/compiler/nir/glsl_to_nir.h
index 29badcd..c900d11 100644
--- a/src/glsl/nir/glsl_to_nir.h
+++ b/src/compiler/nir/glsl_to_nir.h
@@ -25,8 +25,8 @@
  *
  */
 
+#include "glsl/glsl_parser_extras.h"
 #include "nir.h"
-#include "../glsl_parser_extras.h"
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/src/glsl/nir/nir.c b/src/compiler/nir/nir.c
similarity index 100%
rename from src/glsl/nir/nir.c
rename to src/compiler/nir/nir.c
diff --git a/src/glsl/nir/nir.h b/src/compiler/nir/nir.h
similarity index 99%
rename from src/glsl/nir/nir.h
rename to src/compiler/nir/nir.h
index 7e99a7b..2122144 100644
--- a/src/glsl/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -28,7 +28,7 @@
 #pragma once
 
 #include "util/hash_table.h"
-#include "../list.h"
+#include "glsl/list.h"
 #include "GL/gl.h" /* GLenum */
 #include "util/list.h"
 #include "util/ralloc.h"
diff --git a/src/glsl/nir/nir_algebraic.py b/src/compiler/nir/nir_algebraic.py
similarity index 100%
rename from src/glsl/nir/nir_algebraic.py
rename to src/compiler/nir/nir_algebraic.py
diff --git a/src/glsl/nir/nir_array.h b/src/compiler/nir/nir_array.h
similarity index 100%
rename from src/glsl/nir/nir_array.h
rename to src/compiler/nir/nir_array.h
diff --git a/src/glsl/nir/nir_builder.h b/src/compiler/nir/nir_builder.h
similarity index 100%
rename from src/glsl/nir/nir_builder.h
rename to src/compiler/nir/nir_builder.h
diff --git a/src/glsl/nir/nir_builder_opcodes_h.py 
b/src/compiler/nir/nir_builder_opcodes_h.py
similarity index 100%
rename from src/glsl/nir/nir_builder_opcodes_h.py
rename to src/compiler/nir/nir_builder_opcodes_h.py
diff --git a/src/glsl/nir/nir_clone.c b/src/compiler/nir/nir_clone.c
similarity index 100%
rename from src/glsl/nir/nir_clone.c
rename to src/compiler/nir/nir_clone.c
diff --git a/src/glsl/nir/nir_constant_expressions.h 
b/src/compiler/nir/nir_constant_expressions.h
similarity index 100%
rename from src/glsl/nir/nir_constant_expressions.h
rename to src/compiler/nir/nir_constant_expressions.h
diff --git a/src/glsl/nir/nir_constant_expressions.py 
b/src/compiler/nir/nir_constant_expressions.py
similarity index 100%
rename from src/glsl/nir/nir_constant_expressions.py
rename to src/compiler/nir/nir_constant_expressions.py
diff --git a/src/glsl/nir/nir_control_flow.c 
b/src/compiler/nir/nir_control_flow.c
similarity index 100%
rename from src/glsl/nir/nir_control_flow.c
rename to src/compiler/nir/nir_control_flow.c
diff --git a/src/glsl/nir/nir_control_flow.h 
b/src/compiler/nir/nir_control_flow.h
similarity index 100%
rename from src/glsl/nir/nir_control_flow.h
rename to src/compiler/nir/nir_control_flow.h
diff --git a/src/glsl/nir/nir_control_flow_private.h 
b/src/compiler/nir/nir_control_flow_private.h
similarity index 100%
rename from src/glsl/nir/nir_control_flow_private.h
rename to src/compiler/nir/nir_control_flow_private.h
diff --git a/src/glsl/nir/nir_dominance.c b/src/compiler/nir/nir_dominance.c
similarity index 100%
rename from src/glsl/nir/nir_dominance.c
rename to src/compiler/nir/nir_dominance.c
diff --git a/src/glsl/nir/nir_from_ssa.c b/src/compiler/nir/nir_from_ssa.c
similarity index 100%
rename from src/glsl/nir/nir_from_ssa.c
rename to src/compiler/nir/nir_from_ssa.c
diff --git a/src/glsl/nir/nir_gs_count_vertices.c 
b/src/compiler/nir/nir_gs_count_vertices.c
similarity index 100%
rename from src/glsl/nir/nir_gs_count_vertices.c
rename to src/compiler/nir/nir_gs_count_vertices.c
diff --git a/src/glsl/nir/nir_instr_set.c b/src/compiler/nir/nir_instr_set.c
similarity index 100%
rename from src/glsl/nir/nir_instr_set.c
rename to src/compiler/nir/nir_instr_set.c
diff --git a/src/glsl/nir/nir_instr_set.h b/src/compiler/nir/nir_instr_set.h
similarity index 100%
rename from src/glsl/nir/nir_instr_set.h
rename to src/compiler/nir/nir_instr_set.h
diff --git a/src/glsl/nir/nir_intrinsics.c b/src/compiler/nir/nir_intrinsics.c
similarity index 100%
rename from src/glsl/nir/nir_intrinsics.c
rename to src/compiler/nir/nir_intrinsics.c
diff --git a/src/glsl/nir/nir_intrinsics.h b/src/compiler/nir/nir_intrinsics.h
similarity index 100%
rename from src/glsl/nir/nir_intrinsics.h
rename to src/compiler/nir/nir_intrinsics.h
diff --git a/src/glsl/nir/nir_liveness.c b/src/compiler/nir/nir_liveness.c
similarity index 100%
rename from src/glsl/nir/nir_liveness.c
rename to src/compiler/nir/nir_liveness.c
diff --git a/src/glsl/nir/nir_lower_alu_to_scalar.c 
b/src/compiler/nir/nir_lower_alu_to_scalar.c
similarity index 100%
rename from src/glsl/nir/nir_lower_alu_to_scalar.c
rename to src/compiler/nir/nir_lower_alu_to_scalar.c
diff --git a/src/glsl/nir/nir_lower_atomics.c 
b/src/compiler/nir/nir_lower_atomics.c
similarity index 99%
rename from src/glsl/nir/nir_lower_atomics.c
rename to src/compiler/nir/nir_lower_atomics.c
index 40ca3de..581498e 100644
--- a/src/glsl/nir/nir_lower_atomics.c
+++ b/src/compiler/nir/nir_lower_atomics.c
@@ -25,10 +25,10 @@
  *
  */
 
-#include "ir_uniform.h"
-#include "nir.h"
-#include "main/config.h"
 #include <assert.h>
+#include "glsl/ir_uniform.h"
+#include "main/config.h"
+#include "nir.h"
 
 typedef struct {
    const struct gl_shader_program *shader_program;
diff --git a/src/glsl/nir/nir_lower_clip.c b/src/compiler/nir/nir_lower_clip.c
similarity index 100%
rename from src/glsl/nir/nir_lower_clip.c
rename to src/compiler/nir/nir_lower_clip.c
diff --git a/src/glsl/nir/nir_lower_global_vars_to_local.c 
b/src/compiler/nir/nir_lower_global_vars_to_local.c
similarity index 100%
rename from src/glsl/nir/nir_lower_global_vars_to_local.c
rename to src/compiler/nir/nir_lower_global_vars_to_local.c
diff --git a/src/glsl/nir/nir_lower_gs_intrinsics.c 
b/src/compiler/nir/nir_lower_gs_intrinsics.c
similarity index 100%
rename from src/glsl/nir/nir_lower_gs_intrinsics.c
rename to src/compiler/nir/nir_lower_gs_intrinsics.c
diff --git a/src/glsl/nir/nir_lower_idiv.c b/src/compiler/nir/nir_lower_idiv.c
similarity index 100%
rename from src/glsl/nir/nir_lower_idiv.c
rename to src/compiler/nir/nir_lower_idiv.c
diff --git a/src/glsl/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c
similarity index 100%
rename from src/glsl/nir/nir_lower_io.c
rename to src/compiler/nir/nir_lower_io.c
diff --git a/src/glsl/nir/nir_lower_load_const_to_scalar.c 
b/src/compiler/nir/nir_lower_load_const_to_scalar.c
similarity index 100%
rename from src/glsl/nir/nir_lower_load_const_to_scalar.c
rename to src/compiler/nir/nir_lower_load_const_to_scalar.c
diff --git a/src/glsl/nir/nir_lower_locals_to_regs.c 
b/src/compiler/nir/nir_lower_locals_to_regs.c
similarity index 100%
rename from src/glsl/nir/nir_lower_locals_to_regs.c
rename to src/compiler/nir/nir_lower_locals_to_regs.c
diff --git a/src/glsl/nir/nir_lower_outputs_to_temporaries.c 
b/src/compiler/nir/nir_lower_outputs_to_temporaries.c
similarity index 100%
rename from src/glsl/nir/nir_lower_outputs_to_temporaries.c
rename to src/compiler/nir/nir_lower_outputs_to_temporaries.c
diff --git a/src/glsl/nir/nir_lower_phis_to_scalar.c 
b/src/compiler/nir/nir_lower_phis_to_scalar.c
similarity index 100%
rename from src/glsl/nir/nir_lower_phis_to_scalar.c
rename to src/compiler/nir/nir_lower_phis_to_scalar.c
diff --git a/src/glsl/nir/nir_lower_samplers.c 
b/src/compiler/nir/nir_lower_samplers.c
similarity index 99%
rename from src/glsl/nir/nir_lower_samplers.c
rename to src/compiler/nir/nir_lower_samplers.c
index 2aab305..43ed635 100644
--- a/src/glsl/nir/nir_lower_samplers.c
+++ b/src/compiler/nir/nir_lower_samplers.c
@@ -23,15 +23,15 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
-#include "nir.h"
-#include "nir_builder.h"
-#include "program/hash_table.h"
-#include "ir_uniform.h"
-
+#include "glsl/ir_uniform.h"
 #include "main/compiler.h"
 #include "main/mtypes.h"
 #include "program/prog_parameter.h"
 #include "program/program.h"
+#include "program/hash_table.h"
+
+#include "nir.h"
+#include "nir_builder.h"
 
 /* Calculate the sampler index based on array indicies and also
  * calculate the base uniform location for struct members.
diff --git a/src/glsl/nir/nir_lower_system_values.c 
b/src/compiler/nir/nir_lower_system_values.c
similarity index 100%
rename from src/glsl/nir/nir_lower_system_values.c
rename to src/compiler/nir/nir_lower_system_values.c
diff --git a/src/glsl/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c
similarity index 100%
rename from src/glsl/nir/nir_lower_tex.c
rename to src/compiler/nir/nir_lower_tex.c
diff --git a/src/glsl/nir/nir_lower_to_source_mods.c 
b/src/compiler/nir/nir_lower_to_source_mods.c
similarity index 100%
rename from src/glsl/nir/nir_lower_to_source_mods.c
rename to src/compiler/nir/nir_lower_to_source_mods.c
diff --git a/src/glsl/nir/nir_lower_two_sided_color.c 
b/src/compiler/nir/nir_lower_two_sided_color.c
similarity index 100%
rename from src/glsl/nir/nir_lower_two_sided_color.c
rename to src/compiler/nir/nir_lower_two_sided_color.c
diff --git a/src/glsl/nir/nir_lower_var_copies.c 
b/src/compiler/nir/nir_lower_var_copies.c
similarity index 100%
rename from src/glsl/nir/nir_lower_var_copies.c
rename to src/compiler/nir/nir_lower_var_copies.c
diff --git a/src/glsl/nir/nir_lower_vars_to_ssa.c 
b/src/compiler/nir/nir_lower_vars_to_ssa.c
similarity index 100%
rename from src/glsl/nir/nir_lower_vars_to_ssa.c
rename to src/compiler/nir/nir_lower_vars_to_ssa.c
diff --git a/src/glsl/nir/nir_lower_vec_to_movs.c 
b/src/compiler/nir/nir_lower_vec_to_movs.c
similarity index 100%
rename from src/glsl/nir/nir_lower_vec_to_movs.c
rename to src/compiler/nir/nir_lower_vec_to_movs.c
diff --git a/src/glsl/nir/nir_metadata.c b/src/compiler/nir/nir_metadata.c
similarity index 100%
rename from src/glsl/nir/nir_metadata.c
rename to src/compiler/nir/nir_metadata.c
diff --git a/src/glsl/nir/nir_move_vec_src_uses_to_dest.c 
b/src/compiler/nir/nir_move_vec_src_uses_to_dest.c
similarity index 100%
rename from src/glsl/nir/nir_move_vec_src_uses_to_dest.c
rename to src/compiler/nir/nir_move_vec_src_uses_to_dest.c
diff --git a/src/glsl/nir/nir_normalize_cubemap_coords.c 
b/src/compiler/nir/nir_normalize_cubemap_coords.c
similarity index 100%
rename from src/glsl/nir/nir_normalize_cubemap_coords.c
rename to src/compiler/nir/nir_normalize_cubemap_coords.c
diff --git a/src/glsl/nir/nir_opcodes.py b/src/compiler/nir/nir_opcodes.py
similarity index 100%
rename from src/glsl/nir/nir_opcodes.py
rename to src/compiler/nir/nir_opcodes.py
diff --git a/src/glsl/nir/nir_opcodes_c.py b/src/compiler/nir/nir_opcodes_c.py
similarity index 100%
rename from src/glsl/nir/nir_opcodes_c.py
rename to src/compiler/nir/nir_opcodes_c.py
diff --git a/src/glsl/nir/nir_opcodes_h.py b/src/compiler/nir/nir_opcodes_h.py
similarity index 100%
rename from src/glsl/nir/nir_opcodes_h.py
rename to src/compiler/nir/nir_opcodes_h.py
diff --git a/src/glsl/nir/nir_opt_algebraic.py 
b/src/compiler/nir/nir_opt_algebraic.py
similarity index 100%
rename from src/glsl/nir/nir_opt_algebraic.py
rename to src/compiler/nir/nir_opt_algebraic.py
diff --git a/src/glsl/nir/nir_opt_constant_folding.c 
b/src/compiler/nir/nir_opt_constant_folding.c
similarity index 100%
rename from src/glsl/nir/nir_opt_constant_folding.c
rename to src/compiler/nir/nir_opt_constant_folding.c
diff --git a/src/glsl/nir/nir_opt_copy_propagate.c 
b/src/compiler/nir/nir_opt_copy_propagate.c
similarity index 100%
rename from src/glsl/nir/nir_opt_copy_propagate.c
rename to src/compiler/nir/nir_opt_copy_propagate.c
diff --git a/src/glsl/nir/nir_opt_cse.c b/src/compiler/nir/nir_opt_cse.c
similarity index 100%
rename from src/glsl/nir/nir_opt_cse.c
rename to src/compiler/nir/nir_opt_cse.c
diff --git a/src/glsl/nir/nir_opt_dce.c b/src/compiler/nir/nir_opt_dce.c
similarity index 100%
rename from src/glsl/nir/nir_opt_dce.c
rename to src/compiler/nir/nir_opt_dce.c
diff --git a/src/glsl/nir/nir_opt_dead_cf.c b/src/compiler/nir/nir_opt_dead_cf.c
similarity index 100%
rename from src/glsl/nir/nir_opt_dead_cf.c
rename to src/compiler/nir/nir_opt_dead_cf.c
diff --git a/src/glsl/nir/nir_opt_gcm.c b/src/compiler/nir/nir_opt_gcm.c
similarity index 100%
rename from src/glsl/nir/nir_opt_gcm.c
rename to src/compiler/nir/nir_opt_gcm.c
diff --git a/src/glsl/nir/nir_opt_global_to_local.c 
b/src/compiler/nir/nir_opt_global_to_local.c
similarity index 100%
rename from src/glsl/nir/nir_opt_global_to_local.c
rename to src/compiler/nir/nir_opt_global_to_local.c
diff --git a/src/glsl/nir/nir_opt_peephole_select.c 
b/src/compiler/nir/nir_opt_peephole_select.c
similarity index 100%
rename from src/glsl/nir/nir_opt_peephole_select.c
rename to src/compiler/nir/nir_opt_peephole_select.c
diff --git a/src/glsl/nir/nir_opt_remove_phis.c 
b/src/compiler/nir/nir_opt_remove_phis.c
similarity index 100%
rename from src/glsl/nir/nir_opt_remove_phis.c
rename to src/compiler/nir/nir_opt_remove_phis.c
diff --git a/src/glsl/nir/nir_opt_undef.c b/src/compiler/nir/nir_opt_undef.c
similarity index 100%
rename from src/glsl/nir/nir_opt_undef.c
rename to src/compiler/nir/nir_opt_undef.c
diff --git a/src/glsl/nir/nir_print.c b/src/compiler/nir/nir_print.c
similarity index 100%
rename from src/glsl/nir/nir_print.c
rename to src/compiler/nir/nir_print.c
diff --git a/src/glsl/nir/nir_remove_dead_variables.c 
b/src/compiler/nir/nir_remove_dead_variables.c
similarity index 100%
rename from src/glsl/nir/nir_remove_dead_variables.c
rename to src/compiler/nir/nir_remove_dead_variables.c
diff --git a/src/glsl/nir/nir_search.c b/src/compiler/nir/nir_search.c
similarity index 100%
rename from src/glsl/nir/nir_search.c
rename to src/compiler/nir/nir_search.c
diff --git a/src/glsl/nir/nir_search.h b/src/compiler/nir/nir_search.h
similarity index 100%
rename from src/glsl/nir/nir_search.h
rename to src/compiler/nir/nir_search.h
diff --git a/src/glsl/nir/nir_split_var_copies.c 
b/src/compiler/nir/nir_split_var_copies.c
similarity index 100%
rename from src/glsl/nir/nir_split_var_copies.c
rename to src/compiler/nir/nir_split_var_copies.c
diff --git a/src/glsl/nir/nir_sweep.c b/src/compiler/nir/nir_sweep.c
similarity index 100%
rename from src/glsl/nir/nir_sweep.c
rename to src/compiler/nir/nir_sweep.c
diff --git a/src/glsl/nir/nir_to_ssa.c b/src/compiler/nir/nir_to_ssa.c
similarity index 100%
rename from src/glsl/nir/nir_to_ssa.c
rename to src/compiler/nir/nir_to_ssa.c
diff --git a/src/glsl/nir/nir_validate.c b/src/compiler/nir/nir_validate.c
similarity index 100%
rename from src/glsl/nir/nir_validate.c
rename to src/compiler/nir/nir_validate.c
diff --git a/src/glsl/nir/nir_vla.h b/src/compiler/nir/nir_vla.h
similarity index 100%
rename from src/glsl/nir/nir_vla.h
rename to src/compiler/nir/nir_vla.h
diff --git a/src/glsl/nir/nir_worklist.c b/src/compiler/nir/nir_worklist.c
similarity index 100%
rename from src/glsl/nir/nir_worklist.c
rename to src/compiler/nir/nir_worklist.c
diff --git a/src/glsl/nir/nir_worklist.h b/src/compiler/nir/nir_worklist.h
similarity index 100%
rename from src/glsl/nir/nir_worklist.h
rename to src/compiler/nir/nir_worklist.h
diff --git a/src/glsl/nir/tests/control_flow_tests.cpp 
b/src/compiler/nir/tests/control_flow_tests.cpp
similarity index 100%
rename from src/glsl/nir/tests/control_flow_tests.cpp
rename to src/compiler/nir/tests/control_flow_tests.cpp
diff --git a/src/gallium/auxiliary/Makefile.am 
b/src/gallium/auxiliary/Makefile.am
index ee296ce..8e53ca9 100644
--- a/src/gallium/auxiliary/Makefile.am
+++ b/src/gallium/auxiliary/Makefile.am
@@ -5,7 +5,7 @@ noinst_LTLIBRARIES = libgallium.la
 
 AM_CFLAGS = \
        -I$(top_srcdir)/src/loader \
-       -I$(top_builddir)/src/glsl/nir \
+       -I$(top_builddir)/src/compiler/nir \
        -I$(top_srcdir)/src/gallium/auxiliary/util \
        $(GALLIUM_CFLAGS) \
        $(VISIBILITY_CFLAGS) \
diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c 
b/src/gallium/auxiliary/nir/tgsi_to_nir.c
index 3301175..4dd16b1 100644
--- a/src/gallium/auxiliary/nir/tgsi_to_nir.c
+++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c
@@ -23,11 +23,11 @@
  */
 
 #include "compiler/shader_enums.h"
+#include "compiler/nir/nir.h"
+#include "compiler/nir/nir_control_flow.h"
+#include "compiler/nir/nir_builder.h"
 
 #include "util/ralloc.h"
-#include "glsl/nir/nir.h"
-#include "glsl/nir/nir_control_flow.h"
-#include "glsl/nir/nir_builder.h"
 #include "glsl/list.h"
 
 #include "nir/tgsi_to_nir.h"
diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.h 
b/src/gallium/auxiliary/nir/tgsi_to_nir.h
index 1a185a8..0651870 100644
--- a/src/gallium/auxiliary/nir/tgsi_to_nir.h
+++ b/src/gallium/auxiliary/nir/tgsi_to_nir.h
@@ -21,7 +21,7 @@
  * IN THE SOFTWARE.
  */
 
-#include "glsl/nir/nir.h"
+#include "compiler/nir/nir.h"
 
 struct nir_shader_compiler_options *options;
 
diff --git a/src/gallium/drivers/freedreno/Makefile.am 
b/src/gallium/drivers/freedreno/Makefile.am
index 3de8e0f..329a420 100644
--- a/src/gallium/drivers/freedreno/Makefile.am
+++ b/src/gallium/drivers/freedreno/Makefile.am
@@ -4,7 +4,7 @@ include $(top_srcdir)/src/gallium/Automake.inc
 AM_CFLAGS = \
        -Wno-packed-bitfield-compat \
        -I$(top_srcdir)/src/gallium/drivers/freedreno/ir3 \
-       -I$(top_builddir)/src/glsl/nir \
+       -I$(top_builddir)/src/compiler/nir \
        $(GALLIUM_DRIVER_CFLAGS) \
        $(FREEDRENO_CFLAGS)
 
@@ -27,7 +27,7 @@ ir3_compiler_SOURCES = \
 ir3_compiler_LDADD = \
        libfreedreno.la \
        $(top_builddir)/src/gallium/auxiliary/libgallium.la \
-       $(top_builddir)/src/glsl/libnir.la \
+       $(top_builddir)/src/compiler/nir/libnir.la \
        $(top_builddir)/src/util/libmesautil.la \
        $(GALLIUM_COMMON_LIB_DEPS) \
        $(FREEDRENO_LIBS)
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_nir.h 
b/src/gallium/drivers/freedreno/ir3/ir3_nir.h
index f3d3075..31d2532 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_nir.h
+++ b/src/gallium/drivers/freedreno/ir3/ir3_nir.h
@@ -29,7 +29,7 @@
 #ifndef IR3_NIR_H_
 #define IR3_NIR_H_
 
-#include "glsl/nir/nir.h"
+#include "compiler/nir/nir.h"
 
 bool ir3_nir_lower_if_else(nir_shader *shader);
 
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_nir_lower_if_else.c 
b/src/gallium/drivers/freedreno/ir3/ir3_nir_lower_if_else.c
index 4ec0e2b..c424cae 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_nir_lower_if_else.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_nir_lower_if_else.c
@@ -27,9 +27,9 @@
  *
  */
 
+#include "compiler/nir/nir_builder.h"
+#include "compiler/nir/nir_control_flow.h"
 #include "ir3_nir.h"
-#include "glsl/nir/nir_builder.h"
-#include "glsl/nir/nir_control_flow.h"
 
 /* Based on nir_opt_peephole_select, and hacked up to more aggressively
  * flatten anything that can be flattened
diff --git a/src/gallium/drivers/vc4/Makefile.am 
b/src/gallium/drivers/vc4/Makefile.am
index a3bf72f..caa5059 100644
--- a/src/gallium/drivers/vc4/Makefile.am
+++ b/src/gallium/drivers/vc4/Makefile.am
@@ -27,7 +27,7 @@ SIM_LDFLAGS = -lsimpenrose
 endif
 
 AM_CFLAGS = \
-       -I$(top_builddir)/src/glsl/nir \
+       -I$(top_builddir)/src/compiler/nir \
        $(LIBDRM_CFLAGS) \
        $(GALLIUM_DRIVER_CFLAGS) \
        $(SIM_CFLAGS) \
diff --git a/src/gallium/drivers/vc4/vc4_nir_lower_blend.c 
b/src/gallium/drivers/vc4/vc4_nir_lower_blend.c
index 0672a92..40dc7b1 100644
--- a/src/gallium/drivers/vc4/vc4_nir_lower_blend.c
+++ b/src/gallium/drivers/vc4/vc4_nir_lower_blend.c
@@ -35,10 +35,11 @@
  * Lowers fixed-function blending to a load of the destination color and a
  * series of ALU operations before the store of the output.
  */
+#include "compiler/nir/nir_builder.h"
+
 #include "util/u_format.h"
-#include "vc4_qir.h"
-#include "glsl/nir/nir_builder.h"
 #include "vc4_context.h"
+#include "vc4_qir.h"
 
 /** Emits a load of the previous fragment color from the tile buffer. */
 static nir_ssa_def *
diff --git a/src/gallium/drivers/vc4/vc4_nir_lower_io.c 
b/src/gallium/drivers/vc4/vc4_nir_lower_io.c
index 1afe52a..00aa4a2 100644
--- a/src/gallium/drivers/vc4/vc4_nir_lower_io.c
+++ b/src/gallium/drivers/vc4/vc4_nir_lower_io.c
@@ -21,9 +21,10 @@
  * IN THE SOFTWARE.
  */
 
-#include "vc4_qir.h"
-#include "glsl/nir/nir_builder.h"
+#include "compiler/nir/nir_builder.h"
+
 #include "util/u_format.h"
+#include "vc4_qir.h"
 
 /**
  * Walks the NIR generated by TGSI-to-NIR to lower its io intrinsics into
diff --git a/src/gallium/drivers/vc4/vc4_program.c 
b/src/gallium/drivers/vc4/vc4_program.c
index 197577b..fd0bcc1 100644
--- a/src/gallium/drivers/vc4/vc4_program.c
+++ b/src/gallium/drivers/vc4/vc4_program.c
@@ -23,6 +23,9 @@
  */
 
 #include <inttypes.h>
+#include "compiler/nir/nir.h"
+#include "compiler/nir/nir_builder.h"
+
 #include "util/u_format.h"
 #include "util/u_hash.h"
 #include "util/u_math.h"
@@ -32,8 +35,6 @@
 #include "tgsi/tgsi_dump.h"
 #include "tgsi/tgsi_lowering.h"
 #include "tgsi/tgsi_parse.h"
-#include "glsl/nir/nir.h"
-#include "glsl/nir/nir_builder.h"
 #include "nir/tgsi_to_nir.h"
 #include "vc4_context.h"
 #include "vc4_qpu.h"
diff --git a/src/gallium/drivers/vc4/vc4_qir.h 
b/src/gallium/drivers/vc4/vc4_qir.h
index ddb35e4..5c82dbf 100644
--- a/src/gallium/drivers/vc4/vc4_qir.h
+++ b/src/gallium/drivers/vc4/vc4_qir.h
@@ -30,9 +30,9 @@
 #include <stdbool.h>
 #include <stdint.h>
 #include <string.h>
+#include "compiler/nir/nir.h"
 
 #include "util/macros.h"
-#include "glsl/nir/nir.h"
 #include "util/list.h"
 #include "util/u_math.h"
 
diff --git a/src/gallium/targets/pipe-loader/Makefile.am 
b/src/gallium/targets/pipe-loader/Makefile.am
index 4bc3b55..0b516de 100644
--- a/src/gallium/targets/pipe-loader/Makefile.am
+++ b/src/gallium/targets/pipe-loader/Makefile.am
@@ -53,7 +53,7 @@ endif
 
 PIPE_LIBS += \
        $(top_builddir)/src/gallium/auxiliary/libgallium.la \
-       $(top_builddir)/src/glsl/libnir.la \
+       $(top_builddir)/src/compiler/nir/libnir.la \
        $(top_builddir)/src/util/libmesautil.la \
        $(top_builddir)/src/gallium/drivers/rbug/librbug.la \
        $(top_builddir)/src/gallium/drivers/trace/libtrace.la \
diff --git a/src/gallium/targets/xa/Makefile.am 
b/src/gallium/targets/xa/Makefile.am
index a63fd69..cdd9a86 100644
--- a/src/gallium/targets/xa/Makefile.am
+++ b/src/gallium/targets/xa/Makefile.am
@@ -37,7 +37,7 @@ libxatracker_la_LIBADD = \
        $(top_builddir)/src/gallium/state_trackers/xa/libxatracker.la \
        $(top_builddir)/src/gallium/auxiliary/libgalliumvl_stub.la \
        $(top_builddir)/src/gallium/auxiliary/libgallium.la \
-       $(top_builddir)/src/glsl/libnir.la \
+       $(top_builddir)/src/compiler/nir/libnir.la \
        $(top_builddir)/src/util/libmesautil.la \
        $(LIBDRM_LIBS) \
        $(GALLIUM_COMMON_LIB_DEPS)
diff --git a/src/glsl/Android.gen.mk b/src/glsl/Android.gen.mk
index 59cc857..384939f 100644
--- a/src/glsl/Android.gen.mk
+++ b/src/glsl/Android.gen.mk
@@ -33,17 +33,10 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES)
 
 LOCAL_C_INCLUDES += \
        $(intermediates)/glcpp \
-       $(intermediates)/nir \
-       $(MESA_TOP)/src/glsl/glcpp \
-       $(MESA_TOP)/src/glsl/nir
-
-LOCAL_EXPORT_C_INCLUDE_DIRS += \
-       $(intermediates)/nir \
-       $(MESA_TOP)/src/glsl/nir
+       $(MESA_TOP)/src/glsl/glcpp
 
 LOCAL_GENERATED_SOURCES += $(addprefix $(intermediates)/, \
        $(LIBGLCPP_GENERATED_FILES) \
-       $(NIR_GENERATED_FILES) \
        $(LIBGLSL_GENERATED_CXX_FILES))
 
 define local-l-or-ll-to-c-or-cpp
@@ -81,50 +74,3 @@ $(intermediates)/glcpp/glcpp-lex.c: 
$(LOCAL_PATH)/glcpp/glcpp-lex.l
 
 $(intermediates)/glcpp/glcpp-parse.c: $(LOCAL_PATH)/glcpp/glcpp-parse.y
        $(call glsl_local-y-to-c-and-h)
-
-nir_builder_opcodes_gen := $(LOCAL_PATH)/nir/nir_builder_opcodes_h.py
-nir_builder_opcodes_deps := \
-       $(LOCAL_PATH)/nir/nir_opcodes.py \
-       $(LOCAL_PATH)/nir/nir_builder_opcodes_h.py
-
-$(intermediates)/nir/nir_builder_opcodes.h: $(nir_builder_opcodes_deps)
-       @mkdir -p $(dir $@)
-       $(hide) $(MESA_PYTHON2) $(nir_builder_opcodes_gen) $< > $@
-
-nir_constant_expressions_gen := $(LOCAL_PATH)/nir/nir_constant_expressions.py
-nir_constant_expressions_deps := \
-       $(LOCAL_PATH)/nir/nir_opcodes.py \
-       $(LOCAL_PATH)/nir/nir_constant_expressions.py
-
-$(intermediates)/nir/nir_constant_expressions.c: 
$(nir_constant_expressions_deps)
-       @mkdir -p $(dir $@)
-       $(hide) $(MESA_PYTHON2) $(nir_constant_expressions_gen) $< > $@
-
-nir_opcodes_h_gen := $(LOCAL_PATH)/nir/nir_opcodes_h.py
-nir_opcodes_h_deps := \
-       $(LOCAL_PATH)/nir/nir_opcodes.py \
-       $(LOCAL_PATH)/nir/nir_opcodes_h.py
-
-$(intermediates)/nir/nir_opcodes.h: $(nir_opcodes_h_deps)
-       @mkdir -p $(dir $@)
-       $(hide) $(MESA_PYTHON2) $(nir_opcodes_h_gen) $< > $@
-
-$(LOCAL_PATH)/nir/nir.h: $(intermediates)/nir/nir_opcodes.h
-
-nir_opcodes_c_gen := $(LOCAL_PATH)/nir/nir_opcodes_c.py
-nir_opcodes_c_deps := \
-       $(LOCAL_PATH)/nir/nir_opcodes.py \
-       $(LOCAL_PATH)/nir/nir_opcodes_c.py
-
-$(intermediates)/nir/nir_opcodes.c: $(nir_opcodes_c_deps)
-       @mkdir -p $(dir $@)
-       $(hide) $(MESA_PYTHON2) $(nir_opcodes_c_gen) $< > $@
-
-nir_opt_algebraic_gen := $(LOCAL_PATH)/nir/nir_opt_algebraic.py
-nir_opt_algebraic_deps := \
-       $(LOCAL_PATH)/nir/nir_opt_algebraic.py \
-       $(LOCAL_PATH)/nir/nir_algebraic.py
-
-$(intermediates)/nir/nir_opt_algebraic.c: $(nir_opt_algebraic_deps)
-       @mkdir -p $(dir $@)
-       $(hide) $(MESA_PYTHON2) $(nir_opt_algebraic_gen) $< > $@
diff --git a/src/glsl/Android.mk b/src/glsl/Android.mk
index 9cbb9a3..1e9fd87 100644
--- a/src/glsl/Android.mk
+++ b/src/glsl/Android.mk
@@ -35,8 +35,7 @@ include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES := \
        $(LIBGLCPP_FILES) \
-       $(LIBGLSL_FILES) \
-       $(NIR_FILES)
+       $(LIBGLSL_FILES)
 
 LOCAL_C_INCLUDES := \
        $(MESA_TOP)/src/mapi \
@@ -44,7 +43,7 @@ LOCAL_C_INCLUDES := \
        $(MESA_TOP)/src/gallium/include \
        $(MESA_TOP)/src/gallium/auxiliary
 
-LOCAL_STATIC_LIBRARIES := libmesa_compiler
+LOCAL_STATIC_LIBRARIES := libmesa_compiler libmesa_nir
 
 LOCAL_MODULE := libmesa_glsl
 
diff --git a/src/glsl/Makefile.am b/src/glsl/Makefile.am
index 225ec27..9954b81 100644
--- a/src/glsl/Makefile.am
+++ b/src/glsl/Makefile.am
@@ -27,9 +27,7 @@ AM_CPPFLAGS = \
        -I$(top_srcdir)/src/gallium/include \
        -I$(top_srcdir)/src/gallium/auxiliary \
        -I$(top_srcdir)/src/glsl/glcpp \
-       -I$(top_srcdir)/src/glsl/nir \
        -I$(top_srcdir)/src/gtest/include \
-       -I$(top_builddir)/src/glsl/nir \
        $(DEFINES)
 AM_CFLAGS = \
        $(VISIBILITY_CFLAGS) \
@@ -43,21 +41,12 @@ EXTRA_DIST = tests glcpp/tests README TODO glcpp/README     
\
        glsl_parser.yy                                  \
        glcpp/glcpp-lex.l                               \
        glcpp/glcpp-parse.y                             \
-       nir/nir_algebraic.py                            \
-       nir/nir_builder_opcodes_h.py                    \
-       nir/nir_constant_expressions.py                 \
-       nir/nir_opcodes.py                              \
-       nir/nir_opcodes_c.py                            \
-       nir/nir_opcodes_h.py                            \
-       nir/nir_opt_algebraic.py                        \
-       nir/tests                                       \
        SConscript
 
 include Makefile.sources
 
 TESTS = glcpp/tests/glcpp-test                         \
        glcpp/tests/glcpp-test-cr-lf                    \
-        nir/tests/control_flow_tests                   \
        tests/blob-test                                 \
        tests/general-ir-test                           \
        tests/optimization-test                         \
@@ -68,11 +57,10 @@ TESTS_ENVIRONMENT= \
        export PYTHON2=$(PYTHON2); \
        export PYTHON_FLAGS=$(PYTHON_FLAGS);
 
-noinst_LTLIBRARIES = libnir.la libglsl.la libglcpp.la
+noinst_LTLIBRARIES = libglsl.la libglcpp.la
 check_PROGRAMS =                                       \
        glcpp/glcpp                                     \
        glsl_test                                       \
-       nir/tests/control_flow_tests                    \
        tests/blob-test                                 \
        tests/general-ir-test                           \
        tests/sampler-types-test                        \
@@ -138,25 +126,16 @@ glcpp_glcpp_LDADD =                                       
\
        -lm
 
 libglsl_la_LIBADD = \
-       $(top_builddir)/src/compiler/libcompiler.la \
+       $(top_builddir)/src/compiler/nir/libnir.la \
        libglcpp.la
 
 libglsl_la_SOURCES =                                   \
        glsl_lexer.cpp                                  \
        glsl_parser.cpp                                 \
        glsl_parser.h                                   \
-       $(LIBGLSL_FILES)                                \
-       $(NIR_FILES)                                    \
-       $(NIR_GENERATED_FILES)
+       $(LIBGLSL_FILES)
 
 
-libnir_la_LIBADD = \
-       $(top_builddir)/src/compiler/libcompiler.la
-
-libnir_la_SOURCES =                                    \
-       $(NIR_FILES)                                    \
-       $(NIR_GENERATED_FILES)
-
 glsl_compiler_SOURCES = \
        $(GLSL_COMPILER_CXX_FILES)
 
@@ -235,8 +214,7 @@ BUILT_SOURCES =                                             
\
        glsl_parser.cpp                                 \
        glsl_lexer.cpp                                  \
        glcpp/glcpp-parse.c                             \
-       glcpp/glcpp-lex.c                               \
-       $(NIR_GENERATED_FILES)
+       glcpp/glcpp-lex.c
 CLEANFILES =                                           \
        glcpp/glcpp-parse.h                             \
        glsl_parser.h                                   \
@@ -248,35 +226,3 @@ clean-local:
 dist-hook:
        $(RM) glcpp/tests/*.out
        $(RM) glcpp/tests/subtest*/*.out
-
-PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
-
-nir/nir_builder_opcodes.h: nir/nir_opcodes.py nir/nir_builder_opcodes_h.py
-       $(MKDIR_GEN)
-       $(PYTHON_GEN) $(srcdir)/nir/nir_builder_opcodes_h.py > $@
-
-nir/nir_constant_expressions.c: nir/nir_opcodes.py 
nir/nir_constant_expressions.py
-       $(MKDIR_GEN)
-       $(PYTHON_GEN) $(srcdir)/nir/nir_constant_expressions.py > $@
-
-nir/nir_opcodes.h: nir/nir_opcodes.py nir/nir_opcodes_h.py
-       $(MKDIR_GEN)
-       $(PYTHON_GEN) $(srcdir)/nir/nir_opcodes_h.py > $@
-
-nir/nir_opcodes.c: nir/nir_opcodes.py nir/nir_opcodes_c.py
-       $(MKDIR_GEN)
-       $(PYTHON_GEN) $(srcdir)/nir/nir_opcodes_c.py > $@
-
-nir/nir_opt_algebraic.c: nir/nir_opt_algebraic.py nir/nir_algebraic.py
-       $(MKDIR_GEN)
-       $(PYTHON_GEN) $(srcdir)/nir/nir_opt_algebraic.py > $@
-
-nir_tests_control_flow_tests_SOURCES =                 \
-       nir/tests/control_flow_tests.cpp
-nir_tests_control_flow_tests_CFLAGS =                  \
-       $(PTHREAD_CFLAGS)
-nir_tests_control_flow_tests_LDADD =                   \
-       $(top_builddir)/src/gtest/libgtest.la           \
-       $(top_builddir)/src/glsl/libnir.la              \
-       $(top_builddir)/src/util/libmesautil.la         \
-       $(PTHREAD_LIBS)
diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources
index 5bf6486..4f9c1c1 100644
--- a/src/glsl/Makefile.sources
+++ b/src/glsl/Makefile.sources
@@ -10,77 +10,6 @@ LIBGLCPP_GENERATED_FILES = \
        glcpp/glcpp-lex.c \
        glcpp/glcpp-parse.c
 
-NIR_GENERATED_FILES = \
-       nir/nir_builder_opcodes.h \
-       nir/nir_constant_expressions.c \
-       nir/nir_opcodes.c \
-       nir/nir_opcodes.h \
-       nir/nir_opt_algebraic.c
-
-NIR_FILES = \
-       nir/glsl_to_nir.cpp \
-       nir/glsl_to_nir.h \
-       nir/nir.c \
-       nir/nir.h \
-       nir/nir_array.h \
-       nir/nir_builder.h \
-       nir/nir_clone.c \
-       nir/nir_constant_expressions.h \
-       nir/nir_control_flow.c \
-       nir/nir_control_flow.h \
-       nir/nir_control_flow_private.h \
-       nir/nir_dominance.c \
-       nir/nir_from_ssa.c \
-       nir/nir_gs_count_vertices.c \
-       nir/nir_intrinsics.c \
-       nir/nir_intrinsics.h \
-       nir/nir_instr_set.c \
-       nir/nir_instr_set.h \
-       nir/nir_liveness.c \
-       nir/nir_lower_alu_to_scalar.c \
-       nir/nir_lower_atomics.c \
-       nir/nir_lower_clip.c \
-       nir/nir_lower_global_vars_to_local.c \
-       nir/nir_lower_gs_intrinsics.c \
-       nir/nir_lower_load_const_to_scalar.c \
-       nir/nir_lower_locals_to_regs.c \
-       nir/nir_lower_idiv.c \
-       nir/nir_lower_io.c \
-       nir/nir_lower_outputs_to_temporaries.c \
-       nir/nir_lower_phis_to_scalar.c \
-       nir/nir_lower_samplers.c \
-       nir/nir_lower_system_values.c \
-       nir/nir_lower_tex.c \
-       nir/nir_lower_to_source_mods.c \
-       nir/nir_lower_two_sided_color.c \
-       nir/nir_lower_vars_to_ssa.c \
-       nir/nir_lower_var_copies.c \
-       nir/nir_lower_vec_to_movs.c \
-       nir/nir_metadata.c \
-       nir/nir_move_vec_src_uses_to_dest.c \
-       nir/nir_normalize_cubemap_coords.c \
-       nir/nir_opt_constant_folding.c \
-       nir/nir_opt_copy_propagate.c \
-       nir/nir_opt_cse.c \
-       nir/nir_opt_dce.c \
-       nir/nir_opt_dead_cf.c \
-       nir/nir_opt_gcm.c \
-       nir/nir_opt_global_to_local.c \
-       nir/nir_opt_peephole_select.c \
-       nir/nir_opt_remove_phis.c \
-       nir/nir_opt_undef.c \
-       nir/nir_print.c \
-       nir/nir_remove_dead_variables.c \
-       nir/nir_search.c \
-       nir/nir_search.h \
-       nir/nir_split_var_copies.c \
-       nir/nir_sweep.c \
-       nir/nir_to_ssa.c \
-       nir/nir_validate.c \
-       nir/nir_vla.h \
-       nir/nir_worklist.c \
-       nir/nir_worklist.h
-
 # libglsl
 
 LIBGLSL_FILES = \
diff --git a/src/glsl/ir_hierarchical_visitor.h 
b/src/glsl/ir_hierarchical_visitor.h
index 28517b6..4e91f8c 100644
--- a/src/glsl/ir_hierarchical_visitor.h
+++ b/src/glsl/ir_hierarchical_visitor.h
@@ -26,6 +26,8 @@
 #ifndef IR_HIERARCHICAL_VISITOR_H
 #define IR_HIERARCHICAL_VISITOR_H
 
+#include <stddef.h>
+
 /**
  * Enumeration values returned by visit methods to guide processing
  */
diff --git a/src/glsl/ir_visitor.h b/src/glsl/ir_visitor.h
index 7c38481..2e576a1 100644
--- a/src/glsl/ir_visitor.h
+++ b/src/glsl/ir_visitor.h
@@ -26,6 +26,8 @@
 #ifndef IR_VISITOR_H
 #define IR_VISITOR_H
 
+#include <assert.h>
+
 #ifdef __cplusplus
 /**
  * Abstract base class of visitors of IR instruction trees
diff --git a/src/mesa/Android.libmesa_dricore.mk 
b/src/mesa/Android.libmesa_dricore.mk
index cd31e14..fef76c8 100644
--- a/src/mesa/Android.libmesa_dricore.mk
+++ b/src/mesa/Android.libmesa_dricore.mk
@@ -60,7 +60,6 @@ LOCAL_C_INCLUDES := \
        $(MESA_TOP)/src/mapi \
        $(MESA_TOP)/src/mesa/main \
        $(MESA_TOP)/src/glsl \
-       $(MESA_TOP)/src/glsl/nir \
        $(MESA_TOP)/src/gallium/include \
        $(MESA_TOP)/src/gallium/auxiliary
 
diff --git a/src/mesa/Android.libmesa_glsl_utils.mk 
b/src/mesa/Android.libmesa_glsl_utils.mk
index 9e150ea..ed620ac 100644
--- a/src/mesa/Android.libmesa_glsl_utils.mk
+++ b/src/mesa/Android.libmesa_glsl_utils.mk
@@ -37,7 +37,6 @@ LOCAL_MODULE := libmesa_glsl_utils
 
 LOCAL_C_INCLUDES := \
        $(MESA_TOP)/src/glsl \
-       $(MESA_TOP)/src/glsl/nir \
        $(MESA_TOP)/src/mapi \
        $(MESA_TOP)/src/gallium/include \
        $(MESA_TOP)/src/gallium/auxiliary
@@ -63,7 +62,6 @@ LOCAL_CFLAGS := -D_POSIX_C_SOURCE=199309L
 
 LOCAL_C_INCLUDES := \
        $(MESA_TOP)/src/glsl \
-       $(MESA_TOP)/src/glsl/nir \
        $(MESA_TOP)/src/mapi \
        $(MESA_TOP)/src/gallium/include \
        $(MESA_TOP)/src/gallium/auxiliary
diff --git a/src/mesa/Android.libmesa_st_mesa.mk 
b/src/mesa/Android.libmesa_st_mesa.mk
index 427a35f..b4b7fd9 100644
--- a/src/mesa/Android.libmesa_st_mesa.mk
+++ b/src/mesa/Android.libmesa_st_mesa.mk
@@ -55,7 +55,6 @@ LOCAL_C_INCLUDES := \
        $(MESA_TOP)/src/mapi \
        $(MESA_TOP)/src/mesa/main \
        $(MESA_TOP)/src/glsl \
-       $(MESA_TOP)/src/glsl/nir \
        $(MESA_TOP)/src/gallium/auxiliary \
        $(MESA_TOP)/src/gallium/include
 
diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources
index 778b92d..2c79169 100644
--- a/src/mesa/Makefile.sources
+++ b/src/mesa/Makefile.sources
@@ -622,9 +622,7 @@ INCLUDE_DIRS = \
        -I$(top_srcdir)/include \
        -I$(top_srcdir)/src \
        -I$(top_srcdir)/src/glsl \
-       -I$(top_srcdir)/src/glsl/nir \
        -I$(top_builddir)/src/glsl \
-       -I$(top_builddir)/src/glsl/nir \
        -I$(top_srcdir)/src/glsl/glcpp \
        -I$(top_srcdir)/src/mesa \
        -I$(top_builddir)/src/mesa \
diff --git a/src/mesa/drivers/dri/i965/Makefile.am 
b/src/mesa/drivers/dri/i965/Makefile.am
index 9d003e4..5339331 100644
--- a/src/mesa/drivers/dri/i965/Makefile.am
+++ b/src/mesa/drivers/dri/i965/Makefile.am
@@ -33,8 +33,7 @@ AM_CFLAGS = \
        -I$(top_srcdir)/src/mesa/drivers/dri/common \
        -I$(top_srcdir)/src/mesa/drivers/dri/intel/server \
        -I$(top_srcdir)/src/gtest/include \
-       -I$(top_srcdir)/src/glsl/nir \
-       -I$(top_builddir)/src/glsl/nir \
+       -I$(top_builddir)/src/compiler/nir \
        -I$(top_builddir)/src/mesa/drivers/dri/common \
        $(DEFINES) \
        $(VISIBILITY_CFLAGS) \
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h 
b/src/mesa/drivers/dri/i965/brw_fs.h
index bca4589..c14ec3a 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -27,11 +27,11 @@
 
 #pragma once
 
+#include "compiler/nir/nir.h"
 #include "brw_shader.h"
 #include "brw_ir_fs.h"
 #include "brw_fs_builder.h"
 #include "glsl/ir.h"
-#include "glsl/nir/nir.h"
 
 struct bblock_t;
 namespace {
diff --git a/src/mesa/drivers/dri/i965/brw_nir.c 
b/src/mesa/drivers/dri/i965/brw_nir.c
index f04c9f7..ae4e7c7 100644
--- a/src/mesa/drivers/dri/i965/brw_nir.c
+++ b/src/mesa/drivers/dri/i965/brw_nir.c
@@ -21,9 +21,9 @@
  * IN THE SOFTWARE.
  */
 
+#include "compiler/nir/glsl_to_nir.h"
 #include "brw_nir.h"
 #include "brw_shader.h"
-#include "glsl/nir/glsl_to_nir.h"
 #include "program/prog_to_nir.h"
 
 static bool
diff --git a/src/mesa/drivers/dri/i965/brw_nir.h 
b/src/mesa/drivers/dri/i965/brw_nir.h
index 0a8a5a2..095461c 100644
--- a/src/mesa/drivers/dri/i965/brw_nir.h
+++ b/src/mesa/drivers/dri/i965/brw_nir.h
@@ -23,9 +23,9 @@
 
 #pragma once
 
+#include "compiler/nir/nir.h"
 #include "brw_context.h"
 #include "brw_reg.h"
-#include "glsl/nir/nir.h"
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h 
b/src/mesa/drivers/dri/i965/brw_vec4.h
index 25b1139..a006cbf 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -24,6 +24,8 @@
 #ifndef BRW_VEC4_H
 #define BRW_VEC4_H
 
+#include "compiler/nir/nir.h"
+
 #include "brw_shader.h"
 #include "brw_program.h"
 
@@ -32,7 +34,6 @@
 #endif
 
 #include "glsl/ir.h"
-#include "glsl/nir/nir.h"
 
 
 #ifdef __cplusplus
diff --git a/src/mesa/drivers/dri/i965/intel_asm_annotation.c 
b/src/mesa/drivers/dri/i965/intel_asm_annotation.c
index 59cc863..baf28c3 100644
--- a/src/mesa/drivers/dri/i965/intel_asm_annotation.c
+++ b/src/mesa/drivers/dri/i965/intel_asm_annotation.c
@@ -21,11 +21,11 @@
  * IN THE SOFTWARE.
  */
 
+#include "compiler/nir/nir.h"
 #include "brw_cfg.h"
 #include "brw_eu.h"
 #include "intel_debug.h"
 #include "intel_asm_annotation.h"
-#include "glsl/nir/nir.h"
 
 void
 dump_assembly(void *assembly, int num_annotations, struct annotation 
*annotation,
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c 
b/src/mesa/drivers/dri/i965/intel_screen.c
index cc90efe..a075b0a 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -36,7 +36,7 @@
 #include "swrast/s_renderbuffer.h"
 #include "util/ralloc.h"
 #include "brw_shader.h"
-#include "glsl/nir/nir.h"
+#include "compiler/nir/nir.h"
 
 #include "utils.h"
 #include "xmlpool.h"
diff --git a/src/mesa/program/Android.mk b/src/mesa/program/Android.mk
index cc67f8a..ccb0fa5 100644
--- a/src/mesa/program/Android.mk
+++ b/src/mesa/program/Android.mk
@@ -75,7 +75,6 @@ LOCAL_C_INCLUDES := \
        $(MESA_TOP)/src/mapi \
        $(MESA_TOP)/src/mesa \
        $(MESA_TOP)/src/glsl \
-       $(MESA_TOP)/src/glsl/nir \
        $(MESA_TOP)/src/gallium/auxiliary \
        $(MESA_TOP)/src/gallium/include
 
diff --git a/src/mesa/program/prog_to_nir.c b/src/mesa/program/prog_to_nir.c
index 539e3c0..6393277 100644
--- a/src/mesa/program/prog_to_nir.c
+++ b/src/mesa/program/prog_to_nir.c
@@ -23,8 +23,8 @@
  * IN THE SOFTWARE.
  */
 
-#include "nir/nir.h"
-#include "nir/nir_builder.h"
+#include "compiler/nir/nir.h"
+#include "compiler/nir/nir_builder.h"
 #include "glsl/list.h"
 #include "main/imports.h"
 #include "util/ralloc.h"
-- 
2.6.2

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to