diff options
author | Damien Lespiau <damien.lespiau@intel.com> | 2013-01-24 16:16:35 +0000 |
---|---|---|
committer | Damien Lespiau <damien.lespiau@intel.com> | 2013-03-04 15:54:39 +0000 |
commit | 9fcc1bdcad1a993d4681673d96443991d0c3bac4 (patch) | |
tree | 72d9409e9961e6dc7ae8793491fdf0df3bb9b01b /assembler/main.c | |
parent | 5e0da9f854fea552cbc73f07a2e86a370f35aa92 (diff) |
assembler: Use brw_set_dest() to encode the destination
A few notes:
I needed to introduce a brw context and compile structs. These are only
used to get which generation we are compiling code for, but eventually
we can use more of the infrastructure.
brw_set_dest() uses the destination register width to program the
instruction execution size.
The assembler can either take subnr in bytes or in number of elements,
so we need a resolve step when setting a brw_reg.
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Diffstat (limited to 'assembler/main.c')
-rw-r--r-- | assembler/main.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/assembler/main.c b/assembler/main.c index 176835b7..cfee749a 100644 --- a/assembler/main.c +++ b/assembler/main.c @@ -33,7 +33,9 @@ #include <unistd.h> #include <assert.h> +#include "ralloc.h" #include "gen4asm.h" +#include "brw_eu.h" extern FILE *yyin; @@ -48,6 +50,9 @@ char *export_filename = NULL; const char const *binary_prepend = "static const char gen_eu_bytes[] = {\n"; +struct brw_context genasm_brw_context; +struct brw_compile genasm_compile; + struct brw_program compiled_program; struct program_defaults program_defaults = {.register_type = BRW_REGISTER_TYPE_F}; @@ -286,6 +291,8 @@ int main(int argc, char **argv) struct brw_program_instruction *entry, *entry1, *tmp_entry; int err, inst_offset; char o; + void *mem_ctx; + while ((o = getopt_long(argc, argv, "e:l:o:g:ab", longopts, NULL)) != -1) { switch (o) { case 'o': @@ -358,6 +365,10 @@ int main(int argc, char **argv) } } + brw_init_context(&genasm_brw_context, gen_level); + mem_ctx = ralloc_context(NULL); + brw_init_compile(&genasm_brw_context, &genasm_compile, mem_ctx); + err = yyparse(); if (strcmp(argv[0], "-")) |