From: Nicolai Hähnle Date: Wed, 13 Sep 2017 12:36:23 +0000 (+0200) Subject: amd/common: add chip_class to ac_llvm_context X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3db86d86ed8484d04c42453001d8704c3cd5d446;p=mesa.git amd/common: add chip_class to ac_llvm_context Reviewed-by: Marek Olšák --- diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c index 7193b80be59..4077bd81bbc 100644 --- a/src/amd/common/ac_llvm_build.c +++ b/src/amd/common/ac_llvm_build.c @@ -46,10 +46,13 @@ * The caller is responsible for initializing ctx::module and ctx::builder. */ void -ac_llvm_context_init(struct ac_llvm_context *ctx, LLVMContextRef context) +ac_llvm_context_init(struct ac_llvm_context *ctx, LLVMContextRef context, + enum chip_class chip_class) { LLVMValueRef args[1]; + ctx->chip_class = chip_class; + ctx->context = context; ctx->module = NULL; ctx->builder = NULL; diff --git a/src/amd/common/ac_llvm_build.h b/src/amd/common/ac_llvm_build.h index 14ec03f5c84..b6434893cfa 100644 --- a/src/amd/common/ac_llvm_build.h +++ b/src/amd/common/ac_llvm_build.h @@ -28,6 +28,8 @@ #include #include +#include "amd_family.h" + #ifdef __cplusplus extern "C" { #endif @@ -61,10 +63,13 @@ struct ac_llvm_context { unsigned fpmath_md_kind; LLVMValueRef fpmath_md_2p5_ulp; LLVMValueRef empty_md; + + enum chip_class chip_class; }; void -ac_llvm_context_init(struct ac_llvm_context *ctx, LLVMContextRef context); +ac_llvm_context_init(struct ac_llvm_context *ctx, LLVMContextRef context, + enum chip_class chip_class); unsigned ac_get_type_size(LLVMTypeRef type); diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index ba98cb2bde0..870620e7870 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -6329,7 +6329,7 @@ LLVMModuleRef ac_translate_nir_to_llvm(LLVMTargetMachineRef tm, ctx.context = LLVMContextCreate(); ctx.module = LLVMModuleCreateWithNameInContext("shader", ctx.context); - ac_llvm_context_init(&ctx.ac, ctx.context); + ac_llvm_context_init(&ctx.ac, ctx.context, options->chip_class); ctx.ac.module = ctx.module; memset(shader_info, 0, sizeof(*shader_info)); @@ -6653,7 +6653,7 @@ void ac_create_gs_copy_shader(LLVMTargetMachineRef tm, ctx.options = options; ctx.shader_info = shader_info; - ac_llvm_context_init(&ctx.ac, ctx.context); + ac_llvm_context_init(&ctx.ac, ctx.context, options->chip_class); ctx.ac.module = ctx.module; ctx.is_gs_copy_shader = true; diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c index 231f16f049d..0ad394d461e 100644 --- a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c +++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c @@ -1193,7 +1193,7 @@ void si_llvm_context_init(struct si_shader_context *ctx, ctx->gallivm.builder = lp_create_builder(ctx->gallivm.context, float_mode); - ac_llvm_context_init(&ctx->ac, ctx->gallivm.context); + ac_llvm_context_init(&ctx->ac, ctx->gallivm.context, sscreen->b.chip_class); ctx->ac.module = ctx->gallivm.module; ctx->ac.builder = ctx->gallivm.builder;