Suggested by Ken as a way to cut down lines of code.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
unsigned *assembly_size);
private:
- void generate_code(exec_list *instructions,
- struct annotation_info *annotation);
+ void generate_code(exec_list *instructions);
void generate_fb_write(fs_inst *inst);
void generate_blorp_fb_write(fs_inst *inst);
void generate_pixel_xy(struct brw_reg dst, bool is_x);
unsigned *assembly_size);
private:
- void generate_code(exec_list *instructions,
- struct annotation_info *annotation);
+ void generate_code(exec_list *instructions);
void generate_fb_write(fs_inst *inst);
void generate_linterp(fs_inst *inst, struct brw_reg dst,
struct brw_reg *src);
}
void
-fs_generator::generate_code(exec_list *instructions,
- struct annotation_info *annotation)
+fs_generator::generate_code(exec_list *instructions)
{
if (unlikely(debug_flag)) {
if (prog) {
}
}
+ 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);
unsigned int last_insn_offset = p->next_insn_offset;
if (unlikely(debug_flag))
- annotate(brw, annotation, cfg, inst, p->next_insn_offset);
+ annotate(brw, &annotation, cfg, inst, p->next_insn_offset);
for (unsigned int i = 0; i < inst->sources; i++) {
src[i] = brw_reg_from_fs_reg(&inst->src[i]);
*/
if (!patch_discard_jumps_to_fb_writes()) {
if (unlikely(debug_flag)) {
- annotation->ann_count--;
+ annotation.ann_count--;
}
}
break;
}
brw_set_uip_jip(p);
- annotation_finalize(annotation, p->next_insn_offset);
+ annotation_finalize(&annotation, p->next_insn_offset);
+
+ brw_compact_instructions(p, start_offset, annotation.ann_count,
+ annotation.ann);
+
+ if (unlikely(debug_flag)) {
+ const struct gl_program *prog = fp ? &fp->Base : NULL;
+
+ dump_assembly(p->store, annotation.ann_count, annotation.ann,
+ brw, prog, brw_disassemble);
+ ralloc_free(annotation.ann);
+ }
}
const unsigned *
{
assert(simd8_instructions || simd16_instructions);
- const struct gl_program *prog = fp ? &fp->Base : NULL;
-
if (simd8_instructions) {
- struct annotation_info annotation;
- memset(&annotation, 0, sizeof(annotation));
-
dispatch_width = 8;
- generate_code(simd8_instructions, &annotation);
- brw_compact_instructions(p, 0, annotation.ann_count, annotation.ann);
-
- if (unlikely(debug_flag)) {
- dump_assembly(p->store, annotation.ann_count, annotation.ann,
- brw, prog, brw_disassemble);
- ralloc_free(annotation.ann);
- }
+ generate_code(simd8_instructions);
}
if (simd16_instructions) {
brw_set_default_compression_control(p, BRW_COMPRESSION_COMPRESSED);
- struct annotation_info annotation;
- memset(&annotation, 0, sizeof(annotation));
-
dispatch_width = 16;
- generate_code(simd16_instructions, &annotation);
- brw_compact_instructions(p, prog_data->prog_offset_16,
- annotation.ann_count, annotation.ann);
-
- if (unlikely(debug_flag)) {
- dump_assembly(p->store, annotation.ann_count, annotation.ann,
- brw, prog, brw_disassemble);
- ralloc_free(annotation.ann);
- }
+ generate_code(simd16_instructions);
}
return brw_get_program(p, assembly_size);
const unsigned *generate_assembly(exec_list *insts, unsigned *asm_size);
private:
- void generate_code(exec_list *instructions,
- struct annotation_info *annotation);
+ void generate_code(exec_list *instructions);
void generate_vec4_instruction(vec4_instruction *inst,
struct brw_reg dst,
struct brw_reg *src);
const unsigned *generate_assembly(exec_list *insts, unsigned *asm_size);
private:
- void generate_code(exec_list *instructions,
- struct annotation_info *annotation);
+ void generate_code(exec_list *instructions);
void generate_vec4_instruction(vec4_instruction *inst,
struct brw_reg dst,
struct brw_reg *src);
}
void
-vec4_generator::generate_code(exec_list *instructions,
- struct annotation_info *annotation)
+vec4_generator::generate_code(exec_list *instructions)
{
if (unlikely(debug_flag)) {
if (shader_prog) {
}
}
+ struct annotation_info annotation;
+ memset(&annotation, 0, sizeof(annotation));
+
cfg_t *cfg = NULL;
if (unlikely(debug_flag))
cfg = new(mem_ctx) cfg_t(instructions);
struct brw_reg src[3], dst;
if (unlikely(debug_flag))
- annotate(brw, annotation, cfg, inst, p->next_insn_offset);
+ annotate(brw, &annotation, cfg, inst, p->next_insn_offset);
for (unsigned int i = 0; i < 3; i++) {
src[i] = inst->get_src(this->prog_data, i);
}
brw_set_uip_jip(p);
- annotation_finalize(annotation, p->next_insn_offset);
-}
+ annotation_finalize(&annotation, p->next_insn_offset);
-const unsigned *
-vec4_generator::generate_assembly(exec_list *instructions,
- unsigned *assembly_size)
-{
- struct annotation_info annotation;
- memset(&annotation, 0, sizeof(annotation));
-
- brw_set_default_access_mode(p, BRW_ALIGN_16);
- generate_code(instructions, &annotation);
brw_compact_instructions(p, 0, annotation.ann_count, annotation.ann);
if (unlikely(debug_flag)) {
brw, prog, brw_disassemble);
ralloc_free(annotation.ann);
}
+}
+
+const unsigned *
+vec4_generator::generate_assembly(exec_list *instructions,
+ unsigned *assembly_size)
+{
+ brw_set_default_access_mode(p, BRW_ALIGN_16);
+ generate_code(instructions);
return brw_get_program(p, assembly_size);
}
}
void
-gen8_fs_generator::generate_code(exec_list *instructions,
- struct annotation_info *annotation)
+gen8_fs_generator::generate_code(exec_list *instructions)
{
if (unlikely(INTEL_DEBUG & DEBUG_WM)) {
if (prog) {
}
}
+ struct annotation_info annotation;
+ memset(&annotation, 0, sizeof(annotation));
+
cfg_t *cfg = NULL;
if (unlikely(INTEL_DEBUG & DEBUG_WM))
cfg = new(mem_ctx) cfg_t(instructions);
struct brw_reg src[3], dst;
if (unlikely(INTEL_DEBUG & DEBUG_WM))
- annotate(brw, annotation, cfg, ir, next_inst_offset);
+ annotate(brw, &annotation, cfg, ir, next_inst_offset);
for (unsigned int i = 0; i < 3; i++) {
src[i] = brw_reg_from_fs_reg(&ir->src[i]);
*/
if (!patch_discard_jumps_to_fb_writes()) {
if (unlikely(INTEL_DEBUG & DEBUG_WM)) {
- annotation->ann_count--;
+ annotation.ann_count--;
}
}
break;
}
patch_jump_targets();
- annotation_finalize(annotation, next_inst_offset);
+ annotation_finalize(&annotation, next_inst_offset);
+
+ if (unlikely(INTEL_DEBUG & DEBUG_WM)) {
+ dump_assembly(store, annotation.ann_count, annotation.ann, brw, prog,
+ gen8_disassemble);
+ ralloc_free(annotation.ann);
+ }
}
const unsigned *
assert(simd8_instructions || simd16_instructions);
if (simd8_instructions) {
- struct annotation_info annotation;
- memset(&annotation, 0, sizeof(annotation));
-
dispatch_width = 8;
- generate_code(simd8_instructions, &annotation);
-
- if (unlikely(INTEL_DEBUG & DEBUG_WM)) {
- dump_assembly(store, annotation.ann_count, annotation.ann, brw, prog,
- gen8_disassemble);
- ralloc_free(annotation.ann);
- }
+ generate_code(simd8_instructions);
}
if (simd16_instructions) {
/* Save off the start of this SIMD16 program */
prog_data->prog_offset_16 = next_inst_offset;
- struct annotation_info annotation;
- memset(&annotation, 0, sizeof(annotation));
-
dispatch_width = 16;
- generate_code(simd16_instructions, &annotation);
-
- if (unlikely(INTEL_DEBUG & DEBUG_WM)) {
- dump_assembly(store, annotation.ann_count, annotation.ann,
- brw, prog, gen8_disassemble);
- ralloc_free(annotation.ann);
- }
+ generate_code(simd16_instructions);
}
*assembly_size = next_inst_offset;
}
void
-gen8_vec4_generator::generate_code(exec_list *instructions,
- struct annotation_info *annotation)
+gen8_vec4_generator::generate_code(exec_list *instructions)
{
if (unlikely(debug_flag)) {
if (shader_prog) {
}
}
+ struct annotation_info annotation;
+ memset(&annotation, 0, sizeof(annotation));
+
cfg_t *cfg = NULL;
if (unlikely(debug_flag))
cfg = new(mem_ctx) cfg_t(instructions);
struct brw_reg src[3], dst;
if (unlikely(debug_flag))
- annotate(brw, annotation, cfg, ir, next_inst_offset);
+ annotate(brw, &annotation, cfg, ir, next_inst_offset);
for (unsigned int i = 0; i < 3; i++) {
src[i] = ir->get_src(prog_data, i);
}
patch_jump_targets();
- annotation_finalize(annotation, next_inst_offset);
+ annotation_finalize(&annotation, next_inst_offset);
+
+ if (unlikely(debug_flag)) {
+ dump_assembly(store, annotation.ann_count, annotation.ann,
+ brw, prog, gen8_disassemble);
+ ralloc_free(annotation.ann);
+ }
}
const unsigned *
gen8_vec4_generator::generate_assembly(exec_list *instructions,
unsigned *assembly_size)
{
- struct annotation_info annotation;
- memset(&annotation, 0, sizeof(annotation));
-
default_state.access_mode = BRW_ALIGN_16;
default_state.exec_size = BRW_EXECUTE_8;
- generate_code(instructions, &annotation);
-
- if (unlikely(debug_flag)) {
- dump_assembly(store, annotation.ann_count, annotation.ann,
- brw, prog, gen8_disassemble);
- ralloc_free(annotation.ann);
- }
+ generate_code(instructions);
*assembly_size = next_inst_offset;
return (const unsigned *) store;