summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno/ir3/ir3_group.c
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2015-04-25 11:05:27 -0400
committerRob Clark <[email protected]>2015-06-21 07:52:41 -0400
commit5c8c2e2f97394436effbdd3e0f61eec4590accb2 (patch)
treee72e41ab88b3cbb22332ea076d68633108bd19ad /src/gallium/drivers/freedreno/ir3/ir3_group.c
parentb33015f8895a37fcae1da2984796cb1ef30f8b13 (diff)
freedreno/ir3: more builder helpers
Use ir3_MOV() builder in a couple of spots, rather than open-coding the instruction construction. Also add ir3_NOP() builder and use that instead of open coding. Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/ir3/ir3_group.c')
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_group.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_group.c b/src/gallium/drivers/freedreno/ir3/ir3_group.c
index 782f6e87e56..8eed083866d 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_group.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_group.c
@@ -50,19 +50,6 @@ static bool check_stop(struct ir3_instruction *instr)
return false;
}
-static struct ir3_instruction * create_mov(struct ir3_instruction *instr)
-{
- struct ir3_instruction *mov;
-
- mov = ir3_instr_create(instr->block, 1, 0);
- mov->cat1.src_type = TYPE_F32;
- mov->cat1.dst_type = TYPE_F32;
- ir3_reg_create(mov, 0, 0); /* dst */
- ir3_reg_create(mov, 0, IR3_REG_SSA)->instr = instr;
-
- return mov;
-}
-
/* bleh.. we need to do the same group_n() thing for both inputs/outputs
* (where we have a simple instr[] array), and fanin nodes (where we have
* an extra indirection via reg->instr).
@@ -78,7 +65,8 @@ static struct ir3_instruction *arr_get(void *arr, int idx)
}
static void arr_insert_mov_out(void *arr, int idx, struct ir3_instruction *instr)
{
- ((struct ir3_instruction **)arr)[idx] = create_mov(instr);
+ ((struct ir3_instruction **)arr)[idx] =
+ ir3_MOV(instr->block, instr, TYPE_F32);
}
static void arr_insert_mov_in(void *arr, int idx, struct ir3_instruction *instr)
{
@@ -113,7 +101,8 @@ static struct ir3_instruction *instr_get(void *arr, int idx)
}
static void instr_insert_mov(void *arr, int idx, struct ir3_instruction *instr)
{
- ((struct ir3_instruction *)arr)->regs[idx+1]->instr = create_mov(instr);
+ ((struct ir3_instruction *)arr)->regs[idx+1]->instr =
+ ir3_MOV(instr->block, instr, TYPE_F32);
}
static struct group_ops instr_ops = { instr_get, instr_insert_mov };
@@ -210,8 +199,8 @@ static void pad_and_group_input(struct ir3_instruction **input, unsigned n)
if (instr) {
block = instr->block;
} else if (block) {
- instr = ir3_instr_create(block, 0, OPC_NOP);
- ir3_reg_create(instr, 0, IR3_REG_SSA); /* dst */
+ instr = ir3_NOP(block);
+ ir3_reg_create(instr, 0, IR3_REG_SSA); /* dummy dst */
input[i] = instr;
mask |= (1 << i);
}