llvmpipe: Avoid LLVMGetGlobalContext in tests.

Trivial.
This commit is contained in:
Jose Fonseca 2016-04-19 12:07:16 +01:00
parent bb9e8c5090
commit 524042fa35
5 changed files with 24 additions and 6 deletions

View file

@ -400,6 +400,7 @@ test_unary(unsigned verbose, FILE *fp, const struct unary_test_t *test, unsigned
{
char test_name[128];
util_snprintf(test_name, sizeof test_name, "%s.v%u", test->name, length);
LLVMContextRef context;
struct gallivm_state *gallivm;
LLVMValueRef test_func;
unary_func_t test_func_jit;
@ -415,7 +416,8 @@ test_unary(unsigned verbose, FILE *fp, const struct unary_test_t *test, unsigned
in[i] = 1.0;
}
gallivm = gallivm_create("test_module", LLVMGetGlobalContext());
context = LLVMContextCreate();
gallivm = gallivm_create("test_module", context);
test_func = build_unary_test_func(gallivm, test, length, test_name);
@ -486,6 +488,7 @@ test_unary(unsigned verbose, FILE *fp, const struct unary_test_t *test, unsigned
}
gallivm_destroy(gallivm);
LLVMContextDispose(context);
align_free(in);
align_free(out);

View file

@ -437,6 +437,7 @@ test_one(unsigned verbose,
const struct pipe_blend_state *blend,
struct lp_type type)
{
LLVMContextRef context;
struct gallivm_state *gallivm;
LLVMValueRef func = NULL;
blend_test_ptr_t blend_test_ptr;
@ -450,7 +451,8 @@ test_one(unsigned verbose,
if(verbose >= 1)
dump_blend_type(stdout, blend, type);
gallivm = gallivm_create("test_module", LLVMGetGlobalContext());
context = LLVMContextCreate();
gallivm = gallivm_create("test_module", context);
func = add_blend_test(gallivm, blend, type);
@ -579,6 +581,7 @@ test_one(unsigned verbose,
write_tsv_row(fp, blend, type, cycles_avg, success);
gallivm_destroy(gallivm);
LLVMContextDispose(context);
return success;
}

View file

@ -155,6 +155,7 @@ test_one(unsigned verbose,
struct lp_type src_type,
struct lp_type dst_type)
{
LLVMContextRef context;
struct gallivm_state *gallivm;
LLVMValueRef func = NULL;
conv_test_ptr_t conv_test_ptr;
@ -211,7 +212,8 @@ test_one(unsigned verbose,
eps = MAX2(lp_const_eps(src_type), lp_const_eps(dst_type));
gallivm = gallivm_create("test_module", LLVMGetGlobalContext());
context = LLVMContextCreate();
gallivm = gallivm_create("test_module", context);
func = add_conv_test(gallivm, src_type, num_srcs, dst_type, num_dsts);
@ -322,6 +324,7 @@ test_one(unsigned verbose,
write_tsv_row(fp, src_type, dst_type, cycles_avg, success);
gallivm_destroy(gallivm);
LLVMContextDispose(context);
return success;
}

View file

@ -139,6 +139,7 @@ static boolean
test_format_float(unsigned verbose, FILE *fp,
const struct util_format_description *desc)
{
LLVMContextRef context;
struct gallivm_state *gallivm;
LLVMValueRef fetch = NULL;
fetch_ptr_t fetch_ptr;
@ -148,7 +149,8 @@ test_format_float(unsigned verbose, FILE *fp,
boolean success = TRUE;
unsigned i, j, k, l;
gallivm = gallivm_create("test_module_float", LLVMGetGlobalContext());
context = LLVMContextCreate();
gallivm = gallivm_create("test_module_float", context);
fetch = add_fetch_rgba_test(gallivm, verbose, desc, lp_float32_vec4_type());
@ -222,6 +224,7 @@ test_format_float(unsigned verbose, FILE *fp,
}
gallivm_destroy(gallivm);
LLVMContextDispose(context);
if(fp)
write_tsv_row(fp, desc, success);
@ -235,6 +238,7 @@ static boolean
test_format_unorm8(unsigned verbose, FILE *fp,
const struct util_format_description *desc)
{
LLVMContextRef context;
struct gallivm_state *gallivm;
LLVMValueRef fetch = NULL;
fetch_ptr_t fetch_ptr;
@ -244,7 +248,8 @@ test_format_unorm8(unsigned verbose, FILE *fp,
boolean success = TRUE;
unsigned i, j, k, l;
gallivm = gallivm_create("test_module_unorm8", LLVMGetGlobalContext());
context = LLVMContextCreate();
gallivm = gallivm_create("test_module_unorm8", context);
fetch = add_fetch_rgba_test(gallivm, verbose, desc, lp_unorm8_vec4_type());
@ -317,6 +322,7 @@ test_format_unorm8(unsigned verbose, FILE *fp,
}
gallivm_destroy(gallivm);
LLVMContextDispose(context);
if(fp)
write_tsv_row(fp, desc, success);

View file

@ -89,12 +89,14 @@ static boolean
test_printf(unsigned verbose, FILE *fp,
const struct printf_test_case *testcase)
{
LLVMContextRef context;
struct gallivm_state *gallivm;
LLVMValueRef test;
test_printf_t test_printf_func;
boolean success = TRUE;
gallivm = gallivm_create("test_module", LLVMGetGlobalContext());
context = LLVMContextCreate();
gallivm = gallivm_create("test_module", context);
test = add_printf_test(gallivm);
@ -107,6 +109,7 @@ test_printf(unsigned verbose, FILE *fp,
test_printf_func(0);
gallivm_destroy(gallivm);
LLVMContextDispose(context);
return success;
}