From c05483fc00a0630aba86ad9de68d949bbb68f8c9 Mon Sep 17 00:00:00 2001 From: Christian König Date: Thu, 7 Mar 2013 11:01:07 +0100 Subject: radeon/llvm: rework input fetch and output store MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cleanup the code and implement indirect addressing. Signed-off-by: Christian König Reviewed-by: Tom Stellard --- src/gallium/drivers/radeon/radeon_llvm.h | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'src/gallium/drivers/radeon/radeon_llvm.h') diff --git a/src/gallium/drivers/radeon/radeon_llvm.h b/src/gallium/drivers/radeon/radeon_llvm.h index 4c01d682254..1d4bd456670 100644 --- a/src/gallium/drivers/radeon/radeon_llvm.h +++ b/src/gallium/drivers/radeon/radeon_llvm.h @@ -35,6 +35,7 @@ #define RADEON_LLVM_MAX_OUTPUTS 32 * 4 #define RADEON_LLVM_MAX_BRANCH_DEPTH 16 #define RADEON_LLVM_MAX_LOOP_DEPTH 16 +#define RADEON_LLVM_MAX_ARRAYS 16 #define RADEON_LLVM_MAX_SYSTEM_VALUES 4 @@ -117,35 +118,40 @@ struct radeon_llvm_context { unsigned branch_depth; unsigned loop_depth; + struct tgsi_declaration_range arrays[RADEON_LLVM_MAX_ARRAYS]; + unsigned num_arrays; LLVMValueRef main_fn; struct gallivm_state gallivm; }; -static inline LLVMValueRef bitcast( +static inline LLVMTypeRef tgsi2llvmtype( struct lp_build_tgsi_context * bld_base, - enum tgsi_opcode_type type, - LLVMValueRef value -) + enum tgsi_opcode_type type) { - LLVMBuilderRef builder = bld_base->base.gallivm->builder; LLVMContextRef ctx = bld_base->base.gallivm->context; - LLVMTypeRef dst_type; switch (type) { case TGSI_TYPE_UNSIGNED: case TGSI_TYPE_SIGNED: - dst_type = LLVMInt32TypeInContext(ctx); - break; + return LLVMInt32TypeInContext(ctx); case TGSI_TYPE_UNTYPED: case TGSI_TYPE_FLOAT: - dst_type = LLVMFloatTypeInContext(ctx); - break; - default: - dst_type = 0; - break; + return LLVMFloatTypeInContext(ctx); + default: break; } + return 0; +} + +static inline LLVMValueRef bitcast( + struct lp_build_tgsi_context * bld_base, + enum tgsi_opcode_type type, + LLVMValueRef value +) +{ + LLVMBuilderRef builder = bld_base->base.gallivm->builder; + LLVMTypeRef dst_type = tgsi2llvmtype(bld_base, type); if (dst_type) return LLVMBuildBitCast(builder, value, dst_type, ""); -- cgit v1.2.3