From 9fcc1bdcad1a993d4681673d96443991d0c3bac4 Mon Sep 17 00:00:00 2001 From: Damien Lespiau Date: Thu, 24 Jan 2013 16:16:35 +0000 Subject: 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 --- assembler/main.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'assembler/main.c') 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 #include +#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], "-")) -- cgit v1.2.3