summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeon
diff options
context:
space:
mode:
authorJay Cornwall <[email protected]>2013-10-10 20:06:48 -0500
committerTom Stellard <[email protected]>2013-10-12 00:03:58 -0400
commitd7d539a1cb8dcf50cb7cd534e6ae7df3f42914c8 (patch)
treeaf25fab3bed8553f9089060b4f3754aca01e316f /src/gallium/drivers/radeon
parent7681beedd19cf437252fbc1041b19328ad773ea5 (diff)
radeon/llvm: show LLVM disassembly when available
With code dump enabled LLVM may generate disassembly during compilation. Show this disassembly when available and prefer it to SI bytecode dump. Reviewed-by: Tom Stellard <[email protected]> Signed-off-by: Jay Cornwall <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeon')
-rw-r--r--src/gallium/drivers/radeon/radeon_llvm_emit.c7
-rw-r--r--src/gallium/drivers/radeon/radeon_llvm_emit.h1
2 files changed, 8 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.c b/src/gallium/drivers/radeon/radeon_llvm_emit.c
index 2dd7bf7b935..8bf278bb99d 100644
--- a/src/gallium/drivers/radeon/radeon_llvm_emit.c
+++ b/src/gallium/drivers/radeon/radeon_llvm_emit.c
@@ -143,6 +143,7 @@ unsigned radeon_llvm_compile(LLVMModuleRef M, struct radeon_llvm_binary *binary,
elf = elf_memory(elf_buffer, buffer_size);
elf_getshdrstrndx(elf, &section_str_index);
+ binary->disassembled = 0;
while ((section = elf_nextscn(elf, section))) {
const char *name;
@@ -163,6 +164,12 @@ unsigned radeon_llvm_compile(LLVMModuleRef M, struct radeon_llvm_binary *binary,
binary->config_size = section_data->d_size;
binary->config = MALLOC(binary->config_size * sizeof(unsigned char));
memcpy(binary->config, section_data->d_buf, binary->config_size);
+ } else if (dump && !strcmp(name, ".AMDGPU.disasm")) {
+ binary->disassembled = 1;
+ section_data = elf_getdata(section, section_data);
+ fprintf(stderr, "\nShader Disassembly:\n\n");
+ fprintf(stderr, "%.*s\n", (int)section_data->d_size,
+ (char *)section_data->d_buf);
}
}
diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.h b/src/gallium/drivers/radeon/radeon_llvm_emit.h
index 72c24c65593..532b7b843f0 100644
--- a/src/gallium/drivers/radeon/radeon_llvm_emit.h
+++ b/src/gallium/drivers/radeon/radeon_llvm_emit.h
@@ -34,6 +34,7 @@ struct radeon_llvm_binary {
unsigned code_size;
unsigned char *config;
unsigned config_size;
+ int disassembled;
};
void radeon_llvm_shader_type(LLVMValueRef F, unsigned type);