diff mbox series

[RFC,24/66] Hexagon generator phase 2 - op_attribs_generated.h

Message ID 1581381644-13678-25-git-send-email-tsimpson@quicinc.com (mailing list archive)
State New, archived
Headers show
Series Hexagon patch series | expand

Commit Message

Taylor Simpson Feb. 11, 2020, 12:40 a.m. UTC
Lists all the attributes associated with each instruction

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
---
 target/hexagon/do_qemu.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Philippe Mathieu-Daudé Feb. 11, 2020, 8:01 a.m. UTC | #1
On 2/11/20 1:40 AM, Taylor Simpson wrote:
> Lists all the attributes associated with each instruction
> 
> Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
> ---
>   target/hexagon/do_qemu.py | 13 +++++++++++++
>   1 file changed, 13 insertions(+)
> 
> diff --git a/target/hexagon/do_qemu.py b/target/hexagon/do_qemu.py
> index 5439964..f297931 100755
> --- a/target/hexagon/do_qemu.py
> +++ b/target/hexagon/do_qemu.py
> @@ -797,3 +797,16 @@ realf.write(f.getvalue())
>   realf.close()
>   f.close()
>   
> +##
> +## Generate the op_attribs_generated.h file
> +##     Lists all the attributes associated with each instruction
> +##
> +f = StringIO()
> +for tag in tags:
> +    f.write('OP_ATTRIB(%s,ATTRIBS(%s))\n' % \
> +        (tag,string.join(sorted(attribdict[tag]),",")))
> +realf = open('op_attribs_generated.h', 'wt')
> +realf.write(f.getvalue())
> +realf.close()
> +f.close()
> +
> 

This fails with Python 3:

   GEN     Hexagon generated files
Traceback (most recent call last):
   File "target/hexagon/do_qemu.py", line 952, in <module>
     (tag,string.join(sorted(attribdict[tag]),",")))
AttributeError: module 'string' has no attribute 'join'
diff mbox series

Patch

diff --git a/target/hexagon/do_qemu.py b/target/hexagon/do_qemu.py
index 5439964..f297931 100755
--- a/target/hexagon/do_qemu.py
+++ b/target/hexagon/do_qemu.py
@@ -797,3 +797,16 @@  realf.write(f.getvalue())
 realf.close()
 f.close()
 
+##
+## Generate the op_attribs_generated.h file
+##     Lists all the attributes associated with each instruction
+##
+f = StringIO()
+for tag in tags:
+    f.write('OP_ATTRIB(%s,ATTRIBS(%s))\n' % \
+        (tag,string.join(sorted(attribdict[tag]),",")))
+realf = open('op_attribs_generated.h', 'wt')
+realf.write(f.getvalue())
+realf.close()
+f.close()
+