gallivm: added aligned pointer get/set
[mesa.git] / src / gallium / auxiliary / gallivm / lp_bld_struct.h
index 147336edb4b3c60c18cd0771c5ef7df25fb2648c..6b7b4f2a6bf7d6949b0f001da9412fec27025ed0 100644 (file)
@@ -38,7 +38,7 @@
 
 
 #include "gallivm/lp_bld.h"
-#include <llvm-c/Target.h>
+#include "gallivm/lp_bld_init.h"
 
 #include "util/u_debug.h"
 #include "util/u_memory.h"
@@ -57,7 +57,7 @@
  * Get value pointer to a structure member.
  */
 LLVMValueRef
-lp_build_struct_get_ptr(LLVMBuilderRef builder,
+lp_build_struct_get_ptr(struct gallivm_state *gallivm,
                         LLVMValueRef ptr,
                         unsigned member,
                         const char *name);
@@ -66,10 +66,76 @@ lp_build_struct_get_ptr(LLVMBuilderRef builder,
  * Get the value of a structure member.
  */
 LLVMValueRef
-lp_build_struct_get(LLVMBuilderRef builder,
+lp_build_struct_get(struct gallivm_state *gallivm,
                     LLVMValueRef ptr,
                     unsigned member,
                     const char *name);
 
+/**
+ * Get value pointer to an array element.
+ */
+LLVMValueRef
+lp_build_array_get_ptr(struct gallivm_state *gallivm,
+                       LLVMValueRef ptr,
+                       LLVMValueRef index);
+
+/**
+ * Get the value of an array element.
+ */
+LLVMValueRef
+lp_build_array_get(struct gallivm_state *gallivm,
+                   LLVMValueRef ptr,
+                   LLVMValueRef index);
+
+/**
+ * Set the value of an array element.
+ */
+void
+lp_build_array_set(struct gallivm_state *gallivm,
+                   LLVMValueRef ptr,
+                   LLVMValueRef index,
+                   LLVMValueRef value);
+
+/**
+ * Get the value of an array element.
+ */
+LLVMValueRef
+lp_build_pointer_get(LLVMBuilderRef builder,
+                   LLVMValueRef ptr,
+                   LLVMValueRef index);
+
+/**
+ * Get the value of an array element, with explicit alignment.
+ *
+ * If the element size is different from the alignment this will
+ * cause llvm to emit an unaligned load
+ */
+LLVMValueRef
+lp_build_pointer_get_unaligned(LLVMBuilderRef builder,
+                               LLVMValueRef ptr,
+                               LLVMValueRef index,
+                               unsigned alignment);
+
+/**
+ * Set the value of an array element.
+ */
+void
+lp_build_pointer_set(LLVMBuilderRef builder,
+                     LLVMValueRef ptr,
+                     LLVMValueRef index,
+                     LLVMValueRef value);
+
+/**
+ * Set the value of an array element, with explicit alignment.
+ *
+ * If the element size is different from the alignment this will
+ * cause llvm to emit an unaligned store
+ */
+void
+lp_build_pointer_set_unaligned(LLVMBuilderRef builder,
+                               LLVMValueRef ptr,
+                               LLVMValueRef index,
+                               LLVMValueRef value,
+                               unsigned alignment);
 
 #endif /* !LP_BLD_STRUCT_H */