gallivm: Fix build with llvm-3.0
[mesa.git] / src / gallium / auxiliary / gallivm / lp_bld_debug.cpp
index bb2c82fe0eddb5cb3c67525d223c3b560db1498c..29dfb868d95a521bccb2169100f91cda9c0a42c2 100644 (file)
 #include <llvm/Target/TargetInstrInfo.h>
 #include <llvm/Support/raw_ostream.h>
 #include <llvm/Support/MemoryObject.h>
+
+#if HAVE_LLVM >= 0x0209
+#include <llvm/Support/Host.h>
+#else
 #include <llvm/System/Host.h>
+#endif
 
 #if HAVE_LLVM >= 0x0207
 #include <llvm/MC/MCDisassembler.h>
@@ -203,7 +208,11 @@ lp_disassemble(const void* func)
 
    raw_debug_ostream Out;
 
+#if HAVE_LLVM >= 0x0300
+   unsigned int AsmPrinterVariant = AsmInfo->getAssemblerDialect();
+#else
    int AsmPrinterVariant = AsmInfo->getAssemblerDialect();
+#endif
 #if HAVE_LLVM >= 0x0208
    OwningPtr<MCInstPrinter> Printer(
          T->createMCInstPrinter(AsmPrinterVariant, *AsmInfo));
@@ -216,7 +225,11 @@ lp_disassemble(const void* func)
       return;
    }
 
+#if HAVE_LLVM >= 0x0300
+   TargetMachine *TM = T->createTargetMachine(Triple, sys::getHostCPUName(), "");
+#else
    TargetMachine *TM = T->createTargetMachine(Triple, "");
+#endif
 
    const TargetInstrInfo *TII = TM->getInstrInfo();
 
@@ -276,7 +289,11 @@ lp_disassemble(const void* func)
 
       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.