extern "C" const unsigned * brw_gs_emit(struct brw_context *brw, struct gl_shader_program *prog, struct brw_gs_compile *c, void *mem_ctx, unsigned *final_assembly_size) { if (unlikely(INTEL_DEBUG & DEBUG_GS)) { struct brw_shader *shader = (brw_shader *) prog->_LinkedShaders[MESA_SHADER_GEOMETRY]; brw_dump_ir(brw, "geometry", prog, &shader->base, NULL); } /* Compile the geometry shader in DUAL_OBJECT dispatch mode, if we can do * so without spilling. If the GS invocations count > 1, then we can't use * dual object mode. */ if (c->prog_data.invocations <= 1 && likely(!(INTEL_DEBUG & DEBUG_NO_DUAL_OBJECT_GS))) { c->prog_data.dual_instanced_dispatch = false; vec4_gs_visitor v(brw, c, prog, mem_ctx, true /* no_spills */); if (v.run()) { return generate_assembly(brw, prog, &c->gp->program.Base, &c->prog_data.base, mem_ctx, v.cfg, final_assembly_size); } } /* Either we failed to compile in DUAL_OBJECT mode (probably because it * would have required spilling) or DUAL_OBJECT mode is disabled. So fall * back to DUAL_INSTANCED mode, which consumes fewer registers. * * FIXME: In an ideal world we'd fall back to SINGLE mode, which would * allow us to interleave general purpose registers (resulting in even less * likelihood of spilling). But at the moment, the vec4 generator and * visitor classes don't have the infrastructure to interleave general * purpose registers, so DUAL_INSTANCED is the best we can do. */ c->prog_data.dual_instanced_dispatch = true; vec4_gs_visitor v(brw, c, prog, mem_ctx, false /* no_spills */); if (!v.run()) { prog->LinkStatus = false; ralloc_strcat(&prog->InfoLog, v.fail_msg); return NULL; } return generate_assembly(brw, prog, &c->gp->program.Base, &c->prog_data.base, mem_ctx, v.cfg, final_assembly_size); }
int main(int argc, char *argv[]) { if (argc < 3) { usage(); goto exit_failure; } vita_imports_t *imports = vita_imports_load(argv[1], 1); if (imports == NULL) { goto exit_failure; } if (chdir(argv[2])) { perror(argv[2]); goto exit_failure; } if (!generate_assembly(imports)) { fprintf(stderr, "Error generating the assembly file\n"); goto exit_failure; } if (!generate_makefile(imports)) { fprintf(stderr, "Error generating the assembly makefile\n"); goto exit_failure; } vita_imports_free(imports); return EXIT_SUCCESS; exit_failure: return EXIT_FAILURE; }
int main() { FILE *ys = fopen("./sample.ys", "w"); int noRoot = 0; /* 0 means we will have a root */ symboltable_t *symtab; list = NULL; /* Build the tree */ error_out = stderr; noRoot = yyparse(); if (parseError && (!noRoot)) fprintf(stderr, "WARNING: There were %d parse errors.\nParse tree may be ill-formed.\n", parseError); if (noRoot) fprintf(stderr, "Parsing reached fatal error. No AST was constructed\n"); /* Set up the symbol tree */ symtab = create_symboltable(); symtab = build_symboltable(symtab, root, root); typecheck_ast(symtab, root); int retval = typecheck_ast(symtab, root); print_checked_ast(stdout, root, 0); if (retval != 0) { fprintf(stderr, "There were %d errors encountered in the parse tree. Aborting.\n", retval); return 1; } print_ast(stdout, root, 0); print_symtab(symtab); code_gen(root, symtab); print_symtab(symtab); print_quad_list(stdout, list); generate_assembly(ys, list, symtab); return 0; }
int main(int argc, char *argv[]) { if (argc < 3) { usage(); goto exit_failure; } int imports_count = argc - 2; vita_imports_t **imports = malloc(sizeof(vita_imports_t*) * imports_count); int i; for (i = 0; i < imports_count; i++) { vita_imports_t *imp = vita_imports_load(argv[i + 1], 1); if (imp == NULL) { goto exit_failure; } imports[i] = imp; } #if defined(_WIN32) && !defined(__CYGWIN__) mkdir(argv[argc - 1]); #else mkdir(argv[argc - 1], 0777); // create directory if it doesn't exist #endif if (chdir(argv[argc - 1])) { perror(argv[argc - 1]); goto exit_failure; } if (!generate_assembly(imports, imports_count)) { fprintf(stderr, "Error generating the assembly file\n"); goto exit_failure; } if (!generate_makefile(imports, imports_count)) { fprintf(stderr, "Error generating the assembly makefile\n"); goto exit_failure; } for (i = 0; i < imports_count; i++) { vita_imports_free(imports[i]); } free(imports); return EXIT_SUCCESS; exit_failure: return EXIT_FAILURE; }