r600g/llvm: Pass struct r600_bytecode to r600_llvm_compile
authorTom Stellard <thomas.stellard@amd.com>
Wed, 24 Apr 2013 03:08:57 +0000 (20:08 -0700)
committerTom Stellard <thomas.stellard@amd.com>
Wed, 24 Apr 2013 16:42:41 +0000 (12:42 -0400)
This way we don't need to update the function signature everytime we
emit a new config value.  This also fixes the build with
--enable-opencl.

src/gallium/drivers/r600/r600_llvm.c
src/gallium/drivers/r600/r600_llvm.h
src/gallium/drivers/r600/r600_shader.c

index 8344fb0250931b5eebf3f7bc6ae2f710f357366e..2050be26df8af3a052d0fc54082a9da55e5cbc9c 100644 (file)
@@ -555,8 +555,7 @@ unsigned r600_llvm_compile(
        unsigned char ** inst_bytes,
        unsigned * inst_byte_count,
        enum radeon_family family,
-       unsigned *ngpr,
-       unsigned *stack_size,
+       struct r600_bytecode *bc,
        unsigned dump)
 {
        unsigned r;
@@ -565,8 +564,8 @@ unsigned r600_llvm_compile(
        r = radeon_llvm_compile(mod, &binary, gpu_family, dump);
        *inst_bytes = binary.code;
        *inst_byte_count = binary.code_size;
-       *ngpr = util_le32_to_cpu(*(uint32_t*)binary.config);
-       *stack_size = util_le32_to_cpu(*(uint32_t*)binary.config + 4);
+       bc->ngpr = util_le32_to_cpu(*(uint32_t*)binary.config);
+       bc->nstack = util_le32_to_cpu(*(uint32_t*)(binary.config + 4));
        return r;
 }
 
index b08343abd1d24aea2958e46a00b9d77c20951daf..919dd244cd0241cd76cd1f38520fcd641468c5d8 100644 (file)
@@ -7,6 +7,7 @@
 #include "radeon_llvm.h"
 #include <llvm-c/Core.h>
 
+struct r600_bytecode;
 struct r600_shader_ctx;
 struct radeon_llvm_context;
 enum radeon_family;
@@ -20,8 +21,7 @@ unsigned r600_llvm_compile(
        unsigned char ** inst_bytes,
        unsigned * inst_byte_count,
        enum radeon_family family,
-       unsigned *ngpr,
-       unsigned *stack_size,
+       struct r600_bytecode *bc,
        unsigned dump);
 
 #endif /* defined R600_USE_LLVM || defined HAVE_OPENCL */
index 606dbeaf987f34bc7246cb74b1b9b48ab198615e..0204f805432b43b832b31658ce5b1a21d758c203 100644 (file)
@@ -279,7 +279,7 @@ int r600_compute_shader_create(struct pipe_context * ctx,
        shader_ctx.bc->type = TGSI_PROCESSOR_COMPUTE;
        shader_ctx.bc->isa = r600_ctx->isa;
        r600_llvm_compile(mod, &bytes, &byte_count, r600_ctx->family,
-                               &shader_ctx.bc->ngpr, dump);
+                               shader_ctx.bc, dump);
        r600_bytecode_from_byte_stream(&shader_ctx, bytes, byte_count);
        if (shader_ctx.bc->chip_class == CAYMAN) {
                cm_bytecode_add_cf_end(shader_ctx.bc);
@@ -1461,7 +1461,7 @@ static int r600_shader_from_tgsi(struct r600_screen *rscreen,
                mod = r600_tgsi_llvm(&radeon_llvm_ctx, tokens);
 
                if (r600_llvm_compile(mod, &inst_bytes, &inst_byte_count,
-                                     rscreen->family, &ctx.bc->ngpr, &ctx.bc->nstack, dump)) {
+                                     rscreen->family, ctx.bc, dump)) {
                        FREE(inst_bytes);
                        radeon_llvm_dispose(&radeon_llvm_ctx);
                        use_llvm = 0;