From 3db86d86ed8484d04c42453001d8704c3cd5d446 Mon Sep 17 00:00:00 2001 From: Nicolai Hähnle Date: Wed, 13 Sep 2017 14:36:23 +0200 Subject: amd/common: add chip_class to ac_llvm_context MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Marek Olšák --- src/amd/common/ac_llvm_build.c | 5 ++++- src/amd/common/ac_llvm_build.h | 7 ++++++- src/amd/common/ac_nir_to_llvm.c | 4 ++-- 3 files changed, 12 insertions(+), 4 deletions(-) (limited to 'src/amd/common') 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; -- cgit v1.2.3