ac: fold LLVMContext creation into ac_llvm_context_init
Reviewed-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
@@ -57,15 +57,15 @@ struct ac_llvm_flow {
|
|||||||
* The caller is responsible for initializing ctx::module and ctx::builder.
|
* The caller is responsible for initializing ctx::module and ctx::builder.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ac_llvm_context_init(struct ac_llvm_context *ctx, LLVMContextRef context,
|
ac_llvm_context_init(struct ac_llvm_context *ctx,
|
||||||
enum chip_class chip_class, enum radeon_family family)
|
enum chip_class chip_class, enum radeon_family family)
|
||||||
{
|
{
|
||||||
LLVMValueRef args[1];
|
LLVMValueRef args[1];
|
||||||
|
|
||||||
|
ctx->context = LLVMContextCreate();
|
||||||
|
|
||||||
ctx->chip_class = chip_class;
|
ctx->chip_class = chip_class;
|
||||||
ctx->family = family;
|
ctx->family = family;
|
||||||
|
|
||||||
ctx->context = context;
|
|
||||||
ctx->module = NULL;
|
ctx->module = NULL;
|
||||||
ctx->builder = NULL;
|
ctx->builder = NULL;
|
||||||
|
|
||||||
|
@@ -97,7 +97,7 @@ struct ac_llvm_context {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
ac_llvm_context_init(struct ac_llvm_context *ctx, LLVMContextRef context,
|
ac_llvm_context_init(struct ac_llvm_context *ctx,
|
||||||
enum chip_class chip_class, enum radeon_family family);
|
enum chip_class chip_class, enum radeon_family family);
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@@ -3137,10 +3137,9 @@ LLVMModuleRef ac_translate_nir_to_llvm(struct ac_llvm_compiler *ac_llvm,
|
|||||||
unsigned i;
|
unsigned i;
|
||||||
ctx.options = options;
|
ctx.options = options;
|
||||||
ctx.shader_info = shader_info;
|
ctx.shader_info = shader_info;
|
||||||
ctx.context = LLVMContextCreate();
|
|
||||||
|
|
||||||
ac_llvm_context_init(&ctx.ac, ctx.context, options->chip_class,
|
ac_llvm_context_init(&ctx.ac, options->chip_class, options->family);
|
||||||
options->family);
|
ctx.context = ctx.ac.context;
|
||||||
ctx.ac.module = ac_create_module(ac_llvm->tm, ctx.context);
|
ctx.ac.module = ac_create_module(ac_llvm->tm, ctx.context);
|
||||||
|
|
||||||
enum ac_float_mode float_mode =
|
enum ac_float_mode float_mode =
|
||||||
@@ -3576,12 +3575,11 @@ radv_compile_gs_copy_shader(struct ac_llvm_compiler *ac_llvm,
|
|||||||
const struct radv_nir_compiler_options *options)
|
const struct radv_nir_compiler_options *options)
|
||||||
{
|
{
|
||||||
struct radv_shader_context ctx = {0};
|
struct radv_shader_context ctx = {0};
|
||||||
ctx.context = LLVMContextCreate();
|
|
||||||
ctx.options = options;
|
ctx.options = options;
|
||||||
ctx.shader_info = shader_info;
|
ctx.shader_info = shader_info;
|
||||||
|
|
||||||
ac_llvm_context_init(&ctx.ac, ctx.context, options->chip_class,
|
ac_llvm_context_init(&ctx.ac, options->chip_class, options->family);
|
||||||
options->family);
|
ctx.context = ctx.ac.context;
|
||||||
ctx.ac.module = ac_create_module(ac_llvm->tm, ctx.context);
|
ctx.ac.module = ac_create_module(ac_llvm->tm, ctx.context);
|
||||||
|
|
||||||
ctx.is_gs_copy_shader = true;
|
ctx.is_gs_copy_shader = true;
|
||||||
|
@@ -956,10 +956,7 @@ void si_llvm_context_init(struct si_shader_context *ctx,
|
|||||||
ctx->screen = sscreen;
|
ctx->screen = sscreen;
|
||||||
ctx->compiler = compiler;
|
ctx->compiler = compiler;
|
||||||
|
|
||||||
ctx->ac.context = LLVMContextCreate();
|
ac_llvm_context_init(&ctx->ac, sscreen->info.chip_class, sscreen->info.family);
|
||||||
ac_llvm_context_init(&ctx->ac, ctx->ac.context,
|
|
||||||
sscreen->info.chip_class, sscreen->info.family);
|
|
||||||
|
|
||||||
ctx->ac.module = ac_create_module(compiler->tm, ctx->ac.context);
|
ctx->ac.module = ac_create_module(compiler->tm, ctx->ac.context);
|
||||||
|
|
||||||
enum ac_float_mode float_mode =
|
enum ac_float_mode float_mode =
|
||||||
|
Reference in New Issue
Block a user