2011-09-15 08:53:21 +02:00
|
|
|
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
|
2011-09-30 17:53:39 +02:00
|
|
|
index 29dfb86..f44749d 100644
|
2011-09-15 08:53:21 +02:00
|
|
|
--- a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
|
|
|
|
+++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
|
|
|
|
@@ -27,17 +27,23 @@
|
|
|
|
|
|
|
|
#include <llvm-c/Core.h>
|
|
|
|
#include <llvm/Target/TargetMachine.h>
|
|
|
|
-#include <llvm/Target/TargetRegistry.h>
|
|
|
|
-#include <llvm/Target/TargetSelect.h>
|
|
|
|
#include <llvm/Target/TargetInstrInfo.h>
|
|
|
|
#include <llvm/Support/raw_ostream.h>
|
|
|
|
#include <llvm/Support/MemoryObject.h>
|
|
|
|
|
|
|
|
+#if HAVE_LLVM >= 0x0300
|
|
|
|
+#include <llvm/Support/TargetRegistry.h>
|
|
|
|
+#include <llvm/Support/TargetSelect.h>
|
|
|
|
+#else /* HAVE_LLVM < 0x0300 */
|
|
|
|
+#include <llvm/Target/TargetRegistry.h>
|
|
|
|
+#include <llvm/Target/TargetSelect.h>
|
|
|
|
+#endif /* HAVE_LLVM < 0x0300 */
|
|
|
|
+
|
|
|
|
#if HAVE_LLVM >= 0x0209
|
|
|
|
#include <llvm/Support/Host.h>
|
|
|
|
-#else
|
|
|
|
+#else /* HAVE_LLVM < 0x0209 */
|
|
|
|
#include <llvm/System/Host.h>
|
|
|
|
-#endif
|
|
|
|
+#endif /* HAVE_LLVM < 0x0209 */
|
|
|
|
|
|
|
|
#if HAVE_LLVM >= 0x0207
|
|
|
|
#include <llvm/MC/MCDisassembler.h>
|
2011-09-30 17:53:39 +02:00
|
|
|
@@ -193,14 +199,23 @@ lp_disassemble(const void* func)
|
|
|
|
|
|
|
|
InitializeAllDisassemblers();
|
|
|
|
|
|
|
|
+#if HAVE_LLVM >= 0x0300
|
|
|
|
+ OwningPtr<const MCAsmInfo> AsmInfo(T->createMCAsmInfo(Triple));
|
|
|
|
+#else
|
|
|
|
OwningPtr<const MCAsmInfo> AsmInfo(T->createAsmInfo(Triple));
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
if (!AsmInfo) {
|
|
|
|
debug_printf("error: no assembly info for target %s\n", Triple.c_str());
|
2011-09-15 08:53:21 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
+#if HAVE_LLVM >= 0x0300
|
2011-09-30 17:53:39 +02:00
|
|
|
+ const MCSubtargetInfo *STI = T->createMCSubtargetInfo(Triple, sys::getHostCPUName(), "");
|
2011-09-15 08:53:21 +02:00
|
|
|
+ OwningPtr<const MCDisassembler> DisAsm(T->createMCDisassembler(*STI));
|
2011-09-30 17:53:39 +02:00
|
|
|
+#else
|
2011-09-15 08:53:21 +02:00
|
|
|
OwningPtr<const MCDisassembler> DisAsm(T->createMCDisassembler());
|
2011-09-30 17:53:39 +02:00
|
|
|
+#endif
|
2011-09-15 08:53:21 +02:00
|
|
|
if (!DisAsm) {
|
|
|
|
debug_printf("error: no disassembler for target %s\n", Triple.c_str());
|
|
|
|
return;
|
2011-09-30 17:53:39 +02:00
|
|
|
@@ -213,7 +228,11 @@ lp_disassemble(const void* func)
|
2011-09-15 08:53:21 +02:00
|
|
|
#else
|
|
|
|
int AsmPrinterVariant = AsmInfo->getAssemblerDialect();
|
|
|
|
#endif
|
|
|
|
-#if HAVE_LLVM >= 0x0208
|
2011-09-30 17:53:39 +02:00
|
|
|
+
|
2011-09-15 08:53:21 +02:00
|
|
|
+#if HAVE_LLVM >= 0x0300
|
|
|
|
+ OwningPtr<MCInstPrinter> Printer(
|
2011-09-30 17:53:39 +02:00
|
|
|
+ T->createMCInstPrinter(AsmPrinterVariant, *AsmInfo, *STI));
|
2011-09-15 08:53:21 +02:00
|
|
|
+#elif HAVE_LLVM >= 0x0208
|
|
|
|
OwningPtr<MCInstPrinter> Printer(
|
|
|
|
T->createMCInstPrinter(AsmPrinterVariant, *AsmInfo));
|
|
|
|
#else
|
2011-09-30 17:53:39 +02:00
|
|
|
@@ -253,7 +272,11 @@ lp_disassemble(const void* func)
|
|
|
|
|
|
|
|
if (!DisAsm->getInstruction(Inst, Size, memoryObject,
|
|
|
|
pc,
|
|
|
|
- nulls())) {
|
|
|
|
+#if HAVE_LLVM >= 0x0300
|
|
|
|
+ nulls(), nulls())) {
|
|
|
|
+#else
|
|
|
|
+ nulls())) {
|
|
|
|
+#endif
|
|
|
|
debug_printf("invalid\n");
|
|
|
|
pc += 1;
|
|
|
|
}
|
|
|
|
@@ -276,7 +299,9 @@ lp_disassemble(const void* func)
|
|
|
|
* Print the instruction.
|
|
|
|
*/
|
|
|
|
|
|
|
|
-#if HAVE_LLVM >= 0x208
|
|
|
|
+#if HAVE_LLVM >= 0x0300
|
|
|
|
+ Printer->printInst(&Inst, Out, "");
|
|
|
|
+#elif HAVE_LLVM >= 0x208
|
|
|
|
Printer->printInst(&Inst, Out);
|
|
|
|
#else
|
|
|
|
Printer->printInst(&Inst);
|
2011-10-06 05:44:16 +02:00
|
|
|
@@ -289,7 +314,11 @@
|
|
|
|
|
|
|
|
pc += Size;
|
|
|
|
|
|
|
|
+#if HAVE_LLVM >= 0x0300
|
|
|
|
+ const MCInstrDesc &TID = TII->get(Inst.getOpcode());
|
|
|
|
+#else
|
|
|
|
const TargetInstrDesc &TID = TII->get(Inst.getOpcode());
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Keep track of forward jumps to a nearby address.
|