|
19 | 19 | from mypyc.ir.ops import (
|
20 | 20 | BasicBlock, Environment, Op, LoadInt, Value, Register,
|
21 | 21 | Assign, Branch, Goto, Call, Box, Unbox, Cast, GetAttr,
|
22 |
| - LoadStatic, MethodCall, PrimitiveOp, OpDescription, RegisterOp, CallC, Truncate, |
| 22 | + LoadStatic, MethodCall, RegisterOp, CallC, Truncate, |
23 | 23 | RaiseStandardError, Unreachable, LoadErrorValue, LoadGlobal,
|
24 | 24 | NAMESPACE_TYPE, NAMESPACE_MODULE, NAMESPACE_STATIC, BinaryIntOp, GetElementPtr,
|
25 | 25 | LoadMem, ComparisonOp, LoadAddress, TupleGet, SetMem, ERR_NEVER, ERR_FALSE
|
|
39 | 39 | STATIC_PREFIX, PLATFORM_SIZE
|
40 | 40 | )
|
41 | 41 | from mypyc.primitives.registry import (
|
42 |
| - func_ops, c_method_call_ops, CFunctionDescription, c_function_ops, |
| 42 | + c_method_call_ops, CFunctionDescription, c_function_ops, |
43 | 43 | c_binary_ops, c_unary_ops, ERR_NEG_INT
|
44 | 44 | )
|
45 | 45 | from mypyc.primitives.list_ops import (
|
@@ -513,48 +513,6 @@ def load_native_type_object(self, fullname: str) -> Value:
|
513 | 513 | return self.add(LoadStatic(object_rprimitive, name, module, NAMESPACE_TYPE))
|
514 | 514 |
|
515 | 515 | # Other primitive operations
|
516 |
| - |
517 |
| - def primitive_op(self, desc: OpDescription, args: List[Value], line: int) -> Value: |
518 |
| - assert desc.result_type is not None |
519 |
| - coerced = [] |
520 |
| - for i, arg in enumerate(args): |
521 |
| - formal_type = self.op_arg_type(desc, i) |
522 |
| - arg = self.coerce(arg, formal_type, line) |
523 |
| - coerced.append(arg) |
524 |
| - target = self.add(PrimitiveOp(coerced, desc, line)) |
525 |
| - return target |
526 |
| - |
527 |
| - def matching_primitive_op(self, |
528 |
| - candidates: List[OpDescription], |
529 |
| - args: List[Value], |
530 |
| - line: int, |
531 |
| - result_type: Optional[RType] = None) -> Optional[Value]: |
532 |
| - # Find the highest-priority primitive op that matches. |
533 |
| - matching = None # type: Optional[OpDescription] |
534 |
| - for desc in candidates: |
535 |
| - if len(desc.arg_types) != len(args): |
536 |
| - continue |
537 |
| - if all(is_subtype(actual.type, formal) |
538 |
| - for actual, formal in zip(args, desc.arg_types)): |
539 |
| - if matching: |
540 |
| - assert matching.priority != desc.priority, 'Ambiguous:\n1) %s\n2) %s' % ( |
541 |
| - matching, desc) |
542 |
| - if desc.priority > matching.priority: |
543 |
| - matching = desc |
544 |
| - else: |
545 |
| - matching = desc |
546 |
| - if matching: |
547 |
| - target = self.primitive_op(matching, args, line) |
548 |
| - if result_type and not is_runtime_subtype(target.type, result_type): |
549 |
| - if is_none_rprimitive(result_type): |
550 |
| - # Special case None return. The actual result may actually be a bool |
551 |
| - # and so we can't just coerce it. |
552 |
| - target = self.none() |
553 |
| - else: |
554 |
| - target = self.coerce(target, result_type, line) |
555 |
| - return target |
556 |
| - return None |
557 |
| - |
558 | 516 | def binary_op(self,
|
559 | 517 | lreg: Value,
|
560 | 518 | rreg: Value,
|
@@ -857,10 +815,6 @@ def builtin_call(self,
|
857 | 815 | line: int) -> Value:
|
858 | 816 | call_c_ops_candidates = c_function_ops.get(fn_op, [])
|
859 | 817 | target = self.matching_call_c(call_c_ops_candidates, args, line)
|
860 |
| - if target: |
861 |
| - return target |
862 |
| - ops = func_ops.get(fn_op, []) |
863 |
| - target = self.matching_primitive_op(ops, args, line) |
864 | 818 | assert target, 'Unsupported builtin function: %s' % fn_op
|
865 | 819 | return target
|
866 | 820 |
|
@@ -1113,12 +1067,6 @@ def decompose_union_helper(self,
|
1113 | 1067 | self.activate_block(exit_block)
|
1114 | 1068 | return result
|
1115 | 1069 |
|
1116 |
| - def op_arg_type(self, desc: OpDescription, n: int) -> RType: |
1117 |
| - if n >= len(desc.arg_types): |
1118 |
| - assert desc.is_var_arg |
1119 |
| - return desc.arg_types[-1] |
1120 |
| - return desc.arg_types[n] |
1121 |
| - |
1122 | 1070 | def translate_special_method_call(self,
|
1123 | 1071 | base_reg: Value,
|
1124 | 1072 | name: str,
|
|
0 commit comments