|
@@ -370,10 +370,20 @@ class ModelverseJit(object):
|
|
|
|
|
|
def register_unary_intrinsic(self, name, operator):
|
|
|
"""Registers an intrinsic with the JIT that represents the given unary operation."""
|
|
|
- self.register_intrinsic(name, lambda a: tree_ir.CreateNodeWithValueInstruction(
|
|
|
- tree_ir.UnaryInstruction(
|
|
|
- operator,
|
|
|
- tree_ir.ReadValueInstruction(a))))
|
|
|
+ self.register_intrinsic(
|
|
|
+ name,
|
|
|
+ lambda a:
|
|
|
+ tree_ir.CreateNodeWithValueInstruction(
|
|
|
+ tree_ir.UnaryInstruction(
|
|
|
+ operator,
|
|
|
+ tree_ir.ReadValueInstruction(a))),
|
|
|
+ lambda original_def, a:
|
|
|
+ original_def.redefine(
|
|
|
+ cfg_ir.CreateNode(
|
|
|
+ original_def.insert_before(
|
|
|
+ cfg_ir.Unary(
|
|
|
+ operator,
|
|
|
+ original_def.insert_before(cfg_ir.Read(a)))))))
|
|
|
|
|
|
def register_cast_intrinsic(self, name, target_type):
|
|
|
"""Registers an intrinsic with the JIT that represents a unary conversion operator."""
|