#define LP_BLD_TYPE_H
-#include <llvm-c/Core.h>
+#include "pipe/p_compiler.h"
+#include "gallivm/lp_bld.h"
-#include <pipe/p_compiler.h>
/**
unsigned width:14;
/**
- * Vector length.
+ * Vector length. If length==1, this is a scalar (float/int) type.
*
* width*length should be a power of two greater or equal to eight.
*
*/
struct lp_type type;
+ /** Same as lp_build_undef(type) */
+ LLVMTypeRef elem_type;
+
+ /** Same as lp_build_undef(type) */
+ LLVMTypeRef vec_type;
+
+ /** Same as lp_build_undef(type) */
+ LLVMTypeRef int_elem_type;
+
+ /** Same as lp_build_undef(type) */
+ LLVMTypeRef int_vec_type;
+
/** Same as lp_build_undef(type) */
LLVMValueRef undef;
};
+/** Create scalar float type */
static INLINE struct lp_type
lp_type_float(unsigned width)
{
struct lp_type res_type;
+ memset(&res_type, 0, sizeof res_type);
+ res_type.floating = TRUE;
+ res_type.sign = TRUE;
+ res_type.width = width;
+ res_type.length = 1;
+
+ return res_type;
+}
+
+
+/** Create vector of float type */
+static INLINE struct lp_type
+lp_type_float_vec(unsigned width)
+{
+ struct lp_type res_type;
+
memset(&res_type, 0, sizeof res_type);
res_type.floating = TRUE;
res_type.sign = TRUE;
}
+/** Create scalar int type */
static INLINE struct lp_type
lp_type_int(unsigned width)
{
struct lp_type res_type;
+ memset(&res_type, 0, sizeof res_type);
+ res_type.sign = TRUE;
+ res_type.width = width;
+ res_type.length = 1;
+
+ return res_type;
+}
+
+
+/** Create vector int type */
+static INLINE struct lp_type
+lp_type_int_vec(unsigned width)
+{
+ struct lp_type res_type;
+
memset(&res_type, 0, sizeof res_type);
res_type.sign = TRUE;
res_type.width = width;
}
+/** Create scalar uint type */
static INLINE struct lp_type
lp_type_uint(unsigned width)
{
struct lp_type res_type;
+ memset(&res_type, 0, sizeof res_type);
+ res_type.width = width;
+ res_type.length = 1;
+
+ return res_type;
+}
+
+
+/** Create vector uint type */
+static INLINE struct lp_type
+lp_type_uint_vec(unsigned width)
+{
+ struct lp_type res_type;
+
memset(&res_type, 0, sizeof res_type);
res_type.width = width;
res_type.length = LP_NATIVE_VECTOR_WIDTH / width;
lp_wider_type(struct lp_type type);
+unsigned
+lp_sizeof_llvm_type(LLVMTypeRef t);
+
+
+const char *
+lp_typekind_name(LLVMTypeKind t);
+
+
+void
+lp_dump_llvmtype(LLVMTypeRef t);
+
+
void
lp_build_context_init(struct lp_build_context *bld,
LLVMBuilderRef builder,