This helped me resolve a bug, so I suppose it's useful in general.
Signed-off-by: Vegard Nossum <[email protected]>
---
jit/trace-jit.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 50 insertions(+), 5 deletions(-)
diff --git a/jit/trace-jit.c b/jit/trace-jit.c
index 37fe6d4..ccd434a 100644
--- a/jit/trace-jit.c
+++ b/jit/trace-jit.c
@@ -17,14 +17,14 @@
#include "jit/statement.h"
#include "jit/vars.h"
#include "jit/args.h"
-#include "vm/preload.h"
-#include "vm/object.h"
-#include "vm/bytecodes.h"
-
#include "lib/buffer.h"
+#include "lib/bitset.h"
+#include "lib/string.h"
+#include "vm/bytecodes.h"
#include "vm/class.h"
#include "vm/method.h"
-#include "lib/string.h"
+#include "vm/object.h"
+#include "vm/preload.h"
#include "vm/vm.h"
#include "arch/stack-frame.h"
@@ -197,6 +197,7 @@ void trace_lir(struct compilation_unit *cu)
printf("--------- ------- ----------- --------\n");
for_each_basic_block(bb, &cu->bb_list) {
+ printf("[bb %p]:\n", bb);
for_each_insn(insn, &bb->insn_list) {
str = alloc_str();
lir_print(insn, str);
@@ -257,6 +258,46 @@ print_var_liveness(struct compilation_unit *cu, struct
var_info *var)
printf(" (empty)\n");
}
+static void print_bb_live_sets(struct basic_block *bb)
+{
+ printf("[bb %p]\n", bb);
+
+ printf(" ");
+ for (unsigned int i = 0; i < bb->live_in_set->nr_bits; ++i)
+ printf("%-3d", i);
+ printf("\n");
+
+ printf("live in: ");
+ for (unsigned long i = 0; i < bb->live_in_set->nr_bits; ++i) {
+ printf("%s", test_bit(bb->live_in_set->bits, i)
+ ? "***" : "---");
+ }
+ printf("\n");
+
+ printf("uses: ");
+ for (unsigned long i = 0; i < bb->use_set->nr_bits; ++i) {
+ printf("%s", test_bit(bb->use_set->bits, i)
+ ? "***" : "---");
+ }
+ printf("\n");
+
+ printf("defines: ");
+ for (unsigned long i = 0; i < bb->def_set->nr_bits; ++i) {
+ printf("%s", test_bit(bb->def_set->bits, i)
+ ? "***" : "---");
+ }
+ printf("\n");
+
+ printf("live out: ");
+ for (unsigned long i = 0; i < bb->live_out_set->nr_bits; ++i) {
+ printf("%s", test_bit(bb->live_out_set->bits, i)
+ ? "***" : "---");
+ }
+ printf("\n");
+
+ printf("\n");
+}
+
void trace_liveness(struct compilation_unit *cu)
{
struct basic_block *bb;
@@ -281,6 +322,10 @@ void trace_liveness(struct compilation_unit *cu)
print_var_liveness(cu, var);
printf("\n");
+
+ for_each_basic_block(bb, &cu->bb_list)
+ print_bb_live_sets(bb);
+ printf("\n");
}
void trace_regalloc(struct compilation_unit *cu)
--
1.6.0.6
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Jatovm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jatovm-devel