2 # Copyright (c) 2018 Linaro Limited
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2 of the License, or (at your option) any later version.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, see <http://www.gnu.org/licenses/>.
19 # Generate a decoding tree from a specification file.
21 # The tree is built from instruction "patterns". A pattern may represent
22 # a single architectural instruction or a group of same, depending on what
23 # is convenient for further processing.
25 # Each pattern has "fixedbits" & "fixedmask", the combination of which
26 # describes the condition under which the pattern is matched:
28 # (insn & fixedmask) == fixedbits
30 # Each pattern may have "fields", which are extracted from the insn and
31 # passed along to the translator. Examples of such are registers,
32 # immediates, and sub-opcodes.
34 # In support of patterns, one may declare fields, argument sets, and
35 # formats, each of which may be re-used to simplify further definitions.
39 # field_def := '%' identifier ( unnamed_field )+ ( !function=identifier )?
40 # unnamed_field := number ':' ( 's' ) number
42 # For unnamed_field, the first number is the least-significant bit position of
43 # the field and the second number is the length of the field. If the 's' is
44 # present, the field is considered signed. If multiple unnamed_fields are
45 # present, they are concatenated. In this way one can define disjoint fields.
47 # If !function is specified, the concatenated result is passed through the
48 # named function, taking and returning an integral value.
50 # FIXME: the fields of the structure into which this result will be stored
51 # is restricted to "int". Which means that we cannot expand 64-bit items.
55 # %disp 0:s16 -- sextract(i, 0, 16)
56 # %imm9 16:6 10:3 -- extract(i, 16, 6) << 3 | extract(i, 10, 3)
57 # %disp12 0:s1 1:1 2:10 -- sextract(i, 0, 1) << 11
58 # | extract(i, 1, 1) << 10
60 # %shimm8 5:s8 13:1 !function=expand_shimm8
61 # -- expand_shimm8(sextract(i, 5, 8) << 1
62 # | extract(i, 13, 1))
64 # *** Argument set syntax:
66 # args_def := '&' identifier ( args_elt )+ ( !extern )?
67 # args_elt := identifier
69 # Each args_elt defines an argument within the argument set.
70 # Each argument set will be rendered as a C structure "arg_$name"
71 # with each of the fields being one of the member arguments.
73 # If !extern is specified, the backing structure is assumed to
74 # have been already declared, typically via a second decoder.
76 # Argument set examples:
79 # &loadstore reg base offset
83 # fmt_def := '@' identifier ( fmt_elt )+
84 # fmt_elt := fixedbit_elt | field_elt | field_ref | args_ref
85 # fixedbit_elt := [01.-]+
86 # field_elt := identifier ':' 's'? number
87 # field_ref := '%' identifier | identifier '=' '%' identifier
88 # args_ref := '&' identifier
90 # Defining a format is a handy way to avoid replicating groups of fields
91 # across many instruction patterns.
93 # A fixedbit_elt describes a contiguous sequence of bits that must
94 # be 1, 0, [.-] for don't care. The difference between '.' and '-'
95 # is that '.' means that the bit will be covered with a field or a
96 # final [01] from the pattern, and '-' means that the bit is really
97 # ignored by the cpu and will not be specified.
99 # A field_elt describes a simple field only given a width; the position of
100 # the field is implied by its position with respect to other fixedbit_elt
103 # If any fixedbit_elt or field_elt appear then all bits must be defined.
104 # Padding with a fixedbit_elt of all '.' is an easy way to accomplish that.
106 # A field_ref incorporates a field by reference. This is the only way to
107 # add a complex field to a format. A field may be renamed in the process
108 # via assignment to another identifier. This is intended to allow the
109 # same argument set be used with disjoint named fields.
111 # A single args_ref may specify an argument set to use for the format.
112 # The set of fields in the format must be a subset of the arguments in
113 # the argument set. If an argument set is not specified, one will be
114 # inferred from the set of fields.
116 # It is recommended, but not required, that all field_ref and args_ref
117 # appear at the end of the line, not interleaving with fixedbit_elf or
122 # @opr ...... ra:5 rb:5 ... 0 ....... rc:5
123 # @opi ...... ra:5 lit:8 1 ....... rc:5
125 # *** Pattern syntax:
127 # pat_def := identifier ( pat_elt )+
128 # pat_elt := fixedbit_elt | field_elt | field_ref
129 # | args_ref | fmt_ref | const_elt
130 # fmt_ref := '@' identifier
131 # const_elt := identifier '=' number
133 # The fixedbit_elt and field_elt specifiers are unchanged from formats.
134 # A pattern that does not specify a named format will have one inferred
135 # from a referenced argument set (if present) and the set of fields.
137 # A const_elt allows a argument to be set to a constant value. This may
138 # come in handy when fields overlap between patterns and one has to
139 # include the values in the fixedbit_elt instead.
141 # The decoder will call a translator function for each pattern matched.
145 # addl_r 010000 ..... ..... .... 0000000 ..... @opr
146 # addl_i 010000 ..... ..... .... 0000000 ..... @opi
148 # which will, in part, invoke
150 # trans_addl_r(ctx, &arg_opr, insn)
152 # trans_addl_i(ctx, &arg_opi, insn)
161 insnmask
= 0xffffffff
167 translate_prefix
= 'trans'
168 translate_scope
= 'static '
172 insntype
= 'uint32_t'
173 decode_function
= 'decode'
175 re_ident
= '[a-zA-Z][a-zA-Z0-9_]*'
178 def error(lineno
, *args
):
179 """Print an error message from file:line and args and exit."""
184 r
= '{0}:{1}: error:'.format(input_file
, lineno
)
186 r
= '{0}: error:'.format(input_file
)
193 if output_file
and output_fd
:
195 os
.remove(output_file
)
205 if sys
.version_info
>= (3, 0):
206 re_fullmatch
= re
.fullmatch
208 def re_fullmatch(pat
, str):
209 return re
.match('^' + pat
+ '$', str)
212 def output_autogen():
213 output('/* This file is autogenerated by scripts/decodetree.py. */\n\n')
217 """Return a string with C spaces"""
221 def str_fields(fields
):
222 """Return a string uniquely identifing FIELDS"""
224 for n
in sorted(fields
.keys()):
229 def str_match_bits(bits
, mask
):
230 """Return a string pretty-printing BITS/MASK"""
233 i
= 1 << (insnwidth
- 1)
251 """Return true iff X is equal to a power of 2."""
252 return (x
& (x
- 1)) == 0
256 """Return the number of times 2 factors into X."""
258 while ((x
>> r
) & 1) == 0:
263 def is_contiguous(bits
):
265 if is_pow2((bits
>> shift
) + 1):
271 def eq_fields_for_args(flds_a
, flds_b
):
272 if len(flds_a
) != len(flds_b
):
274 for k
, a
in flds_a
.items():
280 def eq_fields_for_fmts(flds_a
, flds_b
):
281 if len(flds_a
) != len(flds_b
):
283 for k
, a
in flds_a
.items():
287 if a
.__class
__ != b
.__class
__ or a
!= b
:
293 """Class representing a simple instruction field"""
294 def __init__(self
, sign
, pos
, len):
298 self
.mask
= ((1 << len) - 1) << pos
305 return str(pos
) + ':' + s
+ str(len)
307 def str_extract(self
):
312 return '{0}(insn, {1}, {2})'.format(extr
, self
.pos
, self
.len)
314 def __eq__(self
, other
):
315 return self
.sign
== other
.sign
and self
.sign
== other
.sign
317 def __ne__(self
, other
):
318 return not self
.__eq
__(other
)
323 """Class representing a compound instruction field"""
324 def __init__(self
, subs
, mask
):
326 self
.sign
= subs
[0].sign
330 return str(self
.subs
)
332 def str_extract(self
):
335 for f
in reversed(self
.subs
):
337 ret
= f
.str_extract()
339 ret
= 'deposit32({0}, {1}, {2}, {3})' \
340 .format(ret
, pos
, 32 - pos
, f
.str_extract())
344 def __ne__(self
, other
):
345 if len(self
.subs
) != len(other
.subs
):
347 for a
, b
in zip(self
.subs
, other
.subs
):
348 if a
.__class
__ != b
.__class
__ or a
!= b
:
352 def __eq__(self
, other
):
353 return not self
.__ne
__(other
)
358 """Class representing an argument field with constant value"""
359 def __init__(self
, value
):
362 self
.sign
= value
< 0
365 return str(self
.value
)
367 def str_extract(self
):
368 return str(self
.value
)
370 def __cmp__(self
, other
):
371 return self
.value
- other
.value
376 """Class representing a field passed through an expander"""
377 def __init__(self
, func
, base
):
378 self
.mask
= base
.mask
379 self
.sign
= base
.sign
384 return self
.func
+ '(' + str(self
.base
) + ')'
386 def str_extract(self
):
387 return self
.func
+ '(' + self
.base
.str_extract() + ')'
389 def __eq__(self
, other
):
390 return self
.func
== other
.func
and self
.base
== other
.base
392 def __ne__(self
, other
):
393 return not self
.__eq
__(other
)
398 """Class representing the extracted fields of a format"""
399 def __init__(self
, nm
, flds
, extern
):
402 self
.fields
= sorted(flds
)
405 return self
.name
+ ' ' + str(self
.fields
)
407 def struct_name(self
):
408 return 'arg_' + self
.name
410 def output_def(self
):
412 output('typedef struct {\n')
413 for n
in self
.fields
:
414 output(' int ', n
, ';\n')
415 output('} ', self
.struct_name(), ';\n\n')
420 """Common code between instruction formats and instruction patterns"""
421 def __init__(self
, name
, lineno
, base
, fixb
, fixm
, udfm
, fldm
, flds
):
425 self
.fixedbits
= fixb
426 self
.fixedmask
= fixm
427 self
.undefmask
= udfm
428 self
.fieldmask
= fldm
434 r
= r
+ ' ' + self
.base
.name
436 r
= r
+ ' ' + str(self
.fields
)
437 r
= r
+ ' ' + str_match_bits(self
.fixedbits
, self
.fixedmask
)
441 return str_indent(i
) + self
.__str
__()
445 class Format(General
):
446 """Class representing an instruction format"""
448 def extract_name(self
):
449 return 'extract_' + self
.name
451 def output_extract(self
):
452 output('static void ', self
.extract_name(), '(',
453 self
.base
.struct_name(), ' *a, ', insntype
, ' insn)\n{\n')
454 for n
, f
in self
.fields
.items():
455 output(' a->', n
, ' = ', f
.str_extract(), ';\n')
460 class Pattern(General
):
461 """Class representing an instruction pattern"""
463 def output_decl(self
):
464 global translate_scope
465 global translate_prefix
466 output('typedef ', self
.base
.base
.struct_name(),
467 ' arg_', self
.name
, ';\n')
468 output(translate_scope
, 'bool ', translate_prefix
, '_', self
.name
,
469 '(DisasContext *ctx, arg_', self
.name
, ' *a);\n')
471 def output_code(self
, i
, extracted
, outerbits
, outermask
):
472 global translate_prefix
474 arg
= self
.base
.base
.name
475 output(ind
, '/* line ', str(self
.lineno
), ' */\n')
477 output(ind
, self
.base
.extract_name(), '(&u.f_', arg
, ', insn);\n')
478 for n
, f
in self
.fields
.items():
479 output(ind
, 'u.f_', arg
, '.', n
, ' = ', f
.str_extract(), ';\n')
480 output(ind
, 'return ', translate_prefix
, '_', self
.name
,
481 '(ctx, &u.f_', arg
, ');\n')
485 def parse_field(lineno
, name
, toks
):
486 """Parse one instruction field from TOKS at LINENO"""
491 # A "simple" field will have only one entry;
492 # a "multifield" will have several.
497 if re_fullmatch('!function=' + re_ident
, t
):
499 error(lineno
, 'duplicate function')
504 if re_fullmatch('[0-9]+:s[0-9]+', t
):
505 # Signed field extract
506 subtoks
= t
.split(':s')
508 elif re_fullmatch('[0-9]+:[0-9]+', t
):
509 # Unsigned field extract
510 subtoks
= t
.split(':')
513 error(lineno
, 'invalid field token "{0}"'.format(t
))
516 if po
+ le
> insnwidth
:
517 error(lineno
, 'field {0} too large'.format(t
))
518 f
= Field(sign
, po
, le
)
522 if width
> insnwidth
:
523 error(lineno
, 'field too large')
530 error(lineno
, 'field components overlap')
532 f
= MultiField(subs
, mask
)
534 f
= FunctionField(func
, f
)
537 error(lineno
, 'duplicate field', name
)
542 def parse_arguments(lineno
, name
, toks
):
543 """Parse one argument set from TOKS at LINENO"""
550 if re_fullmatch('!extern', t
):
553 if not re_fullmatch(re_ident
, t
):
554 error(lineno
, 'invalid argument set token "{0}"'.format(t
))
556 error(lineno
, 'duplicate argument "{0}"'.format(t
))
559 if name
in arguments
:
560 error(lineno
, 'duplicate argument set', name
)
561 arguments
[name
] = Arguments(name
, flds
, extern
)
562 # end parse_arguments
565 def lookup_field(lineno
, name
):
569 error(lineno
, 'undefined field', name
)
572 def add_field(lineno
, flds
, new_name
, f
):
574 error(lineno
, 'duplicate field', new_name
)
579 def add_field_byname(lineno
, flds
, new_name
, old_name
):
580 return add_field(lineno
, flds
, new_name
, lookup_field(lineno
, old_name
))
583 def infer_argument_set(flds
):
585 global decode_function
587 for arg
in arguments
.values():
588 if eq_fields_for_args(flds
, arg
.fields
):
591 name
= decode_function
+ str(len(arguments
))
592 arg
= Arguments(name
, flds
.keys(), False)
593 arguments
[name
] = arg
597 def infer_format(arg
, fieldmask
, flds
):
600 global decode_function
604 for n
, c
in flds
.items():
610 # Look for an existing format with the same argument set and fields
611 for fmt
in formats
.values():
612 if arg
and fmt
.base
!= arg
:
614 if fieldmask
!= fmt
.fieldmask
:
616 if not eq_fields_for_fmts(flds
, fmt
.fields
):
618 return (fmt
, const_flds
)
620 name
= decode_function
+ '_Fmt_' + str(len(formats
))
622 arg
= infer_argument_set(flds
)
624 fmt
= Format(name
, 0, arg
, 0, 0, 0, fieldmask
, var_flds
)
627 return (fmt
, const_flds
)
631 def parse_generic(lineno
, is_format
, name
, toks
):
632 """Parse one instruction format from TOKS at LINENO"""
649 # '&Foo' gives a format an explcit argument set.
653 error(lineno
, 'multiple argument sets')
657 error(lineno
, 'undefined argument set', t
)
660 # '@Foo' gives a pattern an explicit format.
664 error(lineno
, 'multiple formats')
668 error(lineno
, 'undefined format', t
)
671 # '%Foo' imports a field.
674 flds
= add_field_byname(lineno
, flds
, tt
, tt
)
677 # 'Foo=%Bar' imports a field with a different name.
678 if re_fullmatch(re_ident
+ '=%' + re_ident
, t
):
679 (fname
, iname
) = t
.split('=%')
680 flds
= add_field_byname(lineno
, flds
, fname
, iname
)
683 # 'Foo=number' sets an argument field to a constant value
684 if re_fullmatch(re_ident
+ '=[0-9]+', t
):
685 (fname
, value
) = t
.split('=')
687 flds
= add_field(lineno
, flds
, fname
, ConstField(value
))
690 # Pattern of 0s, 1s, dots and dashes indicate required zeros,
691 # required ones, or dont-cares.
692 if re_fullmatch('[01.-]+', t
):
694 fms
= t
.replace('0', '1')
695 fms
= fms
.replace('.', '0')
696 fms
= fms
.replace('-', '0')
697 fbs
= t
.replace('.', '0')
698 fbs
= fbs
.replace('-', '0')
699 ubm
= t
.replace('1', '0')
700 ubm
= ubm
.replace('.', '0')
701 ubm
= ubm
.replace('-', '1')
705 fixedbits
= (fixedbits
<< shift
) | fbs
706 fixedmask
= (fixedmask
<< shift
) | fms
707 undefmask
= (undefmask
<< shift
) | ubm
708 # Otherwise, fieldname:fieldwidth
709 elif re_fullmatch(re_ident
+ ':s?[0-9]+', t
):
710 (fname
, flen
) = t
.split(':')
715 shift
= int(flen
, 10)
716 f
= Field(sign
, insnwidth
- width
- shift
, shift
)
717 flds
= add_field(lineno
, flds
, fname
, f
)
722 error(lineno
, 'invalid token "{0}"'.format(t
))
725 # We should have filled in all of the bits of the instruction.
726 if not (is_format
and width
== 0) and width
!= insnwidth
:
727 error(lineno
, 'definition has {0} bits'.format(width
))
729 # Do not check for fields overlaping fields; one valid usage
730 # is to be able to duplicate fields via import.
732 for f
in flds
.values():
735 # Fix up what we've parsed to match either a format or a pattern.
737 # Formats cannot reference formats.
739 error(lineno
, 'format referencing format')
740 # If an argument set is given, then there should be no fields
741 # without a place to store it.
743 for f
in flds
.keys():
744 if f
not in arg
.fields
:
745 error(lineno
, 'field {0} not in argument set {1}'
746 .format(f
, arg
.name
))
748 arg
= infer_argument_set(flds
)
750 error(lineno
, 'duplicate format name', name
)
751 fmt
= Format(name
, lineno
, arg
, fixedbits
, fixedmask
,
752 undefmask
, fieldmask
, flds
)
755 # Patterns can reference a format ...
757 # ... but not an argument simultaneously
759 error(lineno
, 'pattern specifies both format and argument set')
760 if fixedmask
& fmt
.fixedmask
:
761 error(lineno
, 'pattern fixed bits overlap format fixed bits')
762 fieldmask |
= fmt
.fieldmask
763 fixedbits |
= fmt
.fixedbits
764 fixedmask |
= fmt
.fixedmask
765 undefmask |
= fmt
.undefmask
767 (fmt
, flds
) = infer_format(arg
, fieldmask
, flds
)
769 for f
in flds
.keys():
770 if f
not in arg
.fields
:
771 error(lineno
, 'field {0} not in argument set {1}'
772 .format(f
, arg
.name
))
773 if f
in fmt
.fields
.keys():
774 error(lineno
, 'field {0} set by format and pattern'.format(f
))
776 if f
not in flds
.keys() and f
not in fmt
.fields
.keys():
777 error(lineno
, 'field {0} not initialized'.format(f
))
778 pat
= Pattern(name
, lineno
, fmt
, fixedbits
, fixedmask
,
779 undefmask
, fieldmask
, flds
)
782 # Validate the masks that we have assembled.
783 if fieldmask
& fixedmask
:
784 error(lineno
, 'fieldmask overlaps fixedmask (0x{0:08x} & 0x{1:08x})'
785 .format(fieldmask
, fixedmask
))
786 if fieldmask
& undefmask
:
787 error(lineno
, 'fieldmask overlaps undefmask (0x{0:08x} & 0x{1:08x})'
788 .format(fieldmask
, undefmask
))
789 if fixedmask
& undefmask
:
790 error(lineno
, 'fixedmask overlaps undefmask (0x{0:08x} & 0x{1:08x})'
791 .format(fixedmask
, undefmask
))
793 allbits
= fieldmask | fixedmask | undefmask
794 if allbits
!= insnmask
:
795 error(lineno
, 'bits left unspecified (0x{0:08x})'
796 .format(allbits ^ insnmask
))
801 """Parse all of the patterns within a file"""
803 # Read all of the lines of the file. Concatenate lines
804 # ending in backslash; discard empty lines and comments.
817 # Next line after continuation
831 error(lineno
, 'short line')
836 # Determine the type of object needing to be parsed.
838 parse_field(lineno
, name
[1:], toks
)
840 parse_arguments(lineno
, name
[1:], toks
)
842 parse_generic(lineno
, True, name
[1:], toks
)
844 parse_generic(lineno
, False, name
, toks
)
850 """Class representing a node in a decode tree"""
852 def __init__(self
, fm
, tm
):
860 r
= '{0}{1:08x}'.format(ind
, self
.fixedmask
)
862 r
+= ' ' + self
.format
.name
864 for (b
, s
) in self
.subs
:
865 r
+= '{0} {1:08x}:\n'.format(ind
, b
)
866 r
+= s
.str1(i
+ 4) + '\n'
873 def output_code(self
, i
, extracted
, outerbits
, outermask
):
876 # If we identified all nodes below have the same format,
877 # extract the fields now.
878 if not extracted
and self
.base
:
879 output(ind
, self
.base
.extract_name(),
880 '(&u.f_', self
.base
.base
.name
, ', insn);\n')
883 # Attempt to aid the compiler in producing compact switch statements.
884 # If the bits in the mask are contiguous, extract them.
885 sh
= is_contiguous(self
.thismask
)
887 # Propagate SH down into the local functions.
888 def str_switch(b
, sh
=sh
):
889 return '(insn >> {0}) & 0x{1:x}'.format(sh
, b
>> sh
)
891 def str_case(b
, sh
=sh
):
892 return '0x{0:x}'.format(b
>> sh
)
895 return 'insn & 0x{0:08x}'.format(b
)
898 return '0x{0:08x}'.format(b
)
900 output(ind
, 'switch (', str_switch(self
.thismask
), ') {\n')
901 for b
, s
in sorted(self
.subs
):
902 assert (self
.thismask
& ~s
.fixedmask
) == 0
903 innermask
= outermask | self
.thismask
904 innerbits
= outerbits | b
905 output(ind
, 'case ', str_case(b
), ':\n')
907 str_match_bits(innerbits
, innermask
), ' */\n')
908 s
.output_code(i
+ 4, extracted
, innerbits
, innermask
)
910 output(ind
, 'return false;\n')
914 def build_tree(pats
, outerbits
, outermask
):
915 # Find the intersection of all remaining fixedmask.
916 innermask
= ~outermask
918 innermask
&= i
.fixedmask
923 pnames
.append(p
.name
+ ':' + str(p
.lineno
))
924 error(pats
[0].lineno
, 'overlapping patterns:', pnames
)
926 fullmask
= outermask | innermask
928 # Sort each element of pats into the bin selected by the mask.
931 fb
= i
.fixedbits
& innermask
937 # We must recurse if any bin has more than one element or if
938 # the single element in the bin has not been fully matched.
939 t
= Tree(fullmask
, innermask
)
941 for b
, l
in bins
.items():
943 if len(l
) > 1 or s
.fixedmask
& ~fullmask
!= 0:
944 s
= build_tree(l
, b | outerbits
, fullmask
)
945 t
.subs
.append((b
, s
))
951 def prop_format(tree
):
952 """Propagate Format objects into the decode tree"""
954 # Depth first search.
955 for (b
, s
) in tree
.subs
:
956 if isinstance(s
, Tree
):
959 # If all entries in SUBS have the same format, then
960 # propagate that into the tree.
962 for (b
, s
) in tree
.subs
:
977 global translate_scope
978 global translate_prefix
985 global decode_function
987 decode_scope
= 'static '
989 long_opts
= ['decode=', 'translate=', 'output=', 'insnwidth=']
991 (opts
, args
) = getopt
.getopt(sys
.argv
[1:], 'o:w:', long_opts
)
992 except getopt
.GetoptError
as err
:
995 if o
in ('-o', '--output'):
997 elif o
== '--decode':
1000 elif o
== '--translate':
1001 translate_prefix
= a
1002 translate_scope
= ''
1003 elif o
in ('-w', '--insnwidth'):
1006 insntype
= 'uint16_t'
1008 elif insnwidth
!= 32:
1009 error(0, 'cannot handle insns of width', insnwidth
)
1011 assert False, 'unhandled option'
1014 error(0, 'missing input file')
1015 input_file
= args
[0]
1016 f
= open(input_file
, 'r')
1020 t
= build_tree(patterns
, 0, 0)
1024 output_fd
= open(output_file
, 'w')
1026 output_fd
= sys
.stdout
1029 for n
in sorted(arguments
.keys()):
1033 # A single translate function can be invoked for different patterns.
1034 # Make sure that the argument sets are the same, and declare the
1035 # function only once.
1038 if i
.name
in out_pats
:
1039 p
= out_pats
[i
.name
]
1040 if i
.base
.base
!= p
.base
.base
:
1041 error(0, i
.name
, ' has conflicting argument sets')
1044 out_pats
[i
.name
] = i
1047 for n
in sorted(formats
.keys()):
1051 output(decode_scope
, 'bool ', decode_function
,
1052 '(DisasContext *ctx, ', insntype
, ' insn)\n{\n')
1055 output(i4
, 'union {\n')
1056 for n
in sorted(arguments
.keys()):
1058 output(i4
, i4
, f
.struct_name(), ' f_', f
.name
, ';\n')
1059 output(i4
, '} u;\n\n')
1061 t
.output_code(4, False, 0, 0)
1070 if __name__
== '__main__':