amd/common: add chip_class to ac_llvm_context

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
Nicolai Hähnle 2017-09-13 14:36:23 +02:00
parent e0af3bed2c
commit 3db86d86ed
4 changed files with 13 additions and 5 deletions

View file

@ -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;

View file

@ -28,6 +28,8 @@
#include <stdbool.h>
#include <llvm-c/TargetMachine.h>
#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);

View file

@ -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;

View file

@ -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;