assert m and m.group('name') is not None
self.var_name = m.group('name')
+
+ # Prevent common cases where someone puts quotes around a literal
+ # constant. If we want to support names that have numeric or
+ # punctuation characters, we can me the first assertion more flexible.
+ assert self.var_name.isalpha()
+ assert self.var_name is not 'True'
+ assert self.var_name is not 'False'
+
self.is_constant = m.group('const') is not None
self.cond = m.group('cond')
self.required_type = m.group('type')
#
# All expression types can have a bit-size specified. For opcodes, this
# looks like "op@32", for variables it is "a@32" or "a@uint32" to specify a
-# type and size, and for literals, you can write "2.0@32". In the search half
-# of the expression this indicates that it should only match that particular
-# bit-size. In the replace half of the expression this indicates that the
-# constructed value should have that bit-size.
+# type and size. In the search half of the expression this indicates that it
+# should only match that particular bit-size. In the replace half of the
+# expression this indicates that the constructed value should have that
+# bit-size.
optimizations = [
(('ieq', ('ineg', ('b2i', 'a@1')), -1), a),
(('ine', ('ineg', ('b2i', 'a@1')), 0), a),
(('ine', ('ineg', ('b2i', 'a@1')), -1), ('inot', a)),
- (('iand', ('ineg', ('b2i', a)), '1.0@32'), ('b2f', a)),
+ (('iand', ('ineg', ('b2i', a)), 1.0), ('b2f', a)),
# Conversions
(('i2b32', ('b2i', 'a@32')), a),