aboutsummaryrefslogtreecommitdiff
path: root/target/hexagon/gen_idef_parser_funcs.py
diff options
context:
space:
mode:
Diffstat (limited to 'target/hexagon/gen_idef_parser_funcs.py')
-rw-r--r--target/hexagon/gen_idef_parser_funcs.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/target/hexagon/gen_idef_parser_funcs.py b/target/hexagon/gen_idef_parser_funcs.py
index eb494ab..2f6e826 100644
--- a/target/hexagon/gen_idef_parser_funcs.py
+++ b/target/hexagon/gen_idef_parser_funcs.py
@@ -20,6 +20,7 @@
import sys
import re
import string
+import argparse
from io import StringIO
import hex_common
@@ -43,14 +44,20 @@ import hex_common
## them are inputs ("in" prefix), while some others are outputs.
##
def main():
- hex_common.read_semantics_file(sys.argv[1])
+ parser = argparse.ArgumentParser(
+ "Emit instruction implementations that can be fed to idef-parser"
+ )
+ parser.add_argument("semantics", help="semantics file")
+ parser.add_argument("out", help="output file")
+ args = parser.parse_args()
+ hex_common.read_semantics_file(args.semantics)
hex_common.calculate_attribs()
hex_common.init_registers()
tagregs = hex_common.get_tagregs()
tagimms = hex_common.get_tagimms()
- with open(sys.argv[-1], "w") as f:
- f.write('#include "macros.inc"\n\n')
+ with open(args.out, "w") as f:
+ f.write('#include "macros.h.inc"\n\n')
for tag in hex_common.tags:
## Skip the priv instructions