summaryrefslogtreecommitdiffstats
path: root/src/glsl/nir/nir_print.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2014-12-15 17:32:56 -0800
committerJason Ekstrand <[email protected]>2015-01-15 07:20:22 -0800
commit2c7da78805175f36879111306ac37c12d33bf65b (patch)
tree5fbfa3578dae242c5fa29cf46c647af351fda881 /src/glsl/nir/nir_print.c
parent675ffdef3010400567a5f6f790f1f7bd2fede717 (diff)
nir: Make load_const SSA-only
As it was, we weren't ever using load_const in a non-SSA way. This allows us to substantially simplify the load_const instruction. If we ever need a non-SSA constant load, we can do a load_const and an imov. Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/glsl/nir/nir_print.c')
-rw-r--r--src/glsl/nir/nir_print.c32
1 files changed, 6 insertions, 26 deletions
diff --git a/src/glsl/nir/nir_print.c b/src/glsl/nir/nir_print.c
index 7d60eb11ee8..d7fc4b8722e 100644
--- a/src/glsl/nir/nir_print.c
+++ b/src/glsl/nir/nir_print.c
@@ -505,12 +505,14 @@ print_call_instr(nir_call_instr *instr, print_var_state *state, FILE *fp)
}
static void
-print_const_value(nir_const_value value, unsigned num_components, FILE *fp)
+print_load_const_instr(nir_load_const_instr *instr, unsigned tabs, FILE *fp)
{
- fprintf(fp, "(");
+ print_ssa_def(&instr->def, fp);
+
+ fprintf(fp, " = load_const (");
bool first = true;
- for (unsigned i = 0; i < num_components; i++) {
+ for (unsigned i = 0; i < instr->def.num_components; i++) {
if (!first)
fprintf(fp, ", ");
@@ -520,32 +522,10 @@ print_const_value(nir_const_value value, unsigned num_components, FILE *fp)
* and then print the float in a comment for readability.
*/
- fprintf(fp, "0x%08x /* %f */", value.u[i], value.f[i]);
+ fprintf(fp, "0x%08x /* %f */", instr->value.u[i], instr->value.f[i]);
first = false;
}
-
- fprintf(fp, ")");
-}
-
-static void
-print_load_const_instr(nir_load_const_instr *instr, unsigned tabs, FILE *fp)
-{
- print_dest(&instr->dest, fp);
-
- fprintf(fp, " = load_const ");
-
- if (instr->array_elems == 0) {
- print_const_value(instr->value, instr->num_components, fp);
- } else {
- fprintf(fp, "{\n");
- for (unsigned i = 0; i < instr->array_elems; i++) {
- print_tabs(tabs + 1, fp);
- print_const_value(instr->array[i], instr->num_components, fp);
- fprintf(fp, ", \n");
- }
- fprintf(fp, "}");
- }
}
static void