target/hexagon: idef-parser simplify predicate init
Only predicate instruction arguments need to be initialized by idef-parser. This commit removes registers from the init_list and simplifies gen_inst_init_args() slightly. Signed-off-by: Anton Johansson <anjo@rev.ng> Reviewed-by: Taylor Simpson <ltaylorsimpson@gmail.com> Reviewed-by: Brian Cain <bcain@quicinc.com> Message-Id: <20240523125901.27797-5-anjo@rev.ng> Signed-off-by: Brian Cain <bcain@quicinc.com>
This commit is contained in:
parent
95408ad8e2
commit
1967a1ea98
@ -233,8 +233,6 @@ code : '{' statements '}'
|
|||||||
argument_decl : REG
|
argument_decl : REG
|
||||||
{
|
{
|
||||||
emit_arg(c, &@1, &$1);
|
emit_arg(c, &@1, &$1);
|
||||||
/* Enqueue register into initialization list */
|
|
||||||
g_array_append_val(c->inst.init_list, $1);
|
|
||||||
}
|
}
|
||||||
| PRED
|
| PRED
|
||||||
{
|
{
|
||||||
|
@ -1652,26 +1652,28 @@ void gen_inst(Context *c, GString *iname)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize declared but uninitialized registers, but only for
|
* Initialize declared but uninitialized instruction arguments. Only needed for
|
||||||
* non-conditional instructions
|
* predicate arguments, initialization of registers is handled by the Hexagon
|
||||||
|
* frontend.
|
||||||
*/
|
*/
|
||||||
void gen_inst_init_args(Context *c, YYLTYPE *locp)
|
void gen_inst_init_args(Context *c, YYLTYPE *locp)
|
||||||
{
|
{
|
||||||
|
HexValue *val = NULL;
|
||||||
|
char suffix;
|
||||||
|
|
||||||
|
/* If init_list is NULL arguments have already been initialized */
|
||||||
if (!c->inst.init_list) {
|
if (!c->inst.init_list) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned i = 0; i < c->inst.init_list->len; i++) {
|
for (unsigned i = 0; i < c->inst.init_list->len; i++) {
|
||||||
HexValue *val = &g_array_index(c->inst.init_list, HexValue, i);
|
val = &g_array_index(c->inst.init_list, HexValue, i);
|
||||||
if (val->type == REGISTER_ARG) {
|
suffix = val->is_dotnew ? 'N' : 'V';
|
||||||
/* Nothing to do here */
|
yyassert(c, locp, val->type == PREDICATE,
|
||||||
} else if (val->type == PREDICATE) {
|
"Only predicates need to be initialized!");
|
||||||
char suffix = val->is_dotnew ? 'N' : 'V';
|
yyassert(c, locp, val->bit_width == 32,
|
||||||
EMIT_HEAD(c, "tcg_gen_movi_i%u(P%c%c, 0);\n", val->bit_width,
|
"Predicates should always be 32 bits");
|
||||||
val->pred.id, suffix);
|
EMIT_HEAD(c, "tcg_gen_movi_i32(P%c%c, 0);\n", val->pred.id, suffix);
|
||||||
} else {
|
|
||||||
yyassert(c, locp, false, "Invalid arg type!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free argument init list once we have initialized everything */
|
/* Free argument init list once we have initialized everything */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user