% endif
};""")
- def __init__(self, name, type_str):
+ def __init__(self, val, name, type_str):
+ self.in_val = str(val)
self.name = name
self.type_str = type_str
+ def __str__(self):
+ return self.in_val
+
@property
def type_enum(self):
return "nir_search_value_" + self.type_str
class Constant(Value):
def __init__(self, val, name):
- Value.__init__(self, name, "constant")
+ Value.__init__(self, val, name, "constant")
+ self.in_val = str(val)
if isinstance(val, (str)):
m = _constant_re.match(val)
self.value = ast.literal_eval(m.group('value'))
class Variable(Value):
def __init__(self, val, name, varset):
- Value.__init__(self, name, "variable")
+ Value.__init__(self, val, name, "variable")
m = _var_name_re.match(val)
assert m and m.group('name') is not None
self.index = varset[self.var_name]
+ def __str__(self):
+ return self.in_val
+
def type(self):
if self.required_type == 'bool':
return "nir_type_bool"
class Expression(Value):
def __init__(self, expr, name_base, varset):
- Value.__init__(self, name_base, "expression")
+ Value.__init__(self, expr, name_base, "expression")
assert isinstance(expr, tuple)
m = _opcode_re.match(expr[0])