From f23d1160c24e16ced319d838ed3102b731c2ff03 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Wed, 16 Apr 2014 03:46:20 +0200 Subject: [PATCH] gallivm: fix compilation with llvm 3.5 r206241+ Just adjust to the ever-changing API, pass in MCContext when creating the MCDisassembler. Reviewed-by: Tom Stellard --- .../auxiliary/gallivm/lp_bld_debug.cpp | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp index 1c886eaf1da..541cf9ec2d3 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp @@ -60,6 +60,10 @@ #include #endif +#if HAVE_LLVM >= 0x0305 +#include +#endif + #include "util/u_math.h" #include "util/u_debug.h" @@ -225,17 +229,6 @@ disassemble(const void* func, llvm::raw_ostream & Out) return 0; } -#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) { - Out << "error: no disassembler for target " << Triple << "\n"; - return 0; - } - #if HAVE_LLVM >= 0x0300 unsigned int AsmPrinterVariant = AsmInfo->getAssemblerDialect(); #else @@ -256,6 +249,22 @@ disassemble(const void* func, llvm::raw_ostream & Out) } #endif +#if HAVE_LLVM >= 0x0305 + OwningPtr STI(T->createMCSubtargetInfo(Triple, sys::getHostCPUName(), "")); + OwningPtr MCCtx(new MCContext(AsmInfo.get(), MRI.get(), 0)); + OwningPtr DisAsm(T->createMCDisassembler(*STI, *MCCtx)); +#elif HAVE_LLVM >= 0x0300 + const MCSubtargetInfo *STI = T->createMCSubtargetInfo(Triple, sys::getHostCPUName(), ""); + OwningPtr DisAsm(T->createMCDisassembler(*STI)); +#else + OwningPtr DisAsm(T->createMCDisassembler()); +#endif + if (!DisAsm) { + Out << "error: no disassembler for target " << Triple << "\n"; + return 0; + } + + #if HAVE_LLVM >= 0x0301 OwningPtr Printer( T->createMCInstPrinter(AsmPrinterVariant, *AsmInfo, *MII, *MRI, *STI)); -- 2.30.2