|
@@ -33,6 +33,27 @@ UNARY_INTRINSICS = {
|
|
|
'float_neg' : '-'
|
|
|
}
|
|
|
|
|
|
+# Don't compain about the variable names, pylint. It's important that we
|
|
|
+# get them right.
|
|
|
+# pylint: disable=I0011,C0103
|
|
|
+def __set_add(a, b):
|
|
|
+ tmp = tree_ir.StoreLocalInstruction(None, a)
|
|
|
+ return tree_ir.create_block(
|
|
|
+ tmp,
|
|
|
+ tree_ir.CreateEdgeInstruction(tmp.create_load(), b),
|
|
|
+ tmp.create_load())
|
|
|
+
|
|
|
+def __dict_add(a, b, c):
|
|
|
+ a_tmp = tree_ir.StoreLocalInstruction(None, a)
|
|
|
+ b_tmp = tree_ir.StoreLocalInstruction(None, b)
|
|
|
+ return tree_ir.create_block(
|
|
|
+ a_tmp,
|
|
|
+ b_tmp,
|
|
|
+ tree_ir.CreateEdgeInstruction(
|
|
|
+ tree_ir.CreateEdgeInstruction(a_tmp.create_load(), c),
|
|
|
+ b_tmp.create_load()),
|
|
|
+ a_tmp.create_load())
|
|
|
+
|
|
|
MISC_INTRINSICS = {
|
|
|
# Reference equality
|
|
|
'element_eq' :
|
|
@@ -111,6 +132,13 @@ MISC_INTRINSICS = {
|
|
|
'is not',
|
|
|
tree_ir.LiteralInstruction(None))),
|
|
|
|
|
|
+ # read_root
|
|
|
+ 'read_root' :
|
|
|
+ lambda:
|
|
|
+ tree_ir.LoadIndexInstruction(
|
|
|
+ tree_ir.LoadLocalInstruction(jit.KWARGS_PARAMETER_NAME),
|
|
|
+ tree_ir.LiteralInstruction('root')),
|
|
|
+
|
|
|
# Dictionary operations
|
|
|
'dict_read' :
|
|
|
lambda a, b:
|
|
@@ -120,7 +148,12 @@ MISC_INTRINSICS = {
|
|
|
'dict_read_edge' :
|
|
|
lambda a, b:
|
|
|
tree_ir.ReadDictionaryEdgeInstruction(
|
|
|
- a, tree_ir.ReadValueInstruction(b))
|
|
|
+ a, tree_ir.ReadValueInstruction(b)),
|
|
|
+
|
|
|
+ 'dict_add' : __dict_add,
|
|
|
+
|
|
|
+ # Set operations
|
|
|
+ 'set_add' : __set_add
|
|
|
}
|
|
|
|
|
|
def register_intrinsics(target_jit):
|