summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2014-05-16 01:00:53 +0200
committerRoland Scheidegger <[email protected]>2014-05-16 22:50:14 +0200
commit26cac02c51db0f49f6c67d3cd029ce044a087473 (patch)
tree7b6d73ec23ee447239a30cf5385ff9ae6e0b8b42 /src/gallium/auxiliary
parentef6b6658f91bd5871739bdb71a08042f26abe389 (diff)
gallivm: give more verbose names to modules
When we had just one module "gallivm" was an appropriate name. But now we have modules containing all functions for a particular variant, so give it a corresponding name (this is really just for helping debugging). Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/draw/draw_llvm.c16
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_init.c9
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_init.h2
3 files changed, 17 insertions, 10 deletions
diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
index 3624d930f61..d29adfbea3e 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -525,6 +525,7 @@ draw_llvm_create_variant(struct draw_llvm *llvm,
struct llvm_vertex_shader *shader =
llvm_vertex_shader(llvm->draw->vs.vertex_shader);
LLVMTypeRef vertex_header;
+ char module_name[64];
variant = MALLOC(sizeof *variant +
shader->variant_key_size -
@@ -535,7 +536,10 @@ draw_llvm_create_variant(struct draw_llvm *llvm,
variant->llvm = llvm;
variant->shader = shader;
- variant->gallivm = gallivm_create();
+ util_snprintf(module_name, sizeof(module_name), "draw_llvm_vs_variant%u",
+ variant->shader->variants_cached);
+
+ variant->gallivm = gallivm_create(module_name);
create_jit_types(variant);
@@ -1513,8 +1517,8 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant,
memset(&system_values, 0, sizeof(system_values));
- util_snprintf(func_name, sizeof(func_name), "draw_llvm_vs_variant%u%s",
- variant->shader->variants_cached, elts ? "_elts" : "");
+ util_snprintf(func_name, sizeof(func_name), "draw_llvm_vs_variant%u_%s",
+ variant->shader->variants_cached, elts ? "elts" : "linear");
i = 0;
arg_types[i++] = get_context_ptr_type(variant); /* context */
@@ -2177,6 +2181,7 @@ draw_gs_llvm_create_variant(struct draw_llvm *llvm,
struct llvm_geometry_shader *shader =
llvm_geometry_shader(llvm->draw->gs.geometry_shader);
LLVMTypeRef vertex_header;
+ char module_name[64];
variant = MALLOC(sizeof *variant +
shader->variant_key_size -
@@ -2187,7 +2192,10 @@ draw_gs_llvm_create_variant(struct draw_llvm *llvm,
variant->llvm = llvm;
variant->shader = shader;
- variant->gallivm = gallivm_create();
+ util_snprintf(module_name, sizeof(module_name), "draw_llvm_gs_variant%u",
+ variant->shader->variants_cached);
+
+ variant->gallivm = gallivm_create(module_name);
create_gs_jit_types(variant);
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c
index 83ffad9a838..7aebebb12d3 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_init.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c
@@ -284,7 +284,7 @@ fail:
* \return TRUE for success, FALSE for failure
*/
static boolean
-init_gallivm_state(struct gallivm_state *gallivm)
+init_gallivm_state(struct gallivm_state *gallivm, const char *name)
{
assert(!gallivm->context);
assert(!gallivm->module);
@@ -299,7 +299,7 @@ init_gallivm_state(struct gallivm_state *gallivm)
if (!gallivm->context)
goto fail;
- gallivm->module = LLVMModuleCreateWithNameInContext("gallivm",
+ gallivm->module = LLVMModuleCreateWithNameInContext(name,
gallivm->context);
if (!gallivm->module)
goto fail;
@@ -466,16 +466,15 @@ lp_build_init(void)
/**
* Create a new gallivm_state object.
- * Note that we return a singleton.
*/
struct gallivm_state *
-gallivm_create(void)
+gallivm_create(const char *name)
{
struct gallivm_state *gallivm;
gallivm = CALLOC_STRUCT(gallivm_state);
if (gallivm) {
- if (!init_gallivm_state(gallivm)) {
+ if (!init_gallivm_state(gallivm, name)) {
FREE(gallivm);
gallivm = NULL;
}
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.h b/src/gallium/auxiliary/gallivm/lp_bld_init.h
index 464bb832929..2e32cf8b077 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_init.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_init.h
@@ -54,7 +54,7 @@ lp_build_init(void);
struct gallivm_state *
-gallivm_create(void);
+gallivm_create(const char *name);
void
gallivm_destroy(struct gallivm_state *gallivm);