gallivm/flow: add counter reset for loops
authorDave Airlie <airlied@redhat.com>
Tue, 25 Jun 2019 21:35:36 +0000 (07:35 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 4 Sep 2019 05:22:20 +0000 (15:22 +1000)
This allows the counter value to be forced to a certain value

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
src/gallium/auxiliary/gallivm/lp_bld_flow.c
src/gallium/auxiliary/gallivm/lp_bld_flow.h

index c522bc4f4ab30aeb6647434bb55daffda2cfc1ae..3bd24b4ba875b3d6a6df7b966e1122316a6fd4c2 100644 (file)
@@ -265,6 +265,20 @@ lp_build_loop_end_cond(struct lp_build_loop_state *state,
    state->counter = LLVMBuildLoad(builder, state->counter_var, "");
 }
 
+void
+lp_build_loop_force_set_counter(struct lp_build_loop_state *state,
+                          LLVMValueRef end)
+{
+   LLVMBuilderRef builder = state->gallivm->builder;
+   LLVMBuildStore(builder, end, state->counter_var);
+}
+
+void
+lp_build_loop_force_reload_counter(struct lp_build_loop_state *state)
+{
+   LLVMBuilderRef builder = state->gallivm->builder;
+   state->counter = LLVMBuildLoad(builder, state->counter_var, "");
+}
 
 void
 lp_build_loop_end(struct lp_build_loop_state *state,
index 674fc189f1a0e564c13816ab389fbd1e7f6bcb59..ddb3fdfd7b754031a20299508307096574933dcd 100644 (file)
@@ -127,6 +127,12 @@ lp_build_loop_end(struct lp_build_loop_state *state,
                   LLVMValueRef end,
                   LLVMValueRef step);
 
+void
+lp_build_loop_force_set_counter(struct lp_build_loop_state *state,
+                                LLVMValueRef end);
+
+void
+lp_build_loop_force_reload_counter(struct lp_build_loop_state *state);
 void
 lp_build_loop_end_cond(struct lp_build_loop_state *state,
                        LLVMValueRef end,