--- src/gallium/auxiliary/gallivm/lp_bld_debug.cpp	2012-03-21 11:54:27.000000000 -0400
+++ src/gallium/auxiliary/gallivm/lp_bld_debug.cpp.mod	2012-05-25 22:13:11.808747221 -0400
@@ -54,6 +54,10 @@
 #include <llvm/MC/MCInstPrinter.h>
 #endif /* HAVE_LLVM >= 0x0207 */
 
+#if HAVE_LLVM >= 0x0301
+#include <llvm/MC/MCRegisterInfo.h>
+#endif /* HAVE_LLVM >= 0x0301 */
+
 #include "util/u_math.h"
 #include "util/u_debug.h"
 
@@ -235,7 +239,23 @@ lp_disassemble(const void* func)
    int AsmPrinterVariant = AsmInfo->getAssemblerDialect();
 #endif
 
-#if HAVE_LLVM >= 0x0300
+#if HAVE_LLVM >= 0x0301
+	OwningPtr<const MCRegisterInfo> MRI(T->createMCRegInfo(Triple));
+	if (!MRI) {
+		debug_printf("error: no register info for target %s\n", Triple.c_str());
+		return;
+	}
+	OwningPtr<const MCInstrInfo> MII(T->createMCInstrInfo());
+	if (!MII) {
+		debug_printf("error: no instruction info for target %s\n", Triple.c_str());
+		return;
+	}
+#endif
+
+#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

--- src/gallium/auxiliary/gallivm/lp_bld_misc.cpp	2012-03-21 11:54:27.000000000 -0400
+++ src/gallium/auxiliary/gallivm/lp_bld_misc.cpp.mod	2012-05-25 22:08:02.150281687 -0400
@@ -62,7 +62,11 @@
 extern "C" void
 lp_register_oprofile_jit_event_listener(LLVMExecutionEngineRef EE)
 {
-   llvm::unwrap(EE)->RegisterJITEventListener(llvm::createOProfileJITEventListener());
+	#if HAVE_LLVM >= 0x0301
+		llvm::unwrap(EE)->RegisterJITEventListener(llvm::JITEventListener::createOProfileJITEventListener());
+	#else
+		llvm::unwrap(EE)->RegisterJITEventListener(llvm::createOProfileJITEventListener());
+	#endif
 }
 
 
