summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/llvmpipe/lp_bld_debug.c
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2009-09-09 19:21:22 +0100
committerJosé Fonseca <jfonseca@vmware.com>2009-09-09 21:48:49 +0100
commit01c831576eb77ec87bff667ed5591a93cbbef97d (patch)
tree295cb825c9c67e2f7f0196cf68291fa9f34d5297 /src/gallium/drivers/llvmpipe/lp_bld_debug.c
parent5604b27b9326ac542069a49ed9650c4b0d3e939a (diff)
llvmpipe: Debug function to check stack alignment.
Doing alignment check in locus is redundant, as gcc alignment assumptions will optimize away the check.
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_bld_debug.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_debug.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_debug.c b/src/gallium/drivers/llvmpipe/lp_bld_debug.c
index 30925b5f41..59d8f492e6 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_debug.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_debug.c
@@ -30,10 +30,27 @@
#include <udis86.h>
#endif
+#include "util/u_math.h"
#include "util/u_debug.h"
#include "lp_bld_debug.h"
+/**
+ * Check alignment.
+ *
+ * It is important that this check is not implemented as a macro or inlined
+ * function, as the compiler assumptions in respect to alignment of global
+ * and stack variables would often make the check a no op, defeating the
+ * whole purpose of the exercise.
+ */
+boolean
+lp_check_alignment(const void *ptr, unsigned alignment)
+{
+ assert(util_is_pot(alignment));
+ return ((uintptr_t)ptr & (alignment - 1)) == 0;
+}
+
+
void
lp_disassemble(const void* func)
{