19 """check if the left hand side is width * (ID + 1) - 1
20 returns result, width, ID
22 failed =
False,
None,
None
23 if not isinstance(tr, Tree)
or len(tr.children) != 3:
25 is_offset_1 = tr.children[0] ==
'-' and isinstance(tr.children[2], Tree)
and tr.children[2].children[0] == 1
28 mult_part = tr.children[1]
29 if not isinstance(mult_part, Tree)
or mult_part.data !=
'hbinop' or mult_part.children[0] !=
'*':
31 op0, op1 = mult_part.children[1:]
33 width = op0.children[0]
36 width = op1.children[0]
40 if not isinstance(idx, Tree)
or idx.data !=
'hbinop' or idx.children[0] !=
'+':
42 op0, op1 = idx.children[1:]
43 if self.
__is_literal_node(op0)
and op0.children[0] == 1
and len(op1.children) == 1
and op1.data ==
'hvarref':
45 return True, width, id
46 elif self.
__is_literal_node(op1)
and op1.children[0] == 1
and len(op0.children) == 1
and op0.data ==
'hvarref':
48 return True, width, id