freedreno/a3xx/compiler: little cleanups
Remove some obsolete comments, rename deref->addr. Signed-off-by: Rob Clark <robclark@freedesktop.org>
This commit is contained in:
parent
d48faad3c2
commit
9f391322a0
|
@ -43,31 +43,10 @@
|
||||||
|
|
||||||
#include "fd3_compiler.h"
|
#include "fd3_compiler.h"
|
||||||
#include "fd3_program.h"
|
#include "fd3_program.h"
|
||||||
#include "fd3_util.h"
|
|
||||||
|
|
||||||
#include "instr-a3xx.h"
|
#include "instr-a3xx.h"
|
||||||
#include "ir3.h"
|
#include "ir3.h"
|
||||||
|
|
||||||
/* NOTE on half/full precision:
|
|
||||||
* Currently, the front end (ie. basically this file) does everything in
|
|
||||||
* full precision (with the exception of trans_arl() which doesn't work
|
|
||||||
* currently.. we reject anything with relative addressing and fallback
|
|
||||||
* to old compiler).
|
|
||||||
*
|
|
||||||
* In the RA step, if half_precision, it will assign the output to hr0.x
|
|
||||||
* but use full precision everywhere else.
|
|
||||||
*
|
|
||||||
* Eventually we'll need a better way to communicate type information
|
|
||||||
* to RA so that it can more properly assign both half and full precision
|
|
||||||
* registers. (And presumably double precision pairs for a4xx?) This
|
|
||||||
* would let us make more use of half precision registers, while still
|
|
||||||
* keeping things like tex coords in full precision registers.
|
|
||||||
*
|
|
||||||
* Since the RA is dealing with patching instruction types for half
|
|
||||||
* precision output, we can ignore that in the front end and just always
|
|
||||||
* create full precision instructions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct fd3_compile_context {
|
struct fd3_compile_context {
|
||||||
const struct tgsi_token *tokens;
|
const struct tgsi_token *tokens;
|
||||||
bool free_tokens;
|
bool free_tokens;
|
||||||
|
|
|
@ -354,7 +354,7 @@ static inline bool is_meta(struct ir3_instruction *instr)
|
||||||
return (instr->category == -1);
|
return (instr->category == -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool is_deref(struct ir3_instruction *instr)
|
static inline bool is_addr(struct ir3_instruction *instr)
|
||||||
{
|
{
|
||||||
return is_meta(instr) && (instr->opc == OPC_META_DEREF);
|
return is_meta(instr) && (instr->opc == OPC_META_DEREF);
|
||||||
}
|
}
|
||||||
|
@ -368,7 +368,6 @@ static inline bool writes_addr(struct ir3_instruction *instr)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO combine is_gpr()/reg_gpr().. */
|
|
||||||
static inline bool reg_gpr(struct ir3_register *r)
|
static inline bool reg_gpr(struct ir3_register *r)
|
||||||
{
|
{
|
||||||
if (r->flags & (IR3_REG_CONST | IR3_REG_IMMED | IR3_REG_RELATIV | IR3_REG_SSA | IR3_REG_ADDR))
|
if (r->flags & (IR3_REG_CONST | IR3_REG_IMMED | IR3_REG_RELATIV | IR3_REG_SSA | IR3_REG_ADDR))
|
||||||
|
|
|
@ -566,7 +566,7 @@ static void ir3_instr_ra(struct ir3_ra_ctx *ctx,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* allocate register(s): */
|
/* allocate register(s): */
|
||||||
if (is_deref(instr)) {
|
if (is_addr(instr)) {
|
||||||
num = instr->regs[2]->num;
|
num = instr->regs[2]->num;
|
||||||
} else if (reg_gpr(dst)) {
|
} else if (reg_gpr(dst)) {
|
||||||
struct ir3_ra_assignment a;
|
struct ir3_ra_assignment a;
|
||||||
|
|
|
@ -52,7 +52,7 @@ enum {
|
||||||
|
|
||||||
struct ir3_sched_ctx {
|
struct ir3_sched_ctx {
|
||||||
struct ir3_instruction *scheduled; /* last scheduled instr */
|
struct ir3_instruction *scheduled; /* last scheduled instr */
|
||||||
struct ir3_instruction *deref; /* current deref, if any */
|
struct ir3_instruction *addr; /* current a0.x user, if any */
|
||||||
unsigned cnt;
|
unsigned cnt;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -130,8 +130,8 @@ static void schedule(struct ir3_sched_ctx *ctx,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (writes_addr(instr)) {
|
if (writes_addr(instr)) {
|
||||||
assert(ctx->deref == NULL);
|
assert(ctx->addr == NULL);
|
||||||
ctx->deref = instr;
|
ctx->addr = instr;
|
||||||
}
|
}
|
||||||
|
|
||||||
instr->flags |= IR3_INSTR_MARK;
|
instr->flags |= IR3_INSTR_MARK;
|
||||||
|
@ -227,8 +227,8 @@ static int trysched(struct ir3_sched_ctx *ctx,
|
||||||
/* if this is a write to address register, and addr register
|
/* if this is a write to address register, and addr register
|
||||||
* is currently in use, we need to defer until it is free:
|
* is currently in use, we need to defer until it is free:
|
||||||
*/
|
*/
|
||||||
if (writes_addr(instr) && ctx->deref) {
|
if (writes_addr(instr) && ctx->addr) {
|
||||||
assert(ctx->deref != instr);
|
assert(ctx->addr != instr);
|
||||||
return DELAYED;
|
return DELAYED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,17 +248,17 @@ static struct ir3_instruction * reverse(struct ir3_instruction *instr)
|
||||||
return reversed;
|
return reversed;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool uses_current_deref(struct ir3_sched_ctx *ctx,
|
static bool uses_current_addr(struct ir3_sched_ctx *ctx,
|
||||||
struct ir3_instruction *instr)
|
struct ir3_instruction *instr)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
for (i = 1; i < instr->regs_count; i++) {
|
for (i = 1; i < instr->regs_count; i++) {
|
||||||
struct ir3_register *reg = instr->regs[i];
|
struct ir3_register *reg = instr->regs[i];
|
||||||
if (reg->flags & IR3_REG_SSA) {
|
if (reg->flags & IR3_REG_SSA) {
|
||||||
if (is_deref(reg->instr)) {
|
if (is_addr(reg->instr)) {
|
||||||
struct ir3_instruction *deref;
|
struct ir3_instruction *addr;
|
||||||
deref = reg->instr->regs[1]->instr; /* the mova */
|
addr = reg->instr->regs[1]->instr; /* the mova */
|
||||||
if (ctx->deref == deref)
|
if (ctx->addr == addr)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -274,26 +274,28 @@ static int block_sched_undelayed(struct ir3_sched_ctx *ctx,
|
||||||
struct ir3_block *block)
|
struct ir3_block *block)
|
||||||
{
|
{
|
||||||
struct ir3_instruction *instr = block->head;
|
struct ir3_instruction *instr = block->head;
|
||||||
bool in_use = false;
|
bool addr_in_use = false;
|
||||||
unsigned cnt = ~0;
|
unsigned cnt = ~0;
|
||||||
|
|
||||||
while (instr) {
|
while (instr) {
|
||||||
struct ir3_instruction *next = instr->next;
|
struct ir3_instruction *next = instr->next;
|
||||||
|
bool addr = uses_current_addr(ctx, instr);
|
||||||
|
|
||||||
if (uses_current_deref(ctx, instr)) {
|
if (addr) {
|
||||||
int ret = trysched(ctx, instr);
|
int ret = trysched(ctx, instr);
|
||||||
if (ret == SCHEDULED)
|
if (ret == SCHEDULED)
|
||||||
cnt = 0;
|
cnt = 0;
|
||||||
else if (ret > 0)
|
else if (ret > 0)
|
||||||
cnt = MIN2(cnt, ret);
|
cnt = MIN2(cnt, ret);
|
||||||
in_use = true;
|
if (addr)
|
||||||
|
addr_in_use = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
instr = next;
|
instr = next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!in_use)
|
if (!addr_in_use)
|
||||||
ctx->deref = NULL;
|
ctx->addr = NULL;
|
||||||
|
|
||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue