diff options
author | Nicolai Hähnle <[email protected]> | 2017-09-29 11:17:03 +0200 |
---|---|---|
committer | Nicolai Hähnle <[email protected]> | 2017-10-02 12:17:15 +0200 |
commit | 052b974fed3586f3b2f61d2d2c050c1807ec43c5 (patch) | |
tree | fb00c49401d760684f80a7032ca6ef2e21698900 /src/amd/common | |
parent | 70f6b95862a5b71d6e13fbab1c05763808c390a3 (diff) |
amd/common: move ac_build_phi from radeonsi
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/amd/common')
-rw-r--r-- | src/amd/common/ac_llvm_build.c | 14 | ||||
-rw-r--r-- | src/amd/common/ac_llvm_build.h | 5 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c index 71468df2dbc..51fb009be8b 100644 --- a/src/amd/common/ac_llvm_build.c +++ b/src/amd/common/ac_llvm_build.c @@ -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. diff --git a/src/amd/common/ac_llvm_build.h b/src/amd/common/ac_llvm_build.h index 3f93551330c..1d6dc0ab2f5 100644 --- a/src/amd/common/ac_llvm_build.h +++ b/src/amd/common/ac_llvm_build.h @@ -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); |