diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp index 29dfb86..f44749d 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp @@ -27,17 +27,23 @@ #include #include -#include -#include #include #include #include +#if HAVE_LLVM >= 0x0300 +#include +#include +#else /* HAVE_LLVM < 0x0300 */ +#include +#include +#endif /* HAVE_LLVM < 0x0300 */ + #if HAVE_LLVM >= 0x0209 #include -#else +#else /* HAVE_LLVM < 0x0209 */ #include -#endif +#endif /* HAVE_LLVM < 0x0209 */ #if HAVE_LLVM >= 0x0207 #include @@ -193,14 +199,23 @@ lp_disassemble(const void* func) InitializeAllDisassemblers(); +#if HAVE_LLVM >= 0x0300 + OwningPtr AsmInfo(T->createMCAsmInfo(Triple)); +#else OwningPtr AsmInfo(T->createAsmInfo(Triple)); +#endif if (!AsmInfo) { debug_printf("error: no assembly info for target %s\n", Triple.c_str()); return; } +#if HAVE_LLVM >= 0x0300 + const MCSubtargetInfo *STI = T->createMCSubtargetInfo(Triple, sys::getHostCPUName(), ""); + OwningPtr DisAsm(T->createMCDisassembler(*STI)); +#else OwningPtr DisAsm(T->createMCDisassembler()); +#endif if (!DisAsm) { debug_printf("error: no disassembler for target %s\n", Triple.c_str()); return; @@ -213,7 +228,11 @@ lp_disassemble(const void* func) #else int AsmPrinterVariant = AsmInfo->getAssemblerDialect(); #endif -#if HAVE_LLVM >= 0x0208 + +#if HAVE_LLVM >= 0x0300 + OwningPtr Printer( + T->createMCInstPrinter(AsmPrinterVariant, *AsmInfo, *STI)); +#elif HAVE_LLVM >= 0x0208 OwningPtr Printer( T->createMCInstPrinter(AsmPrinterVariant, *AsmInfo)); #else @@ -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); @@ -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.