aboutsummaryrefslogtreecommitdiff
path: root/target/hexagon/hex_common.py
diff options
context:
space:
mode:
authorTaylor Simpson <tsimpson@quicinc.com>2022-11-08 08:29:01 -0800
committerTaylor Simpson <tsimpson@quicinc.com>2022-12-16 10:10:28 -0800
commit613653e500c0d482784f09aaa71f1297565b6815 (patch)
tree861f5464a9b65b97696721eee32922035e43a0bb /target/hexagon/hex_common.py
parent40085901dbe339bdcd16ecf1bb70b63a5f119b4f (diff)
downloadqemu-613653e500c0d482784f09aaa71f1297565b6815.zip
qemu-613653e500c0d482784f09aaa71f1297565b6815.tar.gz
qemu-613653e500c0d482784f09aaa71f1297565b6815.tar.bz2
Hexagon (target/hexagon) Remove next_PC from runtime state
The imported files don't properly mark all CONDEXEC instructions, so we add some logic to hex_common.py to add the attribute. Acked-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Taylor Simpson <tsimpson@quicinc.com> Message-Id: <20221108162906.3166-7-tsimpson@quicinc.com>
Diffstat (limited to 'target/hexagon/hex_common.py')
-rwxr-xr-xtarget/hexagon/hex_common.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/target/hexagon/hex_common.py b/target/hexagon/hex_common.py
index cfe5fe7..8e631b4 100755
--- a/target/hexagon/hex_common.py
+++ b/target/hexagon/hex_common.py
@@ -66,6 +66,19 @@ def add_qemu_macro_attrib(name, attrib):
macros[name].attribs.add(attrib)
immextre = re.compile(r'f(MUST_)?IMMEXT[(]([UuSsRr])')
+
+def is_cond_jump(tag):
+ if tag == 'J2_rte':
+ return False
+ if ('A_HWLOOP0_END' in attribdict[tag] or
+ 'A_HWLOOP1_END' in attribdict[tag]):
+ return False
+ return \
+ re.compile(r"(if.*fBRANCH)|(if.*fJUMPR)").search(semdict[tag]) != None
+
+def is_cond_call(tag):
+ return re.compile(r"(if.*fCALL)").search(semdict[tag]) != None
+
def calculate_attribs():
add_qemu_macro_attrib('fREAD_PC', 'A_IMPLICIT_READS_PC')
add_qemu_macro_attrib('fTRAP', 'A_IMPLICIT_READS_PC')
@@ -96,6 +109,11 @@ def calculate_attribs():
for regtype, regid, toss, numregs in regs:
if regtype == "P" and is_written(regid):
attribdict[tag].add('A_WRITES_PRED_REG')
+ # Mark conditional jumps and calls
+ # Not all instructions are properly marked with A_CONDEXEC
+ for tag in tags:
+ if is_cond_jump(tag) or is_cond_call(tag):
+ attribdict[tag].add('A_CONDEXEC')
def SEMANTICS(tag, beh, sem):
#print tag,beh,sem
@@ -211,6 +229,9 @@ def need_ea(tag):
def need_PC(tag):
return 'A_IMPLICIT_READS_PC' in attribdict[tag]
+def helper_needs_next_PC(tag):
+ return 'A_CALL' in attribdict[tag]
+
def need_pkt_has_multi_cof(tag):
return 'A_COF' in attribdict[tag]