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>
This commit is contained in:
Damien Lespiau
2013-01-24 16:16:35 +00:00
parent 5e0da9f854
commit 9fcc1bdcad
3 changed files with 91 additions and 94 deletions
+11
View File
@@ -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], "-"))