ac: create the LLVM builder in ac_llvm_context_init
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
This commit is contained in:
@@ -60,7 +60,7 @@ void
|
|||||||
ac_llvm_context_init(struct ac_llvm_context *ctx,
|
ac_llvm_context_init(struct ac_llvm_context *ctx,
|
||||||
struct ac_llvm_compiler *compiler,
|
struct ac_llvm_compiler *compiler,
|
||||||
enum chip_class chip_class, enum radeon_family family,
|
enum chip_class chip_class, enum radeon_family family,
|
||||||
unsigned wave_size)
|
enum ac_float_mode float_mode, unsigned wave_size)
|
||||||
{
|
{
|
||||||
LLVMValueRef args[1];
|
LLVMValueRef args[1];
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ ac_llvm_context_init(struct ac_llvm_context *ctx,
|
|||||||
ctx->module = ac_create_module(wave_size == 32 ? compiler->tm_wave32
|
ctx->module = ac_create_module(wave_size == 32 ? compiler->tm_wave32
|
||||||
: compiler->tm,
|
: compiler->tm,
|
||||||
ctx->context);
|
ctx->context);
|
||||||
ctx->builder = NULL;
|
ctx->builder = ac_create_builder(ctx->context, float_mode);
|
||||||
|
|
||||||
ctx->voidt = LLVMVoidTypeInContext(ctx->context);
|
ctx->voidt = LLVMVoidTypeInContext(ctx->context);
|
||||||
ctx->i1 = LLVMInt1TypeInContext(ctx->context);
|
ctx->i1 = LLVMInt1TypeInContext(ctx->context);
|
||||||
|
@@ -49,6 +49,7 @@ enum {
|
|||||||
|
|
||||||
struct ac_llvm_flow;
|
struct ac_llvm_flow;
|
||||||
struct ac_llvm_compiler;
|
struct ac_llvm_compiler;
|
||||||
|
enum ac_float_mode;
|
||||||
|
|
||||||
struct ac_llvm_context {
|
struct ac_llvm_context {
|
||||||
LLVMContextRef context;
|
LLVMContextRef context;
|
||||||
@@ -113,7 +114,7 @@ void
|
|||||||
ac_llvm_context_init(struct ac_llvm_context *ctx,
|
ac_llvm_context_init(struct ac_llvm_context *ctx,
|
||||||
struct ac_llvm_compiler *compiler,
|
struct ac_llvm_compiler *compiler,
|
||||||
enum chip_class chip_class, enum radeon_family family,
|
enum chip_class chip_class, enum radeon_family family,
|
||||||
unsigned wave_size);
|
enum ac_float_mode float_mode, unsigned wave_size);
|
||||||
|
|
||||||
void
|
void
|
||||||
ac_llvm_context_dispose(struct ac_llvm_context *ctx);
|
ac_llvm_context_dispose(struct ac_llvm_context *ctx);
|
||||||
|
@@ -4319,14 +4319,13 @@ LLVMModuleRef ac_translate_nir_to_llvm(struct ac_llvm_compiler *ac_llvm,
|
|||||||
ctx.options = options;
|
ctx.options = options;
|
||||||
ctx.shader_info = shader_info;
|
ctx.shader_info = shader_info;
|
||||||
|
|
||||||
ac_llvm_context_init(&ctx.ac, ac_llvm, options->chip_class, options->family, 64);
|
|
||||||
ctx.context = ctx.ac.context;
|
|
||||||
|
|
||||||
enum ac_float_mode float_mode =
|
enum ac_float_mode float_mode =
|
||||||
options->unsafe_math ? AC_FLOAT_MODE_UNSAFE_FP_MATH :
|
options->unsafe_math ? AC_FLOAT_MODE_UNSAFE_FP_MATH :
|
||||||
AC_FLOAT_MODE_DEFAULT;
|
AC_FLOAT_MODE_DEFAULT;
|
||||||
|
|
||||||
ctx.ac.builder = ac_create_builder(ctx.context, float_mode);
|
ac_llvm_context_init(&ctx.ac, ac_llvm, options->chip_class,
|
||||||
|
options->family, float_mode, 64);
|
||||||
|
ctx.context = ctx.ac.context;
|
||||||
|
|
||||||
radv_nir_shader_info_init(&shader_info->info);
|
radv_nir_shader_info_init(&shader_info->info);
|
||||||
|
|
||||||
@@ -4837,16 +4836,15 @@ radv_compile_gs_copy_shader(struct ac_llvm_compiler *ac_llvm,
|
|||||||
ctx.options = options;
|
ctx.options = options;
|
||||||
ctx.shader_info = shader_info;
|
ctx.shader_info = shader_info;
|
||||||
|
|
||||||
ac_llvm_context_init(&ctx.ac, ac_llvm, options->chip_class, options->family, 64);
|
|
||||||
ctx.context = ctx.ac.context;
|
|
||||||
|
|
||||||
ctx.is_gs_copy_shader = true;
|
|
||||||
|
|
||||||
enum ac_float_mode float_mode =
|
enum ac_float_mode float_mode =
|
||||||
options->unsafe_math ? AC_FLOAT_MODE_UNSAFE_FP_MATH :
|
options->unsafe_math ? AC_FLOAT_MODE_UNSAFE_FP_MATH :
|
||||||
AC_FLOAT_MODE_DEFAULT;
|
AC_FLOAT_MODE_DEFAULT;
|
||||||
|
|
||||||
ctx.ac.builder = ac_create_builder(ctx.context, float_mode);
|
ac_llvm_context_init(&ctx.ac, ac_llvm, options->chip_class,
|
||||||
|
options->family, float_mode, 64);
|
||||||
|
ctx.context = ctx.ac.context;
|
||||||
|
|
||||||
|
ctx.is_gs_copy_shader = true;
|
||||||
ctx.stage = MESA_SHADER_VERTEX;
|
ctx.stage = MESA_SHADER_VERTEX;
|
||||||
|
|
||||||
radv_nir_shader_info_pass(geom_shader, options, &shader_info->info);
|
radv_nir_shader_info_pass(geom_shader, options, &shader_info->info);
|
||||||
|
@@ -962,14 +962,13 @@ void si_llvm_context_init(struct si_shader_context *ctx,
|
|||||||
ctx->screen = sscreen;
|
ctx->screen = sscreen;
|
||||||
ctx->compiler = compiler;
|
ctx->compiler = compiler;
|
||||||
|
|
||||||
ac_llvm_context_init(&ctx->ac, compiler, sscreen->info.chip_class,
|
|
||||||
sscreen->info.family, 64);
|
|
||||||
|
|
||||||
enum ac_float_mode float_mode =
|
enum ac_float_mode float_mode =
|
||||||
sscreen->debug_flags & DBG(UNSAFE_MATH) ?
|
sscreen->debug_flags & DBG(UNSAFE_MATH) ?
|
||||||
AC_FLOAT_MODE_UNSAFE_FP_MATH :
|
AC_FLOAT_MODE_UNSAFE_FP_MATH :
|
||||||
AC_FLOAT_MODE_NO_SIGNED_ZEROS_FP_MATH;
|
AC_FLOAT_MODE_NO_SIGNED_ZEROS_FP_MATH;
|
||||||
ctx->ac.builder = ac_create_builder(ctx->ac.context, float_mode);
|
|
||||||
|
ac_llvm_context_init(&ctx->ac, compiler, sscreen->info.chip_class,
|
||||||
|
sscreen->info.family, float_mode, 64);
|
||||||
|
|
||||||
ctx->gallivm.context = ctx->ac.context;
|
ctx->gallivm.context = ctx->ac.context;
|
||||||
ctx->gallivm.module = ctx->ac.module;
|
ctx->gallivm.module = ctx->ac.module;
|
||||||
|
Reference in New Issue
Block a user