radeonsi: stop using lp_bld_intr.h
authorMarek Olšák <marek.olsak@amd.com>
Thu, 21 Jun 2018 22:20:59 +0000 (18:20 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Mon, 25 Jun 2018 22:33:58 +0000 (18:33 -0400)
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/gallium/drivers/radeonsi/si_shader.c
src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c
src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c

index a45f3c538eece06a24fc8a7f21c234b0b934067c..8680b4e35d1623c3c01f00429f0a84ea012c78b7 100644 (file)
@@ -22,8 +22,6 @@
  * USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
-#include "gallivm/lp_bld_const.h"
-#include "gallivm/lp_bld_intr.h"
 #include "util/u_memory.h"
 #include "util/u_string.h"
 #include "tgsi/tgsi_build.h"
@@ -2243,10 +2241,10 @@ void si_load_system_value(struct si_shader_context *ctx,
                break;
 
        case TGSI_SEMANTIC_HELPER_INVOCATION:
-               value = lp_build_intrinsic(ctx->ac.builder,
+               value = ac_build_intrinsic(&ctx->ac,
                                           "llvm.amdgcn.ps.live",
                                           ctx->i1, NULL, 0,
-                                          LP_FUNC_ATTR_READNONE);
+                                          AC_FUNC_ATTR_READNONE);
                value = LLVMBuildNot(ctx->ac.builder, value, "");
                value = LLVMBuildSExt(ctx->ac.builder, value, ctx->i32, "");
                break;
@@ -2664,9 +2662,9 @@ static LLVMValueRef si_scale_alpha_by_sample_mask(struct lp_build_tgsi_context *
                                samplemask_param);
        coverage = ac_to_integer(&ctx->ac, coverage);
 
-       coverage = lp_build_intrinsic(ctx->ac.builder, "llvm.ctpop.i32",
+       coverage = ac_build_intrinsic(&ctx->ac, "llvm.ctpop.i32",
                                   ctx->i32,
-                                  &coverage, 1, LP_FUNC_ATTR_READNONE);
+                                  &coverage, 1, AC_FUNC_ATTR_READNONE);
 
        coverage = LLVMBuildUIToFP(ctx->ac.builder, coverage,
                                   ctx->f32, "");
@@ -4449,9 +4447,9 @@ static void si_llvm_emit_barrier(const struct lp_build_tgsi_action *action,
                return;
        }
 
-       lp_build_intrinsic(ctx->ac.builder,
+       ac_build_intrinsic(&ctx->ac,
                           "llvm.amdgcn.s.barrier",
-                          ctx->voidt, NULL, 0, LP_FUNC_ATTR_CONVERGENT);
+                          ctx->voidt, NULL, 0, AC_FUNC_ATTR_CONVERGENT);
 }
 
 static const struct lp_build_tgsi_action interp_action = {
@@ -4481,10 +4479,12 @@ static void si_create_function(struct si_shader_context *ctx,
                 * allows the optimization passes to move loads and reduces
                 * SGPR spilling significantly.
                 */
-               lp_add_function_attr(ctx->main_fn, i + 1, LP_FUNC_ATTR_INREG);
+               ac_add_function_attr(ctx->ac.context, ctx->main_fn, i + 1,
+                                    AC_FUNC_ATTR_INREG);
 
                if (LLVMGetTypeKind(LLVMTypeOf(P)) == LLVMPointerTypeKind) {
-                       lp_add_function_attr(ctx->main_fn, i + 1, LP_FUNC_ATTR_NOALIAS);
+                       ac_add_function_attr(ctx->ac.context, ctx->main_fn, i + 1,
+                                            AC_FUNC_ATTR_NOALIAS);
                        ac_add_attr_dereferenceable(P, UINT64_MAX);
                }
        }
@@ -6030,9 +6030,9 @@ static void si_init_exec_from_input(struct si_shader_context *ctx,
                LLVMGetParam(ctx->main_fn, param),
                LLVMConstInt(ctx->i32, bitoffset, 0),
        };
-       lp_build_intrinsic(ctx->ac.builder,
+       ac_build_intrinsic(&ctx->ac,
                           "llvm.amdgcn.init.exec.from.input",
-                          ctx->voidt, args, 2, LP_FUNC_ATTR_CONVERGENT);
+                          ctx->voidt, args, 2, AC_FUNC_ATTR_CONVERGENT);
 }
 
 static bool si_vs_needs_prolog(const struct si_shader_selector *sel,
@@ -6539,7 +6539,8 @@ static void si_build_wrapper_function(struct si_shader_context *ctx,
        si_init_function_info(&fninfo);
 
        for (unsigned i = 0; i < num_parts; ++i) {
-               lp_add_function_attr(parts[i], -1, LP_FUNC_ATTR_ALWAYSINLINE);
+               ac_add_function_attr(ctx->ac.context, parts[i], -1,
+                                    AC_FUNC_ATTR_ALWAYSINLINE);
                LLVMSetLinkage(parts[i], LLVMPrivateLinkage);
        }
 
@@ -6666,9 +6667,10 @@ static void si_build_wrapper_function(struct si_shader_context *ctx,
                        param_size = ac_get_type_size(param_type) / 4;
                        is_sgpr = ac_is_sgpr_param(param);
 
-                       if (is_sgpr)
-                               lp_add_function_attr(parts[part], param_idx + 1, LP_FUNC_ATTR_INREG);
-                       else if (out_idx < num_out_sgpr) {
+                       if (is_sgpr) {
+                               ac_add_function_attr(ctx->ac.context, parts[part],
+                                                    param_idx + 1, AC_FUNC_ATTR_INREG);
+                       } else if (out_idx < num_out_sgpr) {
                                /* Skip returned SGPRs the current part doesn't
                                 * declare on the input. */
                                out_idx = num_out_sgpr;
index 06e773a77f12fe55d1bbd3df99f1840585657f55..3008c3ade1486bf08d65dd73e61fa2dc41f85a67 100644 (file)
@@ -23,7 +23,7 @@
  */
 
 #include "si_shader_internal.h"
-#include "gallivm/lp_bld_intr.h"
+#include "ac_llvm_util.h"
 
 static void kill_if_fetch_args(struct lp_build_tgsi_context *bld_base,
                               struct lp_build_emit_data *emit_data)
@@ -449,9 +449,9 @@ build_tgsi_intrinsic_nomem(const struct lp_build_tgsi_action *action,
 {
        struct si_shader_context *ctx = si_shader_context(bld_base);
        emit_data->output[emit_data->chan] =
-               lp_build_intrinsic(ctx->ac.builder, action->intr_name,
+               ac_build_intrinsic(&ctx->ac, action->intr_name,
                                   emit_data->dst_type, emit_data->args,
-                                  emit_data->arg_count, LP_FUNC_ATTR_READNONE);
+                                  emit_data->arg_count, AC_FUNC_ATTR_READNONE);
 }
 
 static void emit_bfi(const struct lp_build_tgsi_action *action,
@@ -690,10 +690,10 @@ static void dfracexp_emit(const struct lp_build_tgsi_action *action,
        struct si_shader_context *ctx = si_shader_context(bld_base);
 
        emit_data->output[emit_data->chan] =
-               lp_build_intrinsic(ctx->ac.builder, "llvm.amdgcn.frexp.mant.f64",
+               ac_build_intrinsic(&ctx->ac, "llvm.amdgcn.frexp.mant.f64",
                                   ctx->ac.f64, &emit_data->args[0], 1, 0);
        emit_data->output1[emit_data->chan] =
-               lp_build_intrinsic(ctx->ac.builder, "llvm.amdgcn.frexp.exp.i32.f64",
+               ac_build_intrinsic(&ctx->ac, "llvm.amdgcn.frexp.exp.i32.f64",
                                   ctx->ac.i32, &emit_data->args[0], 1, 0);
 }
 
index a3091c09d69c5c3701947886e3675fd9dfca6dc6..c91bcc5697158bd1649ee68883622215aebb5784 100644 (file)
@@ -25,7 +25,6 @@
 #include "si_shader_internal.h"
 #include "si_pipe.h"
 #include "sid.h"
-#include "gallivm/lp_bld_intr.h"
 #include "tgsi/tgsi_build.h"
 #include "tgsi/tgsi_util.h"
 #include "ac_llvm_util.h"
@@ -709,8 +708,8 @@ static void store_emit_buffer(
                emit_data->args[0] = data;
                emit_data->args[3] = offset;
 
-               lp_build_intrinsic(
-                       builder, intrinsic_name, emit_data->dst_type,
+               ac_build_intrinsic(
+                       &ctx->ac, intrinsic_name, emit_data->dst_type,
                        emit_data->args, emit_data->arg_count,
                        ac_get_store_intr_attribs(writeonly_memory));
        }
@@ -745,7 +744,6 @@ static void store_emit(
                struct lp_build_emit_data *emit_data)
 {
        struct si_shader_context *ctx = si_shader_context(bld_base);
-       LLVMBuilderRef builder = ctx->ac.builder;
        const struct tgsi_full_instruction * inst = emit_data->inst;
        const struct tgsi_shader_info *info = &ctx->shader->selector->info;
        unsigned target = inst->Memory.Texture;
@@ -771,8 +769,8 @@ static void store_emit(
        }
 
        if (target == TGSI_TEXTURE_BUFFER) {
-               emit_data->output[emit_data->chan] = lp_build_intrinsic(
-                       builder, "llvm.amdgcn.buffer.store.format.v4f32",
+               emit_data->output[emit_data->chan] = ac_build_intrinsic(
+                       &ctx->ac, "llvm.amdgcn.buffer.store.format.v4f32",
                        emit_data->dst_type, emit_data->args,
                        emit_data->arg_count,
                        ac_get_store_intr_attribs(writeonly_memory));
@@ -926,7 +924,6 @@ static void atomic_emit(
                struct lp_build_emit_data *emit_data)
 {
        struct si_shader_context *ctx = si_shader_context(bld_base);
-       LLVMBuilderRef builder = ctx->ac.builder;
        const struct tgsi_full_instruction * inst = emit_data->inst;
        LLVMValueRef tmp;
 
@@ -940,8 +937,8 @@ static void atomic_emit(
                char intrinsic_name[40];
                snprintf(intrinsic_name, sizeof(intrinsic_name),
                         "llvm.amdgcn.buffer.atomic.%s", action->intr_name);
-               tmp = lp_build_intrinsic(
-                       builder, intrinsic_name, ctx->i32,
+               tmp = ac_build_intrinsic(
+                       &ctx->ac, intrinsic_name, ctx->i32,
                        emit_data->args, emit_data->arg_count, 0);
                emit_data->output[emit_data->chan] = ac_to_float(&ctx->ac, tmp);
        } else {