aboutsummaryrefslogtreecommitdiff
path: root/target/hexagon
diff options
context:
space:
mode:
authorAnton Johansson <anjo@rev.ng>2023-03-06 19:25:56 -0800
committerTaylor Simpson <tsimpson@quicinc.com>2023-03-06 20:47:12 -0800
commitbbb71568de91561b57b3622d364aa004436b722f (patch)
treed5877ae436e0801a1a5324bb3b34280772c9c262 /target/hexagon
parent877a3d20cd5de5b53856151a3835b43fa155b96f (diff)
downloadqemu-bbb71568de91561b57b3622d364aa004436b722f.zip
qemu-bbb71568de91561b57b3622d364aa004436b722f.tar.gz
qemu-bbb71568de91561b57b3622d364aa004436b722f.tar.bz2
target/hexagon/idef-parser: Remove unused code paths
Removes code paths used by COF instructions, which are no longer processed by idef-parser. Tested-by: Taylor Simpson <tsimpson@quicinc.com> Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> Signed-off-by: Taylor Simpson <tsimpson@quicinc.com> Signed-off-by: Anton Johansson <anjo@rev.ng> Message-Id: <20230131223133.8592-1-anjo@rev.ng>
Diffstat (limited to 'target/hexagon')
-rw-r--r--target/hexagon/idef-parser/idef-parser.h1
-rw-r--r--target/hexagon/idef-parser/idef-parser.lex27
-rw-r--r--target/hexagon/idef-parser/idef-parser.y44
-rw-r--r--target/hexagon/idef-parser/macros.inc9
-rw-r--r--target/hexagon/idef-parser/parser-helpers.c3
5 files changed, 4 insertions, 80 deletions
diff --git a/target/hexagon/idef-parser/idef-parser.h b/target/hexagon/idef-parser/idef-parser.h
index 17d2ebf..d23e71f 100644
--- a/target/hexagon/idef-parser/idef-parser.h
+++ b/target/hexagon/idef-parser/idef-parser.h
@@ -82,7 +82,6 @@ enum ImmUnionTag {
VALUE,
QEMU_TMP,
IMM_PC,
- IMM_NPC,
IMM_CONSTEXT,
};
diff --git a/target/hexagon/idef-parser/idef-parser.lex b/target/hexagon/idef-parser/idef-parser.lex
index ff87a02..2658d9f 100644
--- a/target/hexagon/idef-parser/idef-parser.lex
+++ b/target/hexagon/idef-parser/idef-parser.lex
@@ -140,8 +140,6 @@ STRING_LIT \"(\\.|[^"\\])*\"
yylval->rvalue.is_dotnew = true;
yylval->rvalue.signedness = SIGNED;
return PRED; }
-"IV1DEAD()" |
-"fPAUSE(uiV);" { return ';'; }
"+=" { return INC; }
"-=" { return DEC; }
"++" { return PLUSPLUS; }
@@ -159,9 +157,8 @@ STRING_LIT \"(\\.|[^"\\])*\"
"else" { return ELSE; }
"for" { return FOR; }
"fREAD_IREG" { return ICIRC; }
-"fPART1" { return PART1; }
"if" { return IF; }
-"fFRAME_SCRAMBLE" { return FSCR; }
+"fFRAME_SCRAMBLE" |
"fFRAME_UNSCRAMBLE" { return FSCR; }
"fFRAMECHECK" { return FCHK; }
"Constant_extended" { return CONSTEXT; }
@@ -312,11 +309,7 @@ STRING_LIT \"(\\.|[^"\\])*\"
"(unsigned int)" { yylval->cast.bit_width = 32;
yylval->cast.signedness = UNSIGNED;
return CAST; }
-"fREAD_PC()" |
-"PC" { return PC; }
-"fREAD_NPC()" |
-"NPC" { return NPC; }
-"fGET_LPCFG" |
+"fREAD_PC()" { return PC; }
"USR.LPCFG" { return LPCFG; }
"LOAD_CANCEL(EA)" { return LOAD_CANCEL; }
"STORE_CANCEL(EA)" |
@@ -360,14 +353,6 @@ STRING_LIT \"(\\.|[^"\\])*\"
yylval->rvalue.bit_width = 32;
yylval->rvalue.signedness = UNSIGNED;
return REG; }
-"fREAD_LC"[01] { yylval->rvalue.type = REGISTER;
- yylval->rvalue.reg.type = CONTROL;
- yylval->rvalue.reg.id = HEX_REG_LC0
- + (yytext[8] - '0') * 2;
- yylval->rvalue.reg.bit_width = 32;
- yylval->rvalue.bit_width = 32;
- yylval->rvalue.signedness = UNSIGNED;
- return REG; }
"LC"[01] { yylval->rvalue.type = REGISTER;
yylval->rvalue.reg.type = CONTROL;
yylval->rvalue.reg.id = HEX_REG_LC0
@@ -376,14 +361,6 @@ STRING_LIT \"(\\.|[^"\\])*\"
yylval->rvalue.bit_width = 32;
yylval->rvalue.signedness = UNSIGNED;
return REG; }
-"fREAD_SA"[01] { yylval->rvalue.type = REGISTER;
- yylval->rvalue.reg.type = CONTROL;
- yylval->rvalue.reg.id = HEX_REG_SA0
- + (yytext[8] - '0') * 2;
- yylval->rvalue.reg.bit_width = 32;
- yylval->rvalue.bit_width = 32;
- yylval->rvalue.signedness = UNSIGNED;
- return REG; }
"SA"[01] { yylval->rvalue.type = REGISTER;
yylval->rvalue.reg.type = CONTROL;
yylval->rvalue.reg.id = HEX_REG_SA0
diff --git a/target/hexagon/idef-parser/idef-parser.y b/target/hexagon/idef-parser/idef-parser.y
index c784726..d7b2199 100644
--- a/target/hexagon/idef-parser/idef-parser.y
+++ b/target/hexagon/idef-parser/idef-parser.y
@@ -52,8 +52,8 @@
%token IN INAME VAR
%token ABS CROUND ROUND CIRCADD COUNTONES INC DEC ANDA ORA XORA PLUSPLUS ASL
%token ASR LSR EQ NEQ LTE GTE MIN MAX ANDL FOR ICIRC IF MUN FSCR FCHK SXT
-%token ZXT CONSTEXT LOCNT BREV SIGN LOAD STORE PC NPC LPCFG
-%token LOAD_CANCEL CANCEL IDENTITY PART1 ROTL INSBITS SETBITS EXTRANGE
+%token ZXT CONSTEXT LOCNT BREV SIGN LOAD STORE PC LPCFG
+%token LOAD_CANCEL CANCEL IDENTITY ROTL INSBITS SETBITS EXTRANGE
%token CAST4_8U FAIL CARRY_FROM_ADD ADDSAT64 LSBNEW
%token TYPE_SIZE_T TYPE_INT TYPE_SIGNED TYPE_UNSIGNED TYPE_LONG
@@ -336,15 +336,6 @@ assign_statement : lvalue '=' rvalue
OUT(c, &@1, &$1, " = ", &$3, ";\n");
$$ = $1;
}
- | PC '=' rvalue
- {
- @1.last_column = @3.last_column;
- yyassert(c, &@1, !is_inside_ternary(c),
- "Assignment side-effect not modeled!");
- $3 = gen_rvalue_truncate(c, &@1, &$3);
- $3 = rvalue_materialize(c, &@1, &$3);
- OUT(c, &@1, "gen_write_new_pc(", &$3, ");\n");
- }
| LOAD '(' IMM ',' IMM ',' SIGN ',' var ',' lvalue ')'
{
@1.last_column = @12.last_column;
@@ -412,7 +403,6 @@ control_statement : frame_check
| cancel_statement
| if_statement
| for_statement
- | fpart1_statement
;
frame_check : FCHK '(' rvalue ',' rvalue ')' ';'
@@ -462,17 +452,6 @@ for_statement : FOR '(' IMM '=' IMM ';' IMM '<' IMM ';' IMM PLUSPLUS ')'
}
;
-fpart1_statement : PART1
- {
- OUT(c, &@1, "if (insn->part1) {\n");
- }
- '(' statements ')'
- {
- @1.last_column = @3.last_column;
- OUT(c, &@1, "return; }\n");
- }
- ;
-
if_stmt : IF '(' rvalue ')'
{
@1.last_column = @3.last_column;
@@ -512,20 +491,6 @@ rvalue : FAIL
rvalue.signedness = UNSIGNED;
$$ = rvalue;
}
- | NPC
- {
- /*
- * NPC is only read from CALLs, so we can hardcode it
- * at translation time
- */
- HexValue rvalue;
- memset(&rvalue, 0, sizeof(HexValue));
- rvalue.type = IMMEDIATE;
- rvalue.imm.type = IMM_NPC;
- rvalue.bit_width = 32;
- rvalue.signedness = UNSIGNED;
- $$ = rvalue;
- }
| CONSTEXT
{
HexValue rvalue;
@@ -781,11 +746,6 @@ rvalue : FAIL
/* Ones count */
$$ = gen_ctpop_op(c, &@1, &$3);
}
- | LPCFG
- {
- $$ = gen_tmp(c, &@1, 32, UNSIGNED);
- OUT(c, &@1, "GET_USR_FIELD(USR_LPCFG, ", &$$, ");\n");
- }
| EXTRACT '(' rvalue ',' rvalue ')'
{
@1.last_column = @6.last_column;
diff --git a/target/hexagon/idef-parser/macros.inc b/target/hexagon/idef-parser/macros.inc
index 6b697da..7478d4d 100644
--- a/target/hexagon/idef-parser/macros.inc
+++ b/target/hexagon/idef-parser/macros.inc
@@ -97,16 +97,8 @@
#define fWRITE_LR(A) (LR = A)
#define fWRITE_FP(A) (FP = A)
#define fWRITE_SP(A) (SP = A)
-/*
- * Note: There is a rule in the parser that matches `PC = ...` and emits
- * a call to `gen_write_new_pc`. We need to call `gen_write_new_pc` to
- * get the correct semantics when there are multiple stores in a packet.
- */
-#define fBRANCH(LOC, TYPE) (PC = LOC)
-#define fJUMPR(REGNO, TARGET, TYPE) (PC = TARGET)
#define fWRITE_LOOP_REGS0(START, COUNT) SA0 = START; (LC0 = COUNT)
#define fWRITE_LOOP_REGS1(START, COUNT) SA1 = START; (LC1 = COUNT)
-#define fWRITE_LC0(VAL) (LC0 = VAL)
#define fWRITE_LC1(VAL) (LC1 = VAL)
#define fSET_LPCFG(VAL) (USR.LPCFG = VAL)
#define fWRITE_P0(VAL) P0 = VAL;
@@ -121,7 +113,6 @@
#define fEA_GPI(IMM) (EA = fREAD_GP() + IMM)
#define fPM_I(REG, IMM) (REG = REG + IMM)
#define fPM_M(REG, MVAL) (REG = REG + MVAL)
-#define fWRITE_NPC(VAL) (PC = VAL)
/* Unary operators */
#define fROUND(A) (A + 0x8000)
diff --git a/target/hexagon/idef-parser/parser-helpers.c b/target/hexagon/idef-parser/parser-helpers.c
index 7b494c2..cc2cd00 100644
--- a/target/hexagon/idef-parser/parser-helpers.c
+++ b/target/hexagon/idef-parser/parser-helpers.c
@@ -185,9 +185,6 @@ void imm_print(Context *c, YYLTYPE *locp, HexImm *imm)
case IMM_PC:
EMIT(c, "ctx->base.pc_next");
break;
- case IMM_NPC:
- EMIT(c, "ctx->npc");
- break;
case IMM_CONSTEXT:
EMIT(c, "insn->extension_valid");
break;