AC_FLOAT_MODE_UNSAFE_FP_MATH,
};
+/* Per-thread persistent LLVM objects. */
+struct ac_llvm_compiler {
+ LLVMTargetMachineRef tm;
+ LLVMTargetLibraryInfoRef target_library_info;
+ LLVMPassManagerRef passmgr;
+};
+
const char *ac_get_llvm_processor_name(enum radeon_family family);
LLVMTargetMachineRef ac_create_target_machine(enum radeon_family family,
enum ac_target_machine_options tm_options,
struct si_compute *program = (struct si_compute *)job;
struct si_shader *shader = &program->shader;
struct si_shader_selector sel;
- struct si_compiler *compiler;
+ struct ac_llvm_compiler *compiler;
struct pipe_debug_callback *debug = &program->compiler_ctx_state.debug;
struct si_screen *sscreen = program->screen;
};
static void si_init_compiler(struct si_screen *sscreen,
- struct si_compiler *compiler)
+ struct ac_llvm_compiler *compiler)
{
enum ac_target_machine_options tm_options =
(sscreen->debug_flags & DBG(SI_SCHED) ? AC_TM_SISCHED : 0) |
return;
}
-static void si_destroy_compiler(struct si_compiler *compiler)
+static void si_destroy_compiler(struct ac_llvm_compiler *compiler)
{
if (compiler->passmgr)
LLVMDisposePassManager(compiler->passmgr);
/* Use at most 3 normal compiler threads on quadcore and better.
* Hyperthreaded CPUs report the number of threads, but we want
* the number of cores. We only need this many threads for shader-db. */
- struct si_compiler compiler[24]; /* used by the queue only */
+ struct ac_llvm_compiler compiler[24]; /* used by the queue only */
struct util_queue shader_compiler_queue_low_priority;
/* Use at most 2 low priority threads on quadcore and better.
* We want to minimize the impact on multithreaded Mesa. */
- struct si_compiler compiler_lowp[10];
+ struct ac_llvm_compiler compiler_lowp[10];
};
struct si_blend_color {
void *vs_blit_texcoord;
struct si_screen *screen;
struct pipe_debug_callback debug;
- struct si_compiler compiler; /* only non-threaded compilation */
+ struct ac_llvm_compiler compiler; /* only non-threaded compilation */
struct si_shader_ctx_state fixed_func_tcs_shader;
struct r600_resource *wait_mem_scratch;
unsigned wait_mem_number;
static void si_init_shader_ctx(struct si_shader_context *ctx,
struct si_screen *sscreen,
- struct si_compiler *compiler);
+ struct ac_llvm_compiler *compiler);
static void si_llvm_emit_barrier(const struct lp_build_tgsi_action *action,
struct lp_build_tgsi_context *bld_base,
static int si_compile_llvm(struct si_screen *sscreen,
struct ac_shader_binary *binary,
struct si_shader_config *conf,
- struct si_compiler *compiler,
+ struct ac_llvm_compiler *compiler,
LLVMModuleRef mod,
struct pipe_debug_callback *debug,
unsigned processor,
/* Generate code for the hardware VS shader stage to go with a geometry shader */
struct si_shader *
si_generate_gs_copy_shader(struct si_screen *sscreen,
- struct si_compiler *compiler,
+ struct ac_llvm_compiler *compiler,
struct si_shader_selector *gs_selector,
struct pipe_debug_callback *debug)
{
static void si_init_shader_ctx(struct si_shader_context *ctx,
struct si_screen *sscreen,
- struct si_compiler *compiler)
+ struct ac_llvm_compiler *compiler)
{
struct lp_build_tgsi_context *bld_base;
}
int si_compile_tgsi_shader(struct si_screen *sscreen,
- struct si_compiler *compiler,
+ struct ac_llvm_compiler *compiler,
struct si_shader *shader,
struct pipe_debug_callback *debug)
{
enum pipe_shader_type type,
bool prolog,
union si_shader_part_key *key,
- struct si_compiler *compiler,
+ struct ac_llvm_compiler *compiler,
struct pipe_debug_callback *debug,
void (*build)(struct si_shader_context *,
union si_shader_part_key *),
}
static bool si_get_vs_prolog(struct si_screen *sscreen,
- struct si_compiler *compiler,
+ struct ac_llvm_compiler *compiler,
struct si_shader *shader,
struct pipe_debug_callback *debug,
struct si_shader *main_part,
* Select and compile (or reuse) vertex shader parts (prolog & epilog).
*/
static bool si_shader_select_vs_parts(struct si_screen *sscreen,
- struct si_compiler *compiler,
+ struct ac_llvm_compiler *compiler,
struct si_shader *shader,
struct pipe_debug_callback *debug)
{
* Select and compile (or reuse) TCS parts (epilog).
*/
static bool si_shader_select_tcs_parts(struct si_screen *sscreen,
- struct si_compiler *compiler,
+ struct ac_llvm_compiler *compiler,
struct si_shader *shader,
struct pipe_debug_callback *debug)
{
* Select and compile (or reuse) GS parts (prolog).
*/
static bool si_shader_select_gs_parts(struct si_screen *sscreen,
- struct si_compiler *compiler,
+ struct ac_llvm_compiler *compiler,
struct si_shader *shader,
struct pipe_debug_callback *debug)
{
* Select and compile (or reuse) pixel shader parts (prolog & epilog).
*/
static bool si_shader_select_ps_parts(struct si_screen *sscreen,
- struct si_compiler *compiler,
+ struct ac_llvm_compiler *compiler,
struct si_shader *shader,
struct pipe_debug_callback *debug)
{
}
}
-int si_shader_create(struct si_screen *sscreen, struct si_compiler *compiler,
+int si_shader_create(struct si_screen *sscreen, struct ac_llvm_compiler *compiler,
struct si_shader *shader,
struct pipe_debug_callback *debug)
{
#include "ac_binary.h"
#include "ac_llvm_build.h"
+#include "ac_llvm_util.h"
#include <stdio.h>
struct si_shader;
-/* Per-thread persistent LLVM objects. */
-struct si_compiler {
- LLVMTargetMachineRef tm;
- LLVMTargetLibraryInfoRef target_library_info;
- LLVMPassManagerRef passmgr;
-};
-
/* State of the context creating the shader object. */
struct si_compiler_ctx_state {
/* Should only be used by si_init_shader_selector_async and
* si_build_shader_variant if thread_index == -1 (non-threaded). */
- struct si_compiler *compiler;
+ struct ac_llvm_compiler *compiler;
/* Used if thread_index == -1 or if debug.async is true. */
struct pipe_debug_callback debug;
/* si_shader.c */
struct si_shader *
si_generate_gs_copy_shader(struct si_screen *sscreen,
- struct si_compiler *compiler,
+ struct ac_llvm_compiler *compiler,
struct si_shader_selector *gs_selector,
struct pipe_debug_callback *debug);
int si_compile_tgsi_shader(struct si_screen *sscreen,
- struct si_compiler *compiler,
+ struct ac_llvm_compiler *compiler,
struct si_shader *shader,
struct pipe_debug_callback *debug);
-int si_shader_create(struct si_screen *sscreen, struct si_compiler *compiler,
+int si_shader_create(struct si_screen *sscreen, struct ac_llvm_compiler *compiler,
struct si_shader *shader,
struct pipe_debug_callback *debug);
void si_shader_destroy(struct si_shader *shader);
/* CS */
int param_block_size;
- struct si_compiler *compiler;
+ struct ac_llvm_compiler *compiler;
/* Preloaded descriptors. */
LLVMValueRef esgs_ring;
}
unsigned si_llvm_compile(LLVMModuleRef M, struct ac_shader_binary *binary,
- struct si_compiler *compiler,
+ struct ac_llvm_compiler *compiler,
struct pipe_debug_callback *debug);
LLVMTypeRef tgsi2llvmtype(struct lp_build_tgsi_context *bld_base,
void si_llvm_context_init(struct si_shader_context *ctx,
struct si_screen *sscreen,
- struct si_compiler *compiler);
+ struct ac_llvm_compiler *compiler);
void si_llvm_context_set_tgsi(struct si_shader_context *ctx,
struct si_shader *shader);
* @returns 0 for success, 1 for failure
*/
unsigned si_llvm_compile(LLVMModuleRef M, struct ac_shader_binary *binary,
- struct si_compiler *compiler,
+ struct ac_llvm_compiler *compiler,
struct pipe_debug_callback *debug)
{
struct si_llvm_diagnostics diag;
void si_llvm_context_init(struct si_shader_context *ctx,
struct si_screen *sscreen,
- struct si_compiler *compiler)
+ struct ac_llvm_compiler *compiler)
{
struct lp_type type;
{
struct si_shader_selector *sel = shader->selector;
struct si_screen *sscreen = sel->screen;
- struct si_compiler *compiler;
+ struct ac_llvm_compiler *compiler;
struct pipe_debug_callback *debug = &shader->compiler_ctx_state.debug;
int r;
{
struct si_shader_selector *sel = (struct si_shader_selector *)job;
struct si_screen *sscreen = sel->screen;
- struct si_compiler *compiler;
+ struct ac_llvm_compiler *compiler;
struct pipe_debug_callback *debug = &sel->compiler_ctx_state.debug;
assert(!debug->debug_message || debug->async);