amd/common: move ac_build_phi from radeonsi
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Fri, 29 Sep 2017 09:17:03 +0000 (11:17 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Mon, 2 Oct 2017 10:17:15 +0000 (12:17 +0200)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/amd/common/ac_llvm_build.c
src/amd/common/ac_llvm_build.h
src/gallium/drivers/radeonsi/si_shader.c

index 71468df2dbc154463538457e9d03e7bb95b44e72..51fb009be8be8aa78975b2d671bb909ee236200b 100644 (file)
@@ -252,6 +252,20 @@ void ac_build_type_name_for_intr(LLVMTypeRef type, char *buf, unsigned bufsize)
        }
 }
 
+/**
+ * Helper function that builds an LLVM IR PHI node and immediately adds
+ * incoming edges.
+ */
+LLVMValueRef
+ac_build_phi(struct ac_llvm_context *ctx, LLVMTypeRef type,
+            unsigned count_incoming, LLVMValueRef *values,
+            LLVMBasicBlockRef *blocks)
+{
+       LLVMValueRef phi = LLVMBuildPhi(ctx->builder, type, "");
+       LLVMAddIncoming(phi, values, blocks, count_incoming);
+       return phi;
+}
+
 /* Prevent optimizations (at least of memory accesses) across the current
  * point in the program by emitting empty inline assembly that is marked as
  * having side effects.
index 3f93551330c464b2b9fad77c1c9a29039ff73097..1d6dc0ab2f5512531881c2f2a9451a6a4114ba60 100644 (file)
@@ -85,6 +85,11 @@ ac_build_intrinsic(struct ac_llvm_context *ctx, const char *name,
 
 void ac_build_type_name_for_intr(LLVMTypeRef type, char *buf, unsigned bufsize);
 
+LLVMValueRef
+ac_build_phi(struct ac_llvm_context *ctx, LLVMTypeRef type,
+            unsigned count_incoming, LLVMValueRef *values,
+            LLVMBasicBlockRef *blocks);
+
 void ac_build_optimization_barrier(struct ac_llvm_context *ctx,
                                   LLVMValueRef *pvgpr);
 
index d012c19a58ac1b58889f0a0fed82c7b8db0878d2..c11a4ebeade2df5da79c2a7577ae3da6c58ab678 100644 (file)
@@ -233,20 +233,6 @@ unsigned si_shader_io_get_unique_index(unsigned semantic_name, unsigned index)
        }
 }
 
-/**
- * Helper function that builds an LLVM IR PHI node and immediately adds
- * incoming edges.
- */
-static LLVMValueRef
-build_phi(struct ac_llvm_context *ctx, LLVMTypeRef type,
-         unsigned count_incoming, LLVMValueRef *values,
-         LLVMBasicBlockRef *blocks)
-{
-       LLVMValueRef phi = LLVMBuildPhi(ctx->builder, type, "");
-       LLVMAddIncoming(phi, values, blocks, count_incoming);
-       return phi;
-}
-
 /**
  * Get the value of a shader input parameter and extract a bitfield.
  */
@@ -2922,15 +2908,15 @@ static void si_llvm_emit_tcs_epilogue(struct lp_build_tgsi_context *bld_base)
 
                values[0] = rel_patch_id;
                values[1] = LLVMGetUndef(ctx->i32);
-               rel_patch_id = build_phi(&ctx->ac, ctx->i32, 2, values, blocks);
+               rel_patch_id = ac_build_phi(&ctx->ac, ctx->i32, 2, values, blocks);
 
                values[0] = tf_lds_offset;
                values[1] = LLVMGetUndef(ctx->i32);
-               tf_lds_offset = build_phi(&ctx->ac, ctx->i32, 2, values, blocks);
+               tf_lds_offset = ac_build_phi(&ctx->ac, ctx->i32, 2, values, blocks);
 
                values[0] = invocation_id;
                values[1] = ctx->i32_1; /* cause the epilog to skip threads */
-               invocation_id = build_phi(&ctx->ac, ctx->i32, 2, values, blocks);
+               invocation_id = ac_build_phi(&ctx->ac, ctx->i32, 2, values, blocks);
        }
 
        /* Return epilog parameters from this function. */