radeon/llvm: Fix build with LLVM 3.2
authorTom Stellard <thomas.stellard@amd.com>
Wed, 10 Oct 2012 21:00:13 +0000 (21:00 +0000)
committerTom Stellard <thomas.stellard@amd.com>
Thu, 11 Oct 2012 21:33:00 +0000 (21:33 +0000)
src/gallium/drivers/radeon/radeon_llvm_emit.cpp

index 2f2eb4cb48eb9dedb605f124e236853428851526..21661a0500204b09d44f9763c3b192d3f1d4732f 100644 (file)
 #include <llvm/Support/TargetRegistry.h>
 #include <llvm/Support/TargetSelect.h>
 #include <llvm/Support/Threading.h>
-#include <llvm/Target/TargetData.h>
 #include <llvm/Target/TargetMachine.h>
-
 #include <llvm/Transforms/Scalar.h>
-
 #include <llvm-c/Target.h>
 
+#if HAVE_LLVM < 0x0302
+#include <llvm/Target/TargetData.h>
+#else
+#include <llvm/DataLayout.h>
+#endif
+
 #include <iostream>
 #include <stdlib.h>
 #include <stdio.h>
@@ -120,7 +123,11 @@ radeon_llvm_compile(LLVMModuleRef M, unsigned char ** bytes,
                      ));
    TargetMachine &AMDGPUTargetMachine = *tm.get();
    PassManager PM;
+#if HAVE_LLVM < 0x0302
    PM.add(new TargetData(*AMDGPUTargetMachine.getTargetData()));
+#else
+   PM.add(new DataLayout(*AMDGPUTargetMachine.getDataLayout()));
+#endif
    PM.add(createPromoteMemoryToRegisterPass());
    AMDGPUTargetMachine.setAsmVerbosityDefault(true);