switch (param) {
case PIPE_COMPUTE_CAP_IR_TARGET: {
const char *gpu;
+ const char *triple;
+ if (rscreen->family <= CHIP_ARUBA || HAVE_LLVM < 0x0306) {
+ triple = "r600--";
+ } else {
+ triple = "amdgcn--";
+ }
switch(rscreen->family) {
/* Clang < 3.6 is missing Hainan in its list of
* GPUs, so we need to use the name of a similar GPU.
break;
}
if (ret) {
- sprintf(ret, "%s-r600--", gpu);
+ sprintf(ret, "%s-%s", gpu, triple);
+
}
- return (8 + strlen(gpu)) * sizeof(char);
+ return (strlen(triple) + strlen(gpu)) * sizeof(char);
}
case PIPE_COMPUTE_CAP_GRID_DIMENSION:
if (ret) {
}
}
-LLVMTargetRef radeon_llvm_get_r600_target()
+LLVMTargetRef radeon_llvm_get_r600_target(const char *triple)
{
LLVMTargetRef target = NULL;
+ char *err_message = NULL;
+
init_r600_target();
- for (target = LLVMGetFirstTarget(); target;
- target = LLVMGetNextTarget(target)) {
- if (!strncmp(LLVMGetTargetName(target), "r600", 4)) {
- break;
+ if (LLVMGetTargetFromTriple(triple, &target, &err_message)) {
+ fprintf(stderr, "Cannot find target for triple %s ", triple);
+ if (err_message) {
+ fprintf(stderr, "%s\n", err_message);
}
- }
-
- if (!target) {
- fprintf(stderr, "Can't find target r600\n");
+ LLVMDisposeMessage(err_message);
return NULL;
}
return target;
LLVMBool mem_err;
if (!tm) {
- LLVMTargetRef target = radeon_llvm_get_r600_target();
+ strncpy(triple, "r600--", TRIPLE_STRING_LEN);
+ LLVMTargetRef target = radeon_llvm_get_r600_target(triple);
if (!target) {
return 1;
}
LLVMDumpModule(M);
strncpy(fs, "+DumpCode", FS_STRING_LEN);
}
- strncpy(triple, "r600--", TRIPLE_STRING_LEN);
tm = LLVMCreateTargetMachine(target, triple, cpu, fs,
LLVMCodeGenLevelDefault, LLVMRelocDefault,
LLVMCodeModelDefault);
void radeon_llvm_shader_type(LLVMValueRef F, unsigned type);
-LLVMTargetRef radeon_llvm_get_r600_target(void);
+LLVMTargetRef radeon_llvm_get_r600_target(const char *triple);
unsigned radeon_llvm_compile(
LLVMModuleRef M,
{
struct si_screen *sscreen = CALLOC_STRUCT(si_screen);
LLVMTargetRef r600_target;
+#if HAVE_LLVM >= 0x0306
+ const char *triple = "amdgcn--";
+#else
+ const char *triple = "r600--";
+#endif
if (sscreen == NULL) {
return NULL;
}
#if HAVE_LLVM >= 0x0306
/* Initialize LLVM TargetMachine */
- r600_target = radeon_llvm_get_r600_target();
- sscreen->tm = LLVMCreateTargetMachine(r600_target, "r600--",
+ r600_target = radeon_llvm_get_r600_target(triple);
+ sscreen->tm = LLVMCreateTargetMachine(r600_target, triple,
r600_get_llvm_processor_name(sscreen->b.family),
"+DumpCode", LLVMCodeGenLevelDefault, LLVMRelocDefault,
LLVMCodeModelDefault);