radeonsi/gfx10: fix the vertex order for triangle strips emitted by a GS
[mesa.git] / src / gallium / auxiliary / gallivm / lp_bld_flow.h
index e729ee6eaac5b1733e59e6461b974cf0885f843b..ddb3fdfd7b754031a20299508307096574933dcd 100644 (file)
@@ -37,6 +37,9 @@
 
 #include "gallivm/lp_bld.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 struct lp_type;
 
@@ -47,7 +50,7 @@ struct lp_type;
  */
 struct lp_build_skip_context
 {
-   LLVMBuilderRef builder;
+   struct gallivm_state *gallivm;
 
    /** Block to skip to */
    LLVMBasicBlockRef block;
@@ -55,7 +58,7 @@ struct lp_build_skip_context
 
 void
 lp_build_flow_skip_begin(struct lp_build_skip_context *ctx,
-                         LLVMBuilderRef builder);
+                         struct gallivm_state *gallivm);
 
 void
 lp_build_flow_skip_cond_break(struct lp_build_skip_context *ctx,
@@ -77,7 +80,7 @@ struct lp_build_mask_context
 
 void
 lp_build_mask_begin(struct lp_build_mask_context *mask,
-                    LLVMBuilderRef builder,
+                    struct gallivm_state *gallivm,
                     struct lp_type type,
                     LLVMValueRef value);
 
@@ -107,32 +110,62 @@ lp_build_mask_end(struct lp_build_mask_context *mask);
  */
 struct lp_build_loop_state
 {
-  LLVMBasicBlockRef block;
-  LLVMValueRef counter_var;
-  LLVMValueRef counter;
+   LLVMBasicBlockRef block;
+   LLVMValueRef counter_var;
+   LLVMValueRef counter;
+   struct gallivm_state *gallivm;
 };
 
 
 void
-lp_build_loop_begin(LLVMBuilderRef builder,
-                    LLVMValueRef start,
-                    struct lp_build_loop_state *state);
-
+lp_build_loop_begin(struct lp_build_loop_state *state,
+                    struct gallivm_state *gallivm,
+                    LLVMValueRef start);
 
 void
-lp_build_loop_end(LLVMBuilderRef builder,
+lp_build_loop_end(struct lp_build_loop_state *state,
                   LLVMValueRef end,
-                  LLVMValueRef step,
-                  struct lp_build_loop_state *state);
+                  LLVMValueRef step);
 
 void
-lp_build_loop_end_cond(LLVMBuilderRef builder,
+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,
                        LLVMValueRef step,
-                       LLVMIntPredicate cond,
-                       struct lp_build_loop_state *state);
+                       LLVMIntPredicate cond);
+
+
+/**
+ * Implementation of simple C-style for loops
+ */
+struct lp_build_for_loop_state
+{
+   LLVMBasicBlockRef begin;
+   LLVMBasicBlockRef body;
+   LLVMBasicBlockRef exit;
+   LLVMValueRef counter_var;
+   LLVMValueRef counter;
+   LLVMValueRef step;
+   LLVMIntPredicate cond;
+   LLVMValueRef end;
+   struct gallivm_state *gallivm;
+};
 
+void
+lp_build_for_loop_begin(struct lp_build_for_loop_state *state,
+                        struct gallivm_state *gallivm,
+                        LLVMValueRef start,
+                        LLVMIntPredicate llvm_cond,
+                        LLVMValueRef end,
+                        LLVMValueRef step);
 
+void
+lp_build_for_loop_end(struct lp_build_for_loop_state *state);
 
 
 /**
@@ -140,7 +173,7 @@ lp_build_loop_end_cond(LLVMBuilderRef builder,
  */
 struct lp_build_if_state
 {
-   LLVMBuilderRef builder;
+   struct gallivm_state *gallivm;
    LLVMValueRef condition;
    LLVMBasicBlockRef entry_block;
    LLVMBasicBlockRef true_block;
@@ -151,7 +184,7 @@ struct lp_build_if_state
 
 void
 lp_build_if(struct lp_build_if_state *ctx,
-            LLVMBuilderRef builder,
+            struct gallivm_state *gallivm,
             LLVMValueRef condition);
 
 void
@@ -161,17 +194,26 @@ void
 lp_build_endif(struct lp_build_if_state *ctx);
 
 LLVMBasicBlockRef
-lp_build_insert_new_block(LLVMBuilderRef builder, const char *name);
+lp_build_insert_new_block(struct gallivm_state *gallivm, const char *name);
 
 LLVMValueRef
-lp_build_alloca(LLVMBuilderRef builder,
+lp_build_alloca(struct gallivm_state *gallivm,
                 LLVMTypeRef type,
                 const char *name);
 
 LLVMValueRef
-lp_build_array_alloca(LLVMBuilderRef builder,
+lp_build_alloca_undef(struct gallivm_state *gallivm,
+                      LLVMTypeRef type,
+                      const char *name);
+
+LLVMValueRef
+lp_build_array_alloca(struct gallivm_state *gallivm,
                       LLVMTypeRef type,
                       LLVMValueRef count,
                       const char *name);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* !LP_BLD_FLOW_H */