Stefan Dirsch
8c3807c87d
Fix compilation with latest llvm, tested against Factory, please forward to Factory. OBS-URL: https://build.opensuse.org/request/show/86846 OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/Mesa?expand=0&rev=181
106 lines
3.1 KiB
Diff
106 lines
3.1 KiB
Diff
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 <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>
|
|
@@ -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());
|
|
return;
|
|
}
|
|
|
|
+#if HAVE_LLVM >= 0x0300
|
|
+ const MCSubtargetInfo *STI = T->createMCSubtargetInfo(Triple, sys::getHostCPUName(), "");
|
|
+ OwningPtr<const MCDisassembler> DisAsm(T->createMCDisassembler(*STI));
|
|
+#else
|
|
OwningPtr<const MCDisassembler> 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<MCInstPrinter> Printer(
|
|
+ T->createMCInstPrinter(AsmPrinterVariant, *AsmInfo, *STI));
|
|
+#elif HAVE_LLVM >= 0x0208
|
|
OwningPtr<MCInstPrinter> 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.
|