assembler: Renamed the instruction field to insn

This will be less typing for the refactoring to come (which is use
struct brw_program_instruction in gram.y for the type of all the
instructions).

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
This commit is contained in:
Damien Lespiau 2013-01-30 12:31:45 +00:00
parent 888b2dcae6
commit d008064b3e
4 changed files with 13 additions and 13 deletions

View File

@ -51,7 +51,7 @@ read_program (FILE *input)
++n;
if (n == 4) {
entry = malloc (sizeof (struct brw_program_instruction));
memcpy (&entry->instruction, inst, 4 * sizeof (uint32_t));
memcpy (&entry->insn, inst, 4 * sizeof (uint32_t));
entry->next = NULL;
*prev = entry;
prev = &entry->next;
@ -82,7 +82,7 @@ read_program_binary (FILE *input)
inst[n++] = (uint8_t)temp;
if (n == 16) {
entry = malloc (sizeof (struct brw_program_instruction));
memcpy (&entry->instruction, inst, 16 * sizeof (uint8_t));
memcpy (&entry->insn, inst, 16 * sizeof (uint8_t));
entry->next = NULL;
*prev = entry;
prev = &entry->next;
@ -167,6 +167,6 @@ int main(int argc, char **argv)
}
for (inst = program->first; inst; inst = inst->next)
brw_disasm (output, &inst->instruction.gen, gen);
brw_disasm (output, &inst->insn.gen, gen);
exit (0);
}

View File

@ -143,7 +143,7 @@ struct brw_program_instruction {
struct brw_instruction gen;
struct relocatable_instruction reloc;
struct label_instruction label;
} instruction;
} insn;
struct brw_program_instruction *next;
};
@ -155,7 +155,7 @@ static inline bool is_label(struct brw_program_instruction *instruction)
static inline char *label_name(struct brw_program_instruction *i)
{
assert(is_label(i));
return i->instruction.label.name;
return i->insn.label.name;
}
static inline bool is_relocatable(struct brw_program_instruction *intruction)

View File

@ -201,7 +201,7 @@ static void brw_program_add_instruction(struct brw_program *p,
list_entry = calloc(sizeof(struct brw_program_instruction), 1);
list_entry->type = GEN4ASM_INSTRUCTION_GEN;
list_entry->instruction.gen = *instruction;
list_entry->insn.gen = *instruction;
brw_program_append_entry(p, list_entry);
}
@ -212,7 +212,7 @@ static void brw_program_add_relocatable(struct brw_program *p,
list_entry = calloc(sizeof(struct brw_program_instruction), 1);
list_entry->type = GEN4ASM_INSTRUCTION_GEN_RELOCATABLE;
list_entry->instruction.reloc = *reloc;
list_entry->insn.reloc = *reloc;
brw_program_append_entry(p, list_entry);
}
@ -222,7 +222,7 @@ static void brw_program_add_label(struct brw_program *p, const char *label)
list_entry = calloc(sizeof(struct brw_program_instruction), 1);
list_entry->type = GEN4ASM_INSTRUCTION_LABEL;
list_entry->instruction.label.name = strdup(label);
list_entry->insn.label.name = strdup(label);
brw_program_append_entry(p, list_entry);
}

View File

@ -237,7 +237,7 @@ static int is_entry_point(struct brw_program_instruction *i)
assert(i->type == GEN4ASM_INSTRUCTION_LABEL);
for (p = entry_point_table; p; p = p->next) {
if (strcmp(p->str, i->instruction.label.name) == 0)
if (strcmp(p->str, i->insn.label.name) == 0)
return 1;
}
return 0;
@ -406,7 +406,7 @@ int main(int argc, char **argv)
// insert NOP instructions until (inst_offset+1) % 4 == 0
while (((inst_offset+1) % 4) != 0) {
tmp_entry = calloc(sizeof(*tmp_entry), 1);
tmp_entry->instruction.gen.header.opcode = BRW_OPCODE_NOP;
tmp_entry->insn.gen.header.opcode = BRW_OPCODE_NOP;
entry->next = tmp_entry;
tmp_entry->next = entry1;
entry = tmp_entry;
@ -437,7 +437,7 @@ int main(int argc, char **argv)
}
for (entry = compiled_program.first; entry; entry = entry->next) {
struct relocatable_instruction *reloc = &entry->instruction.reloc;
struct relocatable_instruction *reloc = &entry->insn.reloc;
struct brw_instruction *inst = &reloc->gen;
if (!is_relocatable(entry))
@ -497,9 +497,9 @@ int main(int argc, char **argv)
entry = entry1) {
entry1 = entry->next;
if (!is_label(entry))
print_instruction(output, &entry->instruction.gen);
print_instruction(output, &entry->insn.gen);
else
free(entry->instruction.label.name);
free(entry->insn.label.name);
free(entry);
}
if (binary_like_output)