summaryrefslogtreecommitdiff
path: root/assembler/gram.y
diff options
context:
space:
mode:
authorDamien Lespiau <damien.lespiau@intel.com>2013-01-21 19:28:41 +0000
committerDamien Lespiau <damien.lespiau@intel.com>2013-03-04 15:54:38 +0000
commita45a47183a98e07f7a44330cd68bf65fec8d6dea (patch)
tree7192a15ac245a9d340b429d5efaca1e8d185008b /assembler/gram.y
parent73d58edab9fca04d9b00f9e1a9095bbbb00f25a4 (diff)
assembler: Make explicit that labels are part of the instructions list
The output of the parsing is a list of struct brw_program_instruction. These instructions can be either GEN instructions aka struct brw_instruction or labels. To make this more explicit we now have a type to test to determine which instruction we are dealing with. This will also allow to to pull the relocation bits into struct brw_program_instruction instead of having them in the structure representing the opcodes. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Diffstat (limited to 'assembler/gram.y')
-rw-r--r--assembler/gram.y7
1 files changed, 4 insertions, 3 deletions
diff --git a/assembler/gram.y b/assembler/gram.y
index a1c09f72..cf65f9f5 100644
--- a/assembler/gram.y
+++ b/assembler/gram.y
@@ -119,7 +119,8 @@ static void brw_program_add_instruction(struct brw_program *p,
struct brw_program_instruction *list_entry;
list_entry = calloc(sizeof(struct brw_program_instruction), 1);
- list_entry->instruction = *instruction;
+ list_entry->type = GEN4ASM_INSTRUCTION_GEN;
+ list_entry->instruction.gen = *instruction;
brw_program_append_entry(p, list_entry);
}
@@ -128,8 +129,8 @@ static void brw_program_add_label(struct brw_program *p, const char *label)
struct brw_program_instruction *list_entry;
list_entry = calloc(sizeof(struct brw_program_instruction), 1);
- list_entry->string = strdup(label);
- list_entry->islabel = 1;
+ list_entry->type = GEN4ASM_INSTRUCTION_LABEL;
+ list_entry->instruction.label.name = strdup(label);
brw_program_append_entry(p, list_entry);
}