On 2/11/20 1:39 AM, Taylor Simpson wrote:
For each instruction we create
DEF_HELPER function prototype
TCG code to generate call to helper
Helper definition
Signed-off-by: Taylor Simpson <tsimp...@quicinc.com>
---
target/hexagon/do_qemu.py | 773 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 773 insertions(+)
create mode 100755 target/hexagon/do_qemu.py
diff --git a/target/hexagon/do_qemu.py b/target/hexagon/do_qemu.py
new file mode 100755
index 0000000..992dbc3
--- /dev/null
+++ b/target/hexagon/do_qemu.py
@@ -0,0 +1,773 @@
+#!/usr/bin/env python
python3 ;)
+
+from __future__ import print_function
Not needed anymore.
+##
+## Copyright (c) 2019 Qualcomm Innovation Center, Inc. All Rights Reserved.
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+##
+
+import sys
+import re
+import string
+try:
+ from StringIO import StringIO
+except ImportError:
+ from io import StringIO
Directly "from io import StringIO".
+
+
+import operator
+from itertools import chain
+
+
+
+behdict = {} # tag ->behavior
+semdict = {} # tag -> semantics
+extdict = {} # tag -> What extension an instruction belongs to (or "")
+extnames = {} # ext name -> True
+attribdict = {} # tag -> attributes
+macros = {} # macro -> macro information...
+attribinfo = {} # Register information and misc
+tags = [] # list of all tags
+
+def get_macro(macname,ext=""):
+ mackey = macname + ":" + ext
+ if ext and mackey not in macros:
+ return get_macro(macname,"")
+ return macros[mackey]
+
+# We should do this as a hash for performance,
+# but to keep order let's keep it as a list.
+def uniquify(seq):
+ seen = set()
+ seen_add = seen.add
+ return [x for x in seq if x not in seen and not seen_add(x)]
+
+regre = re.compile(
+ r"((?<!DUP)[MNORCPQXSGVZA])([stuvwxyzdefg]+)([.]?[LlHh]?)(\d+S?)")
+immre = re.compile(r"[#]([rRsSuUm])(\d+)(?:[:](\d+))?")
+reg_or_immre = \
+ re.compile(r"(((?<!DUP)[MNRCOPQXSGVZA])([stuvwxyzdefg]+)" + \
+ "([.]?[LlHh]?)(\d+S?))|([#]([rRsSuUm])(\d+)[:]?(\d+)?)")
+relimmre = re.compile(r"[#]([rR])(\d+)(?:[:](\d+))?")
+absimmre = re.compile(r"[#]([sSuUm])(\d+)(?:[:](\d+))?")
+
+finished_macros = set()
[...]