Mesa (master): pan/bi: Separate disasm/compiler targets
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Aug 7 00:14:54 UTC 2020
Module: Mesa
Branch: master
Commit: 14bb72c68b44e98f4a38bf2b993bcc0d64fb3162
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=14bb72c68b44e98f4a38bf2b993bcc0d64fb3162
Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date: Wed Aug 5 17:25:27 2020 -0400
pan/bi: Separate disasm/compiler targets
Likewise.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6196>
---
src/panfrost/bifrost/bi_print.c | 98 +-------------------------
src/panfrost/bifrost/bi_print_common.c | 123 +++++++++++++++++++++++++++++++++
src/panfrost/bifrost/bi_print_common.h | 41 +++++++++++
src/panfrost/bifrost/disassemble.c | 2 +-
src/panfrost/bifrost/meson.build | 14 +++-
5 files changed, 178 insertions(+), 100 deletions(-)
diff --git a/src/panfrost/bifrost/bi_print.c b/src/panfrost/bifrost/bi_print.c
index 6dcfdbd3e78..7b231c39b65 100644
--- a/src/panfrost/bifrost/bi_print.c
+++ b/src/panfrost/bifrost/bi_print.c
@@ -25,103 +25,7 @@
*/
#include "bi_print.h"
-
-const char *
-bi_clause_type_name(enum bifrost_clause_type T)
-{
- switch (T) {
- case BIFROST_CLAUSE_NONE: return "";
- case BIFROST_CLAUSE_LOAD_VARY: return "load_vary";
- case BIFROST_CLAUSE_UBO: return "ubo";
- case BIFROST_CLAUSE_TEX: return "tex";
- case BIFROST_CLAUSE_SSBO_LOAD: return "load";
- case BIFROST_CLAUSE_SSBO_STORE: return "store";
- case BIFROST_CLAUSE_BLEND: return "blend";
- case BIFROST_CLAUSE_FRAGZ: return "fragz";
- case BIFROST_CLAUSE_ATEST: return "atest";
- case BIFROST_CLAUSE_64BIT: return "64";
- default: return "??";
- }
-}
-
-const char *
-bi_output_mod_name(enum bifrost_outmod mod)
-{
- switch (mod) {
- case BIFROST_NONE: return "";
- case BIFROST_POS: return ".pos";
- case BIFROST_SAT_SIGNED: return ".sat_signed";
- case BIFROST_SAT: return ".sat";
- default: return "invalid";
- }
-}
-
-const char *
-bi_minmax_mode_name(enum bifrost_minmax_mode mod)
-{
- switch (mod) {
- case BIFROST_MINMAX_NONE: return "";
- case BIFROST_NAN_WINS: return ".nan_wins";
- case BIFROST_SRC1_WINS: return ".src1_wins";
- case BIFROST_SRC0_WINS: return ".src0_wins";
- default: return "invalid";
- }
-}
-
-const char *
-bi_round_mode_name(enum bifrost_roundmode mod)
-{
- switch (mod) {
- case BIFROST_RTE: return "";
- case BIFROST_RTP: return ".rtp";
- case BIFROST_RTN: return ".rtn";
- case BIFROST_RTZ: return ".rtz";
- default: return "invalid";
- }
-}
-
-const char *
-bi_csel_cond_name(enum bifrost_csel_cond cond)
-{
- switch (cond) {
- case BIFROST_FEQ_F: return "feq.f";
- case BIFROST_FGT_F: return "fgt.f";
- case BIFROST_FGE_F: return "fge.f";
- case BIFROST_IEQ_F: return "ieq.f";
- case BIFROST_IGT_I: return "igt.i";
- case BIFROST_IGE_I: return "uge.i";
- case BIFROST_UGT_I: return "ugt.i";
- case BIFROST_UGE_I: return "uge.i";
- default: return "invalid";
- }
-}
-
-const char *
-bi_interp_mode_name(enum bifrost_interp_mode mode)
-{
- switch (mode) {
- case BIFROST_INTERP_PER_FRAG: return ".per_frag";
- case BIFROST_INTERP_CENTROID: return ".centroid";
- case BIFROST_INTERP_DEFAULT: return "";
- case BIFROST_INTERP_EXPLICIT: return ".explicit";
- default: return ".unknown";
- }
-}
-
-const char *
-bi_ldst_type_name(enum bifrost_ldst_type type)
-{
- switch (type) {
- case BIFROST_LDST_F16: return "f16";
- case BIFROST_LDST_F32: return "f32";
- case BIFROST_LDST_I32: return "i32";
- case BIFROST_LDST_U32: return "u32";
- default: return "invalid";
- }
-}
-
-/* The remaining functions in this file are for IR-internal
- * structures; the disassembler doesn't use them */
+#include "bi_print_common.h"
const char *
bi_class_name(enum bi_class cl)
diff --git a/src/panfrost/bifrost/bi_print_common.c b/src/panfrost/bifrost/bi_print_common.c
new file mode 100644
index 00000000000..04f3c9f359e
--- /dev/null
+++ b/src/panfrost/bifrost/bi_print_common.c
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2019 Connor Abbott <cwabbott0 at gmail.com>
+ * Copyright (C) 2019 Lyude Paul <thatslyude at gmail.com>
+ * Copyright (C) 2019 Ryan Houdek <Sonicadvance1 at gmail.com>
+ * Copyright (C) 2019-2020 Collabora, Ltd.
+ *
+ * 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.
+ */
+
+/* Prints shared with the disassembler */
+
+#include "bi_print_common.h"
+
+const char *
+bi_clause_type_name(enum bifrost_clause_type T)
+{
+ switch (T) {
+ case BIFROST_CLAUSE_NONE: return "";
+ case BIFROST_CLAUSE_LOAD_VARY: return "load_vary";
+ case BIFROST_CLAUSE_UBO: return "ubo";
+ case BIFROST_CLAUSE_TEX: return "tex";
+ case BIFROST_CLAUSE_SSBO_LOAD: return "load";
+ case BIFROST_CLAUSE_SSBO_STORE: return "store";
+ case BIFROST_CLAUSE_BLEND: return "blend";
+ case BIFROST_CLAUSE_FRAGZ: return "fragz";
+ case BIFROST_CLAUSE_ATEST: return "atest";
+ case BIFROST_CLAUSE_64BIT: return "64";
+ default: return "??";
+ }
+}
+
+const char *
+bi_output_mod_name(enum bifrost_outmod mod)
+{
+ switch (mod) {
+ case BIFROST_NONE: return "";
+ case BIFROST_POS: return ".pos";
+ case BIFROST_SAT_SIGNED: return ".sat_signed";
+ case BIFROST_SAT: return ".sat";
+ default: return "invalid";
+ }
+}
+
+const char *
+bi_minmax_mode_name(enum bifrost_minmax_mode mod)
+{
+ switch (mod) {
+ case BIFROST_MINMAX_NONE: return "";
+ case BIFROST_NAN_WINS: return ".nan_wins";
+ case BIFROST_SRC1_WINS: return ".src1_wins";
+ case BIFROST_SRC0_WINS: return ".src0_wins";
+ default: return "invalid";
+ }
+}
+
+const char *
+bi_round_mode_name(enum bifrost_roundmode mod)
+{
+ switch (mod) {
+ case BIFROST_RTE: return "";
+ case BIFROST_RTP: return ".rtp";
+ case BIFROST_RTN: return ".rtn";
+ case BIFROST_RTZ: return ".rtz";
+ default: return "invalid";
+ }
+}
+
+const char *
+bi_csel_cond_name(enum bifrost_csel_cond cond)
+{
+ switch (cond) {
+ case BIFROST_FEQ_F: return "feq.f";
+ case BIFROST_FGT_F: return "fgt.f";
+ case BIFROST_FGE_F: return "fge.f";
+ case BIFROST_IEQ_F: return "ieq.f";
+ case BIFROST_IGT_I: return "igt.i";
+ case BIFROST_IGE_I: return "uge.i";
+ case BIFROST_UGT_I: return "ugt.i";
+ case BIFROST_UGE_I: return "uge.i";
+ default: return "invalid";
+ }
+}
+
+const char *
+bi_interp_mode_name(enum bifrost_interp_mode mode)
+{
+ switch (mode) {
+ case BIFROST_INTERP_PER_FRAG: return ".per_frag";
+ case BIFROST_INTERP_CENTROID: return ".centroid";
+ case BIFROST_INTERP_DEFAULT: return "";
+ case BIFROST_INTERP_EXPLICIT: return ".explicit";
+ default: return ".unknown";
+ }
+}
+
+const char *
+bi_ldst_type_name(enum bifrost_ldst_type type)
+{
+ switch (type) {
+ case BIFROST_LDST_F16: return "f16";
+ case BIFROST_LDST_F32: return "f32";
+ case BIFROST_LDST_I32: return "i32";
+ case BIFROST_LDST_U32: return "u32";
+ default: return "invalid";
+ }
+}
diff --git a/src/panfrost/bifrost/bi_print_common.h b/src/panfrost/bifrost/bi_print_common.h
new file mode 100644
index 00000000000..a3150c51e55
--- /dev/null
+++ b/src/panfrost/bifrost/bi_print_common.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2019 Connor Abbott <cwabbott0 at gmail.com>
+ * Copyright (C) 2019 Lyude Paul <thatslyude at gmail.com>
+ * Copyright (C) 2019 Ryan Houdek <Sonicadvance1 at gmail.com>
+ * Copyright (C) 2020 Collabora Ltd.
+ *
+ * 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 __BI_PRINT_COMMON_H
+#define __BI_PRINT_COMMON_H
+
+#include <stdio.h>
+#include "bifrost.h"
+
+const char * bi_clause_type_name(enum bifrost_clause_type T);
+const char * bi_output_mod_name(enum bifrost_outmod mod);
+const char * bi_minmax_mode_name(enum bifrost_minmax_mode mod);
+const char * bi_round_mode_name(enum bifrost_roundmode mod);
+const char * bi_csel_cond_name(enum bifrost_csel_cond cond);
+const char * bi_interp_mode_name(enum bifrost_interp_mode mode);
+const char * bi_ldst_type_name(enum bifrost_ldst_type type);
+
+#endif
diff --git a/src/panfrost/bifrost/disassemble.c b/src/panfrost/bifrost/disassemble.c
index 93afbee3896..7169df85108 100644
--- a/src/panfrost/bifrost/disassemble.c
+++ b/src/panfrost/bifrost/disassemble.c
@@ -32,7 +32,7 @@
#include "bifrost.h"
#include "disassemble.h"
-#include "bi_print.h"
+#include "bi_print_common.h"
#include "util/macros.h"
// return bits (high, lo]
diff --git a/src/panfrost/bifrost/meson.build b/src/panfrost/bifrost/meson.build
index 83389466be5..013989ed148 100644
--- a/src/panfrost/bifrost/meson.build
+++ b/src/panfrost/bifrost/meson.build
@@ -20,7 +20,6 @@
# SOFTWARE.
libpanfrost_bifrost_files = files(
- 'disassemble.c',
'bi_layout.c',
'bi_liveness.c',
'bi_lower_combine.c',
@@ -47,12 +46,23 @@ bifrost_nir_algebraic_c = custom_target(
depend_files : nir_algebraic_py,
)
+libpanfrost_bifrost_disasm = static_library(
+ 'panfrost_bifrost_disasm',
+ ['disassemble.c', 'bi_print_common.c'],
+ include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_panfrost_hw],
+ dependencies: [idep_nir],
+ link_with: [libpanfrost_util],
+ c_args : [no_override_init_args],
+ gnu_symbol_visibility : 'hidden',
+ build_by_default : false,
+)
+
libpanfrost_bifrost = static_library(
'panfrost_bifrost',
[libpanfrost_bifrost_files, bifrost_nir_algebraic_c],
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_panfrost_hw],
dependencies: [idep_nir],
- link_with: [libpanfrost_util],
+ link_with: [libpanfrost_util, libpanfrost_bifrost_disasm],
c_args : [no_override_init_args],
gnu_symbol_visibility : 'hidden',
build_by_default : false,
More information about the mesa-commit
mailing list