}
}
-static void
+static bool
print_compact_branch_writeout_field(uint16_t word)
{
midgard_jmp_writeout_op op = word & 0x7;
+ midg_stats.instruction_count++;
switch (op) {
case midgard_jmp_writeout_op_branch_uncond: {
print_tag_short(br_uncond.dest_tag);
printf("\n");
- break;
+ return br_uncond.offset >= 0;
}
case midgard_jmp_writeout_op_branch_cond:
print_tag_short(br_cond.dest_tag);
printf("\n");
- break;
+ return br_cond.offset >= 0;
}
}
- midg_stats.instruction_count++;
+ return false;
}
-static void
+static bool
print_extended_branch_writeout_field(uint8_t *words, unsigned next)
{
midgard_branch_extended br;
midg_tags[I] = br.dest_tag;
midg_stats.instruction_count++;
+ return br.offset >= 0;
}
static unsigned
return v.f;
}
-static void
+static bool
print_alu_word(uint32_t *words, unsigned num_quad_words,
unsigned tabs, unsigned next)
{
unsigned num_fields = num_alu_fields_enabled(control_word);
uint16_t *word_ptr = beginning_ptr + num_fields;
unsigned num_words = 2 + num_fields;
+ bool branch_forward = false;
if ((control_word >> 16) & 1)
printf("unknown bit 16 enabled\n");
}
if ((control_word >> 26) & 1) {
- print_compact_branch_writeout_field(*word_ptr);
+ branch_forward |= print_compact_branch_writeout_field(*word_ptr);
word_ptr += 1;
num_words += 1;
}
if ((control_word >> 27) & 1) {
- print_extended_branch_writeout_field((uint8_t *) word_ptr, next);
+ branch_forward |= print_extended_branch_writeout_field((uint8_t *) word_ptr, next);
word_ptr += 3;
num_words += 3;
}
}
}
+
+ return branch_forward;
}
static void
uint32_t *words = (uint32_t *) code;
unsigned num_words = size / 4;
int tabs = 0;
- num_words = MIN2(num_words, 100);
- bool prefetch_flag = false;
+ bool branch_forward = false;
int last_next_tag = -1;
break;
case midgard_word_type_alu:
- print_alu_word(&words[i], num_quad_words, tabs, i + 4*num_quad_words);
+ branch_forward = print_alu_word(&words[i], num_quad_words, tabs, i + 4*num_quad_words);
/* Reset word static analysis state */
is_embedded_constant_half = false;
midg_stats.bundle_count++;
midg_stats.quadword_count += num_quad_words;
- if (prefetch_flag && midgard_word_types[tag] == midgard_word_type_alu)
- break;
-
printf("\n");
unsigned next = (words[i] & 0xF0) >> 4;
- /* Break based on instruction prefetch flag */
-
-#if 0
- if (i < num_words && next == 1) {
- prefetch_flag = true;
-
- if (midgard_word_types[words[i] & 0xF] != midgard_word_type_alu)
- break;
- }
-#endif
+ if (i < num_words && next == 1 && !branch_forward)
+ break;
i += 4 * num_quad_words;
}