#include "sid.h"
#include "radeon/radeon_uvd.h"
+#include "gallivm/lp_bld_misc.h"
#include "util/disk_cache.h"
#include "util/hash_table.h"
#include "util/u_log.h"
compiler->tm = ac_create_target_machine(sscreen->info.family,
tm_options, &compiler->triple);
+ if (!compiler->tm)
+ return;
+
+ compiler->target_library_info =
+ gallivm_create_target_library_info(compiler->triple);
+ if (!compiler->target_library_info)
+ return;
}
static void si_destroy_compiler(struct si_compiler *compiler)
{
+ if (compiler->target_library_info)
+ gallivm_dispose_target_library_info(compiler->target_library_info);
if (compiler->tm)
LLVMDisposeTargetMachine(compiler->tm);
}
void si_llvm_optimize_module(struct si_shader_context *ctx)
{
struct gallivm_state *gallivm = &ctx->gallivm;
- LLVMTargetLibraryInfoRef target_library_info;
/* Dump LLVM IR before any optimization passes */
if (ctx->screen->debug_flags & DBG(PREOPT_IR) &&
/* Create the pass manager */
gallivm->passmgr = LLVMCreatePassManager();
- target_library_info =
- gallivm_create_target_library_info(ctx->compiler->triple);
- LLVMAddTargetLibraryInfo(target_library_info, gallivm->passmgr);
+ LLVMAddTargetLibraryInfo(ctx->compiler->target_library_info,
+ gallivm->passmgr);
if (si_extra_shader_checks(ctx->screen, ctx->type))
LLVMAddVerifierPass(gallivm->passmgr);
LLVMDisposeBuilder(ctx->ac.builder);
LLVMDisposePassManager(gallivm->passmgr);
- gallivm_dispose_target_library_info(target_library_info);
}
void si_llvm_dispose(struct si_shader_context *ctx)