Lines Matching +full:io +full:- +full:width
23 import io
50 re_C_ident = '[a-zA-Z][a-zA-Z0-9_]*'
53 re_arg_ident = '&[a-zA-Z0-9_]*'
54 re_fld_ident = '%[a-zA-Z0-9_]*'
55 re_fmt_ident = '@[a-zA-Z0-9_]*'
56 re_pat_ident = '[a-zA-Z0-9_]*'
70 # (That is, if graph contains "A" -> ["B", "C"] then we must output
85 # https://code.activestate.com/recipes/578272-topological-sort/
112 - set(data.keys()))
120 data = {item: (dep - ordered)
137 # For the test suite expected-errors case, don't print the
204 """Return a string pretty-printing BITS/MASK"""
207 i = 1 << (insnwidth - 1)
226 return (x & (x - 1)) == 0
240 return -1
245 return -1
279 self.mask = ((1 << len) - 1) << pos
323 ret = f'deposit{bitop_width}({ret}, {pos}, {bitop_width - pos}, {ext})'
363 return self.value - other.value
394 """Class representing a pseudo-field read from a function"""
477 self.width = w
528 # Pretty-print it to tell the user.
544 self.output_fields(str_indent(4), lambda n: 'a->' + n)
622 self.width = None
674 width = None
677 if width is None:
678 width = p.width
679 elif width != p.width:
681 'width mismatch in patterns within braces')
682 self.width = width
780 """Class representing a non-overlapping set of instruction patterns"""
870 width = 0
880 if re.fullmatch(re_C_ident + ':s[0-9]+', t):
887 width += le
889 if re.fullmatch(re_C_ident + ':[0-9]+', t):
896 width += le
899 if re.fullmatch('[0-9]+:s[0-9]+', t):
903 elif re.fullmatch('[0-9]+:[0-9]+', t):
915 width += le
917 if width > insnwidth:
1006 def infer_format(arg, fieldmask, flds, width): argument
1025 if width != fmt.width:
1035 fmt = Format(name, 0, arg, 0, 0, 0, fieldmask, var_flds, width)
1061 width = 0
1101 if re.fullmatch(re_C_ident + '=[+-]?[0-9]+', t):
1108 # required ones, or dont-cares.
1109 if re.fullmatch('[01.-]+', t):
1113 fms = fms.replace('-', '0')
1115 fbs = fbs.replace('-', '0')
1118 ubm = ubm.replace('-', '1')
1126 elif re.fullmatch(re_C_ident + ':s?[0-9]+', t):
1133 if shift + width > insnwidth:
1135 f = Field(sign, insnwidth - width - shift, shift)
1142 width += shift
1144 if variablewidth and width < insnwidth and width % 8 == 0:
1145 shift = insnwidth - width
1149 undefmask |= (1 << shift) - 1
1152 elif not (is_format and width == 0) and width != insnwidth:
1153 error(lineno, f'definition has {width} bits')
1177 undefmask, fieldmask, flds, width)
1187 if width != fmt.width:
1188 error(lineno, 'pattern uses format of different width')
1194 (fmt, flds) = infer_format(arg, fieldmask, flds, width)
1205 undefmask, fieldmask, flds, width)
1264 indent = len1 - len2
1275 if toks[-1] == '\\':
1296 nesting -= 2
1349 self.width = w
1367 if extracted < self.width:
1369 f'(ctx, insn, {extracted // 8}, {self.width // 8});\n')
1370 extracted = self.width
1406 self.width = w
1419 if extracted < self.width:
1421 f'(ctx, insn, {extracted // 8}, {self.width // 8});\n')
1422 extracted = self.width
1427 def build_size_tree(pats, width, outerbits, outermask): argument
1430 # Collect the mask of bits that are fixed in this width
1431 innermask = 0xff << (insnwidth - width)
1438 minwidth = i.width
1439 elif minwidth != i.width:
1441 if minwidth < i.width:
1442 minwidth = i.width
1448 if width < minwidth:
1449 return build_size_tree(pats, width + 8, outerbits, outermask)
1455 f'overlapping patterns size {width}:', pnames)
1469 return build_size_tree(bins[b], width + 8, b | outerbits, fullmask)
1471 r = SizeTree(innermask, width)
1473 s = build_size_tree(l, width, b | outerbits, fullmask)
1485 width = prop_size(s)
1486 if min is None or min > width:
1487 min = width
1488 assert min >= tree.width
1489 tree.width = min
1491 min = tree.width
1518 'static-decode=', 'varinsnwidth=', 'test-for-error',
1519 'output-null']
1525 if o in ('-o', '--output'):
1527 elif o == '--decode':
1530 elif o == '--static-decode':
1532 elif o == '--translate':
1535 elif o in ('-w', '--insnwidth', '--varinsnwidth'):
1536 if o == '--varinsnwidth':
1547 error(0, 'cannot handle insns of width', insnwidth)
1548 elif o == '--test-for-error':
1550 elif o == '--output-null':
1562 f = open(filename, 'rt', encoding='utf-8')
1582 output_fd = open(os.devnull, 'wt', encoding='utf-8', errors="ignore")
1584 output_fd = open(output_file, 'wt', encoding='utf-8')
1586 output_fd = io.TextIOWrapper(sys.stdout.buffer,
1604 "#pragma GCC diagnostic ignored \"-Wredundant-decls\"\n",
1606 "# pragma GCC diagnostic ignored \"-Wtypedef-redefinition\"\n",