summaryrefslogtreecommitdiff
path: root/assembler/main.c
diff options
context:
space:
mode:
authorDamien Lespiau <damien.lespiau@intel.com>2013-01-21 21:41:36 +0000
committerDamien Lespiau <damien.lespiau@intel.com>2013-03-04 15:54:38 +0000
commit79c62f1134b2200fc49c43178d846ecba8e37a7b (patch)
tree28ee6205be144c8daefebcfeff02cee05fc1931d /assembler/main.c
parenta45a47183a98e07f7a44330cd68bf65fec8d6dea (diff)
assembler: Don't change the size of opcodes!
Until now, the assembler had relocation-related fields added to struct brw_instruction. This changes the size of the structure and break code assuming the opcode structure is really 16 bytes, for instance the emission code in brw_eu_emit.c. With this commit, we build on the infrastructure that slowly emerged in the few previous commits to add a relocatable instruction with the needed fields. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Diffstat (limited to 'assembler/main.c')
-rw-r--r--assembler/main.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/assembler/main.c b/assembler/main.c
index eb752308..85f07905 100644
--- a/assembler/main.c
+++ b/assembler/main.c
@@ -421,24 +421,25 @@ int main(int argc, char **argv)
}
for (entry = compiled_program.first; entry; entry = entry->next) {
- struct brw_instruction *inst = & entry->instruction.gen;
+ struct relocatable_instruction *reloc = &entry->instruction.reloc;
+ struct brw_instruction *inst = &reloc->gen;
- if (is_label(entry))
+ if (!is_relocatable(entry))
continue;
- if (inst->first_reloc_target)
- inst->first_reloc_offset = label_to_addr(inst->first_reloc_target, entry->inst_offset) - entry->inst_offset;
+ if (reloc->first_reloc_target)
+ reloc->first_reloc_offset = label_to_addr(reloc->first_reloc_target, entry->inst_offset) - entry->inst_offset;
- if (inst->second_reloc_target)
- inst->second_reloc_offset = label_to_addr(inst->second_reloc_target, entry->inst_offset) - entry->inst_offset;
+ if (reloc->second_reloc_target)
+ reloc->second_reloc_offset = label_to_addr(reloc->second_reloc_target, entry->inst_offset) - entry->inst_offset;
- if (inst->second_reloc_offset) {
+ if (reloc->second_reloc_offset) {
// this is a branch instruction with two offset arguments
- inst->bits3.break_cont.jip = jump_distance(inst->first_reloc_offset);
- inst->bits3.break_cont.uip = jump_distance(inst->second_reloc_offset);
- } else if (inst->first_reloc_offset) {
+ inst->bits3.break_cont.jip = jump_distance(reloc->first_reloc_offset);
+ inst->bits3.break_cont.uip = jump_distance(reloc->second_reloc_offset);
+ } else if (reloc->first_reloc_offset) {
// this is a branch instruction with one offset argument
- int offset = inst->first_reloc_offset;
+ int offset = reloc->first_reloc_offset;
/* bspec: Unlike other flow control instructions, the offset used by JMPI is relative to the incremented instruction pointer rather than the IP value for the instruction itself. */
int is_jmpi = inst->header.opcode == BRW_OPCODE_JMPI; // target relative to the post-incremented IP, so delta == 1 if JMPI