/* brw_eu_compact.c */
void brw_init_compaction_tables(struct brw_context *brw);
-void brw_compact_instructions(struct brw_compile *p);
+void brw_compact_instructions(struct brw_compile *p, int start_offset);
void brw_uncompact_instruction(struct brw_context *brw,
struct brw_instruction *dst,
struct brw_compact_instruction *src);
}
void
-brw_compact_instructions(struct brw_compile *p)
+brw_compact_instructions(struct brw_compile *p, int start_offset)
{
struct brw_context *brw = p->brw;
- void *store = p->store;
+ void *store = p->store + start_offset / 16;
/* For an instruction at byte offset 8*i before compaction, this is the number
* of compacted instructions that preceded it.
*/
- int compacted_counts[p->next_insn_offset / 8];
+ int compacted_counts[(p->next_insn_offset - start_offset) / 8];
/* For an instruction at byte offset 8*i after compaction, this is the
* 8-byte offset it was at before compaction.
*/
- int old_ip[p->next_insn_offset / 8];
+ int old_ip[(p->next_insn_offset - start_offset) / 8];
if (brw->gen < 6)
return;
int src_offset;
int offset = 0;
int compacted_count = 0;
- for (src_offset = 0; src_offset < p->nr_insn * 16;) {
+ for (src_offset = 0; src_offset < p->next_insn_offset - start_offset;) {
struct brw_instruction *src = store + src_offset;
void *dst = store + offset;
}
/* Fix up control flow offsets. */
- p->next_insn_offset = offset;
- for (offset = 0; offset < p->next_insn_offset;) {
+ p->next_insn_offset = start_offset + offset;
+ for (offset = 0; offset < p->next_insn_offset - start_offset;) {
struct brw_instruction *insn = store + offset;
int this_old_ip = old_ip[offset / 8];
int this_compacted_count = compacted_counts[this_old_ip];
if (0) {
fprintf(stderr, "dumping compacted program\n");
- brw_disassemble(brw, p->store, 0, p->next_insn_offset, stderr);
+ brw_disassemble(brw, store, 0, p->next_insn_offset - start_offset, stderr);
int cmp = 0;
- for (offset = 0; offset < p->next_insn_offset;) {
+ for (offset = 0; offset < p->next_insn_offset - start_offset;) {
struct brw_instruction *insn = store + offset;
if (insn->header.cmpt_control) {
if (simd8_instructions) {
dispatch_width = 8;
generate_code(simd8_instructions, dump_file);
- brw_compact_instructions(p);
+ brw_compact_instructions(p, 0);
}
if (simd16_instructions) {
dispatch_width = 16;
generate_code(simd16_instructions, dump_file);
- brw_compact_instructions(p);
+ brw_compact_instructions(p, prog_data->prog_offset_16);
}
return brw_get_program(p, assembly_size);