#include "util/ralloc.h"
#include "brw_blorp_blit_eu.h"
#include "brw_blorp.h"
+#include "brw_cfg.h"
brw_blorp_eu_emitter::brw_blorp_eu_emitter(struct brw_context *brw,
bool debug_flag)
const unsigned *
brw_blorp_eu_emitter::get_program(unsigned *program_size)
{
- return generator.generate_assembly(NULL, &insts, program_size);
+ cfg_t cfg(&insts);
+ return generator.generate_assembly(NULL, &cfg, program_size);
}
/**
*/
assert(sanity_param_count == fp->Base.Parameters->NumParameters);
+ calculate_cfg();
+
return !failed;
}
return NULL;
}
- exec_list *simd16_instructions = NULL;
+ cfg_t *simd16_cfg = NULL;
fs_visitor v2(brw, mem_ctx, key, prog_data, prog, fp, 16);
if (brw->gen >= 5 && likely(!(INTEL_DEBUG & DEBUG_NO16))) {
if (!v.simd16_unsupported) {
perf_debug("SIMD16 shader failed to compile, falling back to "
"SIMD8 at a 10-20%% performance cost: %s", v2.fail_msg);
} else {
- simd16_instructions = &v2.instructions;
+ simd16_cfg = v2.cfg;
}
} else {
perf_debug("SIMD16 shader unsupported, falling back to "
}
}
- exec_list *simd8_instructions;
+ cfg_t *simd8_cfg;
int no_simd8 = (INTEL_DEBUG & DEBUG_NO8) || brw->no_simd8;
- if (no_simd8 && simd16_instructions) {
- simd8_instructions = NULL;
+ if (no_simd8 && simd16_cfg) {
+ simd8_cfg = NULL;
prog_data->no_8 = true;
} else {
- simd8_instructions = &v.instructions;
+ simd8_cfg = v.cfg;
prog_data->no_8 = false;
}
const unsigned *assembly = NULL;
fs_generator g(brw, mem_ctx, key, prog_data, prog, fp,
v.runtime_check_aads_emit, INTEL_DEBUG & DEBUG_WM);
- assembly = g.generate_assembly(simd8_instructions, simd16_instructions,
+ assembly = g.generate_assembly(simd8_cfg, simd16_cfg,
final_assembly_size);
if (unlikely(brw->perf_debug) && shader) {
bool debug_flag);
~fs_generator();
- const unsigned *generate_assembly(exec_list *simd8_instructions,
- exec_list *simd16_instructions,
+ const unsigned *generate_assembly(const cfg_t *simd8_cfg,
+ const cfg_t *simd16_cfg,
unsigned *assembly_size);
private:
- void generate_code(exec_list *instructions);
+ void generate_code(const cfg_t *cfg);
void fire_fb_write(fs_inst *inst,
GLuint base_reg,
struct brw_reg implied_header,
}
void
-fs_generator::generate_code(exec_list *instructions)
+fs_generator::generate_code(const cfg_t *cfg)
{
int start_offset = p->next_insn_offset;
struct annotation_info annotation;
memset(&annotation, 0, sizeof(annotation));
- cfg_t *cfg = NULL;
- if (unlikely(debug_flag))
- cfg = new(mem_ctx) cfg_t(instructions);
-
- foreach_in_list(fs_inst, inst, instructions) {
+ foreach_block_and_inst (block, fs_inst, inst, cfg) {
struct brw_reg src[3], dst;
unsigned int last_insn_offset = p->next_insn_offset;
}
const unsigned *
-fs_generator::generate_assembly(exec_list *simd8_instructions,
- exec_list *simd16_instructions,
+fs_generator::generate_assembly(const cfg_t *simd8_cfg,
+ const cfg_t *simd16_cfg,
unsigned *assembly_size)
{
- assert(simd8_instructions || simd16_instructions);
+ assert(simd8_cfg || simd16_cfg);
- if (simd8_instructions) {
+ if (simd8_cfg) {
dispatch_width = 8;
- generate_code(simd8_instructions);
+ generate_code(simd8_cfg);
}
- if (simd16_instructions) {
+ if (simd16_cfg) {
/* align to 64 byte boundary. */
while (p->next_insn_offset % 64) {
brw_NOP(p);
brw_set_default_compression_control(p, BRW_COMPRESSION_COMPRESSED);
dispatch_width = 16;
- generate_code(simd16_instructions);
+ generate_code(simd16_cfg);
}
return brw_get_program(p, assembly_size);
*/
assert(sanity_param_count == prog->Parameters->NumParameters);
+ calculate_cfg();
+
return !failed;
}
const unsigned *assembly = NULL;
vec4_generator g(brw, prog, &c->vp->program.Base, &prog_data->base,
mem_ctx, INTEL_DEBUG & DEBUG_VS);
- assembly = g.generate_assembly(&v.instructions, final_assembly_size);
+ assembly = g.generate_assembly(v.cfg, final_assembly_size);
if (unlikely(brw->perf_debug) && shader) {
if (shader->compiled_once) {
bool debug_flag);
~vec4_generator();
- const unsigned *generate_assembly(exec_list *insts, unsigned *asm_size);
+ const unsigned *generate_assembly(const cfg_t *cfg, unsigned *asm_size);
private:
- void generate_code(exec_list *instructions);
+ void generate_code(const cfg_t *cfg);
void generate_vec4_instruction(vec4_instruction *inst,
struct brw_reg dst,
struct brw_reg *src);
}
void
-vec4_generator::generate_code(exec_list *instructions)
+vec4_generator::generate_code(const cfg_t *cfg)
{
struct annotation_info annotation;
memset(&annotation, 0, sizeof(annotation));
- cfg_t *cfg = NULL;
- if (unlikely(debug_flag))
- cfg = new(mem_ctx) cfg_t(instructions);
-
- foreach_in_list(vec4_instruction, inst, instructions) {
+ foreach_block_and_inst (block, vec4_instruction, inst, cfg) {
struct brw_reg src[3], dst;
if (unlikely(debug_flag))
}
const unsigned *
-vec4_generator::generate_assembly(exec_list *instructions,
+vec4_generator::generate_assembly(const cfg_t *cfg,
unsigned *assembly_size)
{
brw_set_default_access_mode(p, BRW_ALIGN_16);
- generate_code(instructions);
+ generate_code(cfg);
return brw_get_program(p, assembly_size);
}
struct gl_program *prog,
struct brw_vec4_prog_data *prog_data,
void *mem_ctx,
- exec_list *instructions,
+ const cfg_t *cfg,
unsigned *final_assembly_size)
{
vec4_generator g(brw, shader_prog, prog, prog_data, mem_ctx,
INTEL_DEBUG & DEBUG_GS);
- return g.generate_assembly(instructions, final_assembly_size);
+ return g.generate_assembly(cfg, final_assembly_size);
}
extern "C" const unsigned *
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.instructions,
+ &c->prog_data.base, mem_ctx, v.cfg,
final_assembly_size);
}
}
}
return generate_assembly(brw, prog, &c->gp->program.Base, &c->prog_data.base,
- mem_ctx, &v.instructions, final_assembly_size);
+ mem_ctx, v.cfg, final_assembly_size);
}
}
void annotate(struct brw_context *brw,
- struct annotation_info *annotation, struct cfg_t *cfg,
+ struct annotation_info *annotation, const struct cfg_t *cfg,
struct backend_instruction *inst, unsigned offset)
{
if (annotation->ann_size <= annotation->ann_count) {
void
annotate(struct brw_context *brw,
- struct annotation_info *annotation, struct cfg_t *cfg,
+ struct annotation_info *annotation, const struct cfg_t *cfg,
struct backend_instruction *inst, unsigned offset);
void
annotation_finalize(struct annotation_info *annotation, unsigned offset);