- Linux
+ - udis86, http://udis86.sourceforge.net/
+
+ git clone git://udis86.git.sourceforge.net/gitroot/udis86
+ cd udis86
+ ./configure --with-pic
+ make
+ sudo make install
+
- LLVM. On Debian based distributions do:
aptitude install llvm-dev
- There is a type in one of the llvm-dev 2.5 headers, that causes compilation
+ There is a typo in one of the llvm-dev 2.5 headers, that causes compilation
errors in the debug build:
--- /usr/include/llvm-c/Core.h.orig 2009-08-10 15:38:54.000000000 +0100
'lp_bld_blend_soa.c',
'lp_bld_const.c',
'lp_bld_conv.c',
+ 'lp_bld_debug.c',
'lp_bld_intr.c',
'lp_bld_pack.c',
'lp_bld_unpack.c',
env = env.Clone()
+env.Prepend(LIBS = 'udis86')
env['LINK'] = env['CXX']
env.ParseConfig('llvm-config --libs jit interpreter nativecodegen bitwriter')
env.Prepend(LIBS = [llvmpipe] + auxiliaries)
--- /dev/null
+/**************************************************************************
+ *
+ * Copyright 2009 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+
+#include <udis86.h>
+
+#include "util/u_debug.h"
+#include "lp_bld_debug.h"
+
+
+void
+lp_disassemble(const void* func)
+{
+ ud_t ud_obj;
+
+ ud_init(&ud_obj);
+
+ ud_set_input_buffer(&ud_obj, (void*)func, 0xffff);
+ ud_set_pc(&ud_obj, (uint64_t) (uintptr_t) func);
+
+#ifdef PIPE_ARCH_X86
+ ud_set_mode(&ud_obj, 32);
+#endif
+#ifdef PIPE_ARCH_X86_64
+ ud_set_mode(&ud_obj, 64);
+#endif
+
+ ud_set_syntax(&ud_obj, UD_SYN_ATT);
+
+ while (ud_disassemble(&ud_obj)) {
+#ifdef PIPE_ARCH_X86
+ debug_printf("%08lx:\t%s\n",
+ (unsigned long)ud_insn_off(&ud_obj),
+ ud_insn_asm(&ud_obj));
+#endif
+#ifdef PIPE_ARCH_X86_64
+ debug_printf("%016llx:\t%s\n",
+ (unsigned long long)ud_insn_off(&ud_obj),
+ ud_insn_asm(&ud_obj));
+#endif
+
+ if (ud_obj.mnemonic == UD_Iret)
+ break;
+ }
+ debug_printf("\n");
+}
--- /dev/null
+/**************************************************************************
+ *
+ * Copyright 2009 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+
+#ifndef LP_BLD_DEBUG_H
+#define LP_BLD_DEBUG_H
+
+
+void
+lp_disassemble(const void* func);
+
+
+#endif /* !LP_BLD_DEBUG_H */
#include "lp_bld_type.h"
#include "lp_bld_arit.h"
#include "lp_bld_blend.h"
+#include "lp_bld_debug.h"
static void
LLVMRunFunctionPassManager(screen->pass, blend->function);
-#if 1
+#ifdef DEBUG
debug_printf("%s=%s %s=%s %s=%s %s=%s %s=%s %s=%s\n",
"rgb_func", debug_dump_blend_func (blend->base.rgb_func, TRUE),
"rgb_src_factor", debug_dump_blend_factor(blend->base.rgb_src_factor, TRUE),
blend->jit_function = (lp_blend_func)LLVMGetPointerToGlobal(screen->engine, blend->function);
+#ifdef DEBUG
+ lp_disassemble(blend->jit_function);
+#endif
+
return blend;
}
#include "tgsi/tgsi_parse.h"
#include "lp_bld_type.h"
#include "lp_bld_tgsi.h"
+#include "lp_bld_debug.h"
#include "lp_screen.h"
#include "lp_context.h"
#include "lp_state.h"
shader->jit_function = (lp_shader_fs_func)LLVMGetPointerToGlobal(screen->engine, shader->function);
+#ifdef DEBUG
+ lp_disassemble(shader->jit_function);
+#endif
+
return shader;
}
#include "lp_bld_type.h"
#include "lp_bld_arit.h"
#include "lp_bld_blend.h"
+#include "lp_bld_debug.h"
#include "lp_test.h"
blend_test_ptr = (blend_test_ptr_t)LLVMGetPointerToGlobal(engine, func);
+ if(verbose >= 2)
+ lp_disassemble(blend_test_ptr);
+
success = TRUE;
for(i = 0; i < n && success; ++i) {
if(mode == AoS) {
#include "lp_bld_type.h"
#include "lp_bld_conv.h"
+#include "lp_bld_debug.h"
#include "lp_test.h"
conv_test_ptr = (conv_test_ptr_t)LLVMGetPointerToGlobal(engine, func);
+ if(verbose >= 2)
+ lp_disassemble(conv_test_ptr);
+
success = TRUE;
for(i = 0; i < n && success; ++i) {
unsigned src_stride = src_type.length*src_type.width/8;
sources += ['xlib_softpipe.c']
drivers += [softpipe]
+ if 'llvmpipe' in env['drivers']:
+ env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE')
+ env.Prepend(LIBS = 'udis86')
+ env.ParseConfig('llvm-config --libs jit interpreter nativecodegen')
+ env['LINK'] = env['CXX']
+ sources += ['xlib_llvmpipe.c']
+ drivers += [llvmpipe]
+
if 'i965simple' in env['drivers']:
env.Append(CPPDEFINES = 'GALLIUM_I965SIMPLE')
sources += [