[Mesa-dev] [PATCH 05/25] amd/common: add ac_build_ifcc

Nicolai Hähnle nhaehnle at gmail.com
Thu Dec 6 14:00:26 UTC 2018


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

---
 src/amd/common/ac_llvm_build.c | 7 +++----
 src/amd/common/ac_llvm_build.h | 1 +
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
index fba90205a2e..68c8bad9e83 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -2861,48 +2861,47 @@ void ac_build_endloop(struct ac_llvm_context *ctx, int label_id)
 
 	assert(current_loop->loop_entry_block);
 
 	emit_default_branch(ctx->builder, current_loop->loop_entry_block);
 
 	LLVMPositionBuilderAtEnd(ctx->builder, current_loop->next_block);
 	set_basicblock_name(current_loop->next_block, "endloop", label_id);
 	ctx->flow_depth--;
 }
 
-static void if_cond_emit(struct ac_llvm_context *ctx, LLVMValueRef cond,
-			 int label_id)
+void ac_build_ifcc(struct ac_llvm_context *ctx, LLVMValueRef cond, int label_id)
 {
 	struct ac_llvm_flow *flow = push_flow(ctx);
 	LLVMBasicBlockRef if_block;
 
 	if_block = append_basic_block(ctx, "IF");
 	flow->next_block = append_basic_block(ctx, "ELSE");
 	set_basicblock_name(if_block, "if", label_id);
 	LLVMBuildCondBr(ctx->builder, cond, if_block, flow->next_block);
 	LLVMPositionBuilderAtEnd(ctx->builder, if_block);
 }
 
 void ac_build_if(struct ac_llvm_context *ctx, LLVMValueRef value,
 		 int label_id)
 {
 	LLVMValueRef cond = LLVMBuildFCmp(ctx->builder, LLVMRealUNE,
 					  value, ctx->f32_0, "");
-	if_cond_emit(ctx, cond, label_id);
+	ac_build_ifcc(ctx, cond, label_id);
 }
 
 void ac_build_uif(struct ac_llvm_context *ctx, LLVMValueRef value,
 		  int label_id)
 {
 	LLVMValueRef cond = LLVMBuildICmp(ctx->builder, LLVMIntNE,
 					  ac_to_integer(ctx, value),
 					  ctx->i32_0, "");
-	if_cond_emit(ctx, cond, label_id);
+	ac_build_ifcc(ctx, cond, label_id);
 }
 
 LLVMValueRef ac_build_alloca_undef(struct ac_llvm_context *ac, LLVMTypeRef type,
 			     const char *name)
 {
 	LLVMBuilderRef builder = ac->builder;
 	LLVMBasicBlockRef current_block = LLVMGetInsertBlock(builder);
 	LLVMValueRef function = LLVMGetBasicBlockParent(current_block);
 	LLVMBasicBlockRef first_block = LLVMGetEntryBasicBlock(function);
 	LLVMValueRef first_instr = LLVMGetFirstInstruction(first_block);
diff --git a/src/amd/common/ac_llvm_build.h b/src/amd/common/ac_llvm_build.h
index e90c8c21ad4..cf3e3cedf65 100644
--- a/src/amd/common/ac_llvm_build.h
+++ b/src/amd/common/ac_llvm_build.h
@@ -475,20 +475,21 @@ LLVMValueRef ac_find_lsb(struct ac_llvm_context *ctx,
 
 LLVMTypeRef ac_array_in_const_addr_space(LLVMTypeRef elem_type);
 LLVMTypeRef ac_array_in_const32_addr_space(LLVMTypeRef elem_type);
 
 void ac_build_bgnloop(struct ac_llvm_context *ctx, int lable_id);
 void ac_build_break(struct ac_llvm_context *ctx);
 void ac_build_continue(struct ac_llvm_context *ctx);
 void ac_build_else(struct ac_llvm_context *ctx, int lable_id);
 void ac_build_endif(struct ac_llvm_context *ctx, int lable_id);
 void ac_build_endloop(struct ac_llvm_context *ctx, int lable_id);
+void ac_build_ifcc(struct ac_llvm_context *ctx, LLVMValueRef cond, int label_id);
 void ac_build_if(struct ac_llvm_context *ctx, LLVMValueRef value,
 		 int lable_id);
 void ac_build_uif(struct ac_llvm_context *ctx, LLVMValueRef value,
 		  int lable_id);
 
 LLVMValueRef ac_build_alloca(struct ac_llvm_context *ac, LLVMTypeRef type,
 			     const char *name);
 LLVMValueRef ac_build_alloca_undef(struct ac_llvm_context *ac, LLVMTypeRef type,
 				   const char *name);
 
-- 
2.19.1



More information about the mesa-dev mailing list