summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2014-05-08 13:25:28 +0100
committerJosé Fonseca <jfonseca@vmware.com>2014-05-14 11:04:59 +0100
commit9cf67e51b06b4b136d03e642b18b4a4e36a1dabb (patch)
treea79ebd49f932318ed663e6eb59629d780dffeaa4 /src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
parentecef2da0b2035b1043441ffd322802cfa4a9f36f (diff)
downloadexternal_mesa3d-9cf67e51b06b4b136d03e642b18b4a4e36a1dabb.zip
external_mesa3d-9cf67e51b06b4b136d03e642b18b4a4e36a1dabb.tar.gz
external_mesa3d-9cf67e51b06b4b136d03e642b18b4a4e36a1dabb.tar.bz2
gallivm,draw,llvmpipe: Remove support for versions of LLVM prior to 3.1.
Older versions haven't been tested probably don't work anyway. But more importantly, code supporting it is hindering further work. Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Diffstat (limited to 'src/gallium/auxiliary/gallivm/lp_bld_debug.cpp')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_debug.cpp75
1 files changed, 3 insertions, 72 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
index 7e43b51..85953a2 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
@@ -34,28 +34,16 @@
#include <llvm/Support/Format.h>
#include <llvm/Support/MemoryObject.h>
-#if HAVE_LLVM >= 0x0300
#include <llvm/Support/TargetRegistry.h>
#include <llvm/MC/MCSubtargetInfo.h>
-#else /* HAVE_LLVM < 0x0300 */
-#include <llvm/Target/TargetRegistry.h>
-#endif /* HAVE_LLVM < 0x0300 */
-#if HAVE_LLVM >= 0x0209
#include <llvm/Support/Host.h>
-#else /* HAVE_LLVM < 0x0209 */
-#include <llvm/System/Host.h>
-#endif /* HAVE_LLVM < 0x0209 */
-#if HAVE_LLVM >= 0x0207
#include <llvm/MC/MCDisassembler.h>
#include <llvm/MC/MCAsmInfo.h>
#include <llvm/MC/MCInst.h>
#include <llvm/MC/MCInstPrinter.h>
-#endif /* HAVE_LLVM >= 0x0207 */
-#if HAVE_LLVM >= 0x0301
#include <llvm/MC/MCRegisterInfo.h>
-#endif /* HAVE_LLVM >= 0x0301 */
#if HAVE_LLVM >= 0x0303
#include <llvm/ADT/OwningPtr.h>
@@ -104,13 +92,8 @@ public:
void write_impl(const char *Ptr, size_t Size);
-#if HAVE_LLVM >= 0x207
uint64_t current_pos() const { return pos; }
size_t preferred_buffer_size() const { return 512; }
-#else
- uint64_t current_pos() { return pos; }
- size_t preferred_buffer_size() { return 512; }
-#endif
};
@@ -144,7 +127,6 @@ lp_debug_dump_value(LLVMValueRef value)
}
-#if HAVE_LLVM >= 0x0207
/*
* MemoryObject wrapper around a buffer of memory, to be used by MC
* disassembler.
@@ -179,7 +161,6 @@ public:
return 0;
}
};
-#endif /* HAVE_LLVM >= 0x0207 */
/*
@@ -192,7 +173,6 @@ public:
static size_t
disassemble(const void* func, llvm::raw_ostream & Out)
{
-#if HAVE_LLVM >= 0x0207
using namespace llvm;
const uint8_t *bytes = (const uint8_t *)func;
@@ -208,21 +188,15 @@ disassemble(const void* func, llvm::raw_ostream & Out)
* Initialize all used objects.
*/
-#if HAVE_LLVM >= 0x0301
std::string Triple = sys::getDefaultTargetTriple();
-#else
- std::string Triple = sys::getHostTriple();
-#endif
std::string Error;
const Target *T = TargetRegistry::lookupTarget(Triple, Error);
#if HAVE_LLVM >= 0x0304
OwningPtr<const MCAsmInfo> AsmInfo(T->createMCAsmInfo(*T->createMCRegInfo(Triple), Triple));
-#elif HAVE_LLVM >= 0x0300
- OwningPtr<const MCAsmInfo> AsmInfo(T->createMCAsmInfo(Triple));
#else
- OwningPtr<const MCAsmInfo> AsmInfo(T->createAsmInfo(Triple));
+ OwningPtr<const MCAsmInfo> AsmInfo(T->createMCAsmInfo(Triple));
#endif
if (!AsmInfo) {
@@ -230,13 +204,8 @@ disassemble(const void* func, llvm::raw_ostream & Out)
return 0;
}
-#if HAVE_LLVM >= 0x0300
unsigned int AsmPrinterVariant = AsmInfo->getAssemblerDialect();
-#else
- int AsmPrinterVariant = AsmInfo->getAssemblerDialect();
-#endif
-#if HAVE_LLVM >= 0x0301
OwningPtr<const MCRegisterInfo> MRI(T->createMCRegInfo(Triple));
if (!MRI) {
Out << "error: no register info for target " << Triple.c_str() << "\n";
@@ -248,17 +217,14 @@ disassemble(const void* func, llvm::raw_ostream & Out)
Out << "error: no instruction info for target " << Triple.c_str() << "\n";
return 0;
}
-#endif
#if HAVE_LLVM >= 0x0305
OwningPtr<const MCSubtargetInfo> STI(T->createMCSubtargetInfo(Triple, sys::getHostCPUName(), ""));
OwningPtr<MCContext> MCCtx(new MCContext(AsmInfo.get(), MRI.get(), 0));
OwningPtr<const MCDisassembler> DisAsm(T->createMCDisassembler(*STI, *MCCtx));
-#elif HAVE_LLVM >= 0x0300
+#else
OwningPtr<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) {
Out << "error: no disassembler for target " << Triple << "\n";
@@ -266,25 +232,13 @@ disassemble(const void* func, llvm::raw_ostream & Out)
}
-#if HAVE_LLVM >= 0x0301
OwningPtr<MCInstPrinter> Printer(
T->createMCInstPrinter(AsmPrinterVariant, *AsmInfo, *MII, *MRI, *STI));
-#elif HAVE_LLVM == 0x0300
- OwningPtr<MCInstPrinter> Printer(
- T->createMCInstPrinter(AsmPrinterVariant, *AsmInfo, *STI));
-#elif HAVE_LLVM >= 0x0208
- OwningPtr<MCInstPrinter> Printer(
- T->createMCInstPrinter(AsmPrinterVariant, *AsmInfo));
-#else
- OwningPtr<MCInstPrinter> Printer(
- T->createMCInstPrinter(AsmPrinterVariant, *AsmInfo, Out));
-#endif
if (!Printer) {
Out << "error: no instruction printer for target " << Triple.c_str() << "\n";
return 0;
}
-#if HAVE_LLVM >= 0x0301
TargetOptions options;
#if defined(DEBUG)
options.JITEmitDebugInfo = true;
@@ -296,11 +250,6 @@ disassemble(const void* func, llvm::raw_ostream & Out)
options.NoFramePointerElim = true;
#endif
OwningPtr<TargetMachine> TM(T->createTargetMachine(Triple, sys::getHostCPUName(), "", options));
-#elif HAVE_LLVM == 0x0300
- OwningPtr<TargetMachine> TM(T->createTargetMachine(Triple, sys::getHostCPUName(), ""));
-#else
- OwningPtr<TargetMachine> TM(T->createTargetMachine(Triple, ""));
-#endif
const TargetInstrInfo *TII = TM->getInstrInfo();
@@ -324,11 +273,7 @@ disassemble(const void* func, llvm::raw_ostream & Out)
if (!DisAsm->getInstruction(Inst, Size, memoryObject,
pc,
-#if HAVE_LLVM >= 0x0300
nulls(), nulls())) {
-#else
- nulls())) {
-#endif
Out << "invalid";
pc += 1;
}
@@ -350,13 +295,7 @@ disassemble(const void* func, llvm::raw_ostream & Out)
/*
* Print the instruction.
*/
-#if HAVE_LLVM >= 0x0300
- Printer->printInst(&Inst, Out, "");
-#elif HAVE_LLVM >= 0x208
- Printer->printInst(&Inst, Out);
-#else
- Printer->printInst(&Inst);
-#endif
+ Printer->printInst(&Inst, Out, "");
/*
* Advance.
@@ -364,11 +303,7 @@ disassemble(const void* func, llvm::raw_ostream & Out)
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.
@@ -445,10 +380,6 @@ disassemble(const void* func, llvm::raw_ostream & Out)
Out.flush();
return pc;
-#else /* HAVE_LLVM < 0x0207 */
- (void)func;
- return 0;
-#endif /* HAVE_LLVM < 0x0207 */
}