43 if isinstance(a[0], m2_expr.ExprInt):
47 sources_int[a[1]] = (m2_expr.ExprInt(int(a[0].arg),
51 elif isinstance(a[0], m2_expr.ExprSlice):
52 if not a[0].arg
in sources:
53 sources[a[0].arg] = []
54 sources[a[0].arg].append(a)
60 if max_size
is None or max_size < a[2]:
66 for x
in sources_int.values():
69 v = x[0].arg & ((1 << (x[2] - x[1])) - 1)
70 x[0] = m2_expr.ExprInt_from(x[0], v)
72 sorted_s.append((x[1], x))
75 start, v = sorted_s.pop()
76 out = [m2_expr.ExprInt(v[0].arg), v[1], v[2]]
79 if sorted_s[-1][1][2] != start:
81 s_start, s_stop = sorted_s[-1][1][1], sorted_s[-1][1][2]
82 size += s_stop - s_start
83 a = m2_expr.mod_size2uint[size](
84 (int(out[0].arg) << (out[1] - s_start)) +
85 int(sorted_s[-1][1][0].arg))
86 out[0] = m2_expr.ExprInt(a)
89 out[0] = m2_expr.ExprInt(int(out[0].arg), size)
90 final_sources.append((start, out))
92 final_sources_int = final_sources
96 for args
in sources.values():
100 sorted_s.append((x[1], x))
103 start, v = sorted_s.pop()
104 ee = v[0].arg[v[0].start:v[0].stop]
107 if sorted_s[-1][1][2] != start:
109 if sorted_s[-1][1][0].stop != out[0].start:
112 start = sorted_s[-1][1][1]
115 o1, o2 = sorted_s[-1][1][0].start, o_e.stop
117 out = o_e, start, o_stop
121 out = out[0], start, out[2]
123 final_sources.append((start, out))
125 simp_sources += final_sources
127 simp_sources += final_sources_int
129 for i, v
in non_slice.items():
130 simp_sources.append((i, v))
133 simp_sources = [x[1]
for x
in simp_sources]