numba-cuda 0.21.1__cp313-cp313-win_amd64.whl → 0.23.0__cp313-cp313-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. numba_cuda/VERSION +1 -1
  2. numba_cuda/numba/cuda/api.py +4 -1
  3. numba_cuda/numba/cuda/cext/_dispatcher.cp313-win_amd64.pyd +0 -0
  4. numba_cuda/numba/cuda/cext/_dispatcher.cpp +0 -38
  5. numba_cuda/numba/cuda/cext/_helperlib.cp313-win_amd64.pyd +0 -0
  6. numba_cuda/numba/cuda/cext/_typeconv.cp313-win_amd64.pyd +0 -0
  7. numba_cuda/numba/cuda/cext/_typeof.cpp +0 -111
  8. numba_cuda/numba/cuda/cext/mviewbuf.cp313-win_amd64.pyd +0 -0
  9. numba_cuda/numba/cuda/codegen.py +42 -10
  10. numba_cuda/numba/cuda/compiler.py +10 -4
  11. numba_cuda/numba/cuda/core/analysis.py +29 -21
  12. numba_cuda/numba/cuda/core/annotations/type_annotations.py +4 -4
  13. numba_cuda/numba/cuda/core/base.py +6 -1
  14. numba_cuda/numba/cuda/core/consts.py +1 -1
  15. numba_cuda/numba/cuda/core/cuda_errors.py +917 -0
  16. numba_cuda/numba/cuda/core/errors.py +4 -912
  17. numba_cuda/numba/cuda/core/inline_closurecall.py +71 -57
  18. numba_cuda/numba/cuda/core/interpreter.py +79 -64
  19. numba_cuda/numba/cuda/core/ir.py +191 -119
  20. numba_cuda/numba/cuda/core/ir_utils.py +142 -112
  21. numba_cuda/numba/cuda/core/postproc.py +8 -8
  22. numba_cuda/numba/cuda/core/rewrites/ir_print.py +6 -3
  23. numba_cuda/numba/cuda/core/rewrites/static_getitem.py +5 -5
  24. numba_cuda/numba/cuda/core/rewrites/static_raise.py +3 -3
  25. numba_cuda/numba/cuda/core/ssa.py +3 -3
  26. numba_cuda/numba/cuda/core/transforms.py +25 -10
  27. numba_cuda/numba/cuda/core/typed_passes.py +9 -9
  28. numba_cuda/numba/cuda/core/typeinfer.py +39 -24
  29. numba_cuda/numba/cuda/core/untyped_passes.py +71 -55
  30. numba_cuda/numba/cuda/cudadecl.py +0 -13
  31. numba_cuda/numba/cuda/cudadrv/devicearray.py +6 -5
  32. numba_cuda/numba/cuda/cudadrv/driver.py +132 -511
  33. numba_cuda/numba/cuda/cudadrv/dummyarray.py +4 -0
  34. numba_cuda/numba/cuda/cudadrv/nvrtc.py +16 -0
  35. numba_cuda/numba/cuda/cudaimpl.py +0 -12
  36. numba_cuda/numba/cuda/debuginfo.py +104 -10
  37. numba_cuda/numba/cuda/descriptor.py +1 -1
  38. numba_cuda/numba/cuda/device_init.py +4 -7
  39. numba_cuda/numba/cuda/dispatcher.py +36 -32
  40. numba_cuda/numba/cuda/intrinsics.py +150 -1
  41. numba_cuda/numba/cuda/lowering.py +64 -29
  42. numba_cuda/numba/cuda/memory_management/nrt.py +10 -14
  43. numba_cuda/numba/cuda/np/arrayobj.py +54 -0
  44. numba_cuda/numba/cuda/np/numpy_support.py +26 -0
  45. numba_cuda/numba/cuda/printimpl.py +20 -0
  46. numba_cuda/numba/cuda/serialize.py +10 -0
  47. numba_cuda/numba/cuda/stubs.py +0 -11
  48. numba_cuda/numba/cuda/tests/benchmarks/test_kernel_launch.py +21 -4
  49. numba_cuda/numba/cuda/tests/cudadrv/test_context_stack.py +1 -2
  50. numba_cuda/numba/cuda/tests/cudadrv/test_cuda_driver.py +130 -48
  51. numba_cuda/numba/cuda/tests/cudadrv/test_cuda_memory.py +6 -2
  52. numba_cuda/numba/cuda/tests/cudadrv/test_emm_plugins.py +3 -1
  53. numba_cuda/numba/cuda/tests/cudadrv/test_linker.py +5 -6
  54. numba_cuda/numba/cuda/tests/cudadrv/test_module_callbacks.py +11 -12
  55. numba_cuda/numba/cuda/tests/cudadrv/test_nvjitlink.py +27 -19
  56. numba_cuda/numba/cuda/tests/cudapy/test_caching.py +47 -0
  57. numba_cuda/numba/cuda/tests/cudapy/test_compiler.py +10 -0
  58. numba_cuda/numba/cuda/tests/cudapy/test_debuginfo.py +89 -0
  59. numba_cuda/numba/cuda/tests/cudapy/test_device_array_capture.py +243 -0
  60. numba_cuda/numba/cuda/tests/cudapy/test_dispatcher.py +3 -3
  61. numba_cuda/numba/cuda/tests/cudapy/test_numba_interop.py +35 -0
  62. numba_cuda/numba/cuda/tests/cudapy/test_print.py +51 -0
  63. numba_cuda/numba/cuda/tests/cudapy/test_warp_ops.py +116 -1
  64. numba_cuda/numba/cuda/tests/doc_examples/test_globals.py +111 -0
  65. numba_cuda/numba/cuda/tests/nocuda/test_dummyarray.py +61 -0
  66. numba_cuda/numba/cuda/tests/nrt/test_nrt.py +31 -0
  67. numba_cuda/numba/cuda/typing/context.py +3 -1
  68. numba_cuda/numba/cuda/typing/typeof.py +56 -0
  69. {numba_cuda-0.21.1.dist-info → numba_cuda-0.23.0.dist-info}/METADATA +1 -1
  70. {numba_cuda-0.21.1.dist-info → numba_cuda-0.23.0.dist-info}/RECORD +74 -74
  71. numba_cuda/numba/cuda/cext/_devicearray.cp313-win_amd64.pyd +0 -0
  72. numba_cuda/numba/cuda/cext/_devicearray.cpp +0 -159
  73. numba_cuda/numba/cuda/cext/_devicearray.h +0 -29
  74. numba_cuda/numba/cuda/intrinsic_wrapper.py +0 -41
  75. {numba_cuda-0.21.1.dist-info → numba_cuda-0.23.0.dist-info}/WHEEL +0 -0
  76. {numba_cuda-0.21.1.dist-info → numba_cuda-0.23.0.dist-info}/licenses/LICENSE +0 -0
  77. {numba_cuda-0.21.1.dist-info → numba_cuda-0.23.0.dist-info}/licenses/LICENSE.numba +0 -0
  78. {numba_cuda-0.21.1.dist-info → numba_cuda-0.23.0.dist-info}/top_level.txt +0 -0
@@ -217,8 +217,8 @@ def _call_function_ex_replace_kws_large(
217
217
  # The first value must be a constant.
218
218
  const_stmt = old_body[search_start]
219
219
  if not (
220
- isinstance(const_stmt, ir.Assign)
221
- and isinstance(const_stmt.value, ir.Const)
220
+ isinstance(const_stmt, ir.assign_types)
221
+ and isinstance(const_stmt.value, ir.const_types)
222
222
  ):
223
223
  # We cannot handle this format so raise the
224
224
  # original error message.
@@ -231,8 +231,8 @@ def _call_function_ex_replace_kws_large(
231
231
  while search_start <= search_end and not found_getattr:
232
232
  getattr_stmt = old_body[search_start]
233
233
  if (
234
- isinstance(getattr_stmt, ir.Assign)
235
- and isinstance(getattr_stmt.value, ir.Expr)
234
+ isinstance(getattr_stmt, ir.assign_types)
235
+ and isinstance(getattr_stmt.value, ir.expr_types)
236
236
  and getattr_stmt.value.op == "getattr"
237
237
  and (getattr_stmt.value.value.name == buildmap_name)
238
238
  and getattr_stmt.value.attr == "__setitem__"
@@ -262,8 +262,8 @@ def _call_function_ex_replace_kws_large(
262
262
  raise UnsupportedBytecodeError(errmsg)
263
263
  setitem_stmt = old_body[search_start + 1]
264
264
  if not (
265
- isinstance(setitem_stmt, ir.Assign)
266
- and isinstance(setitem_stmt.value, ir.Expr)
265
+ isinstance(setitem_stmt, ir.assign_types)
266
+ and isinstance(setitem_stmt.value, ir.expr_types)
267
267
  and setitem_stmt.value.op == "call"
268
268
  and (setitem_stmt.value.func.name == getattr_stmt.target.name)
269
269
  and len(setitem_stmt.value.args) == 2
@@ -366,8 +366,8 @@ def _call_function_ex_replace_args_large(
366
366
  # tuple.
367
367
  search_start = 0
368
368
  total_args = []
369
- if isinstance(vararg_stmt, ir.Assign) and isinstance(
370
- vararg_stmt.value, ir.Var
369
+ if isinstance(vararg_stmt, ir.assign_types) and isinstance(
370
+ vararg_stmt.value, ir.var_types
371
371
  ):
372
372
  target_name = vararg_stmt.value.name
373
373
  # If there is an initial assignment, delete it
@@ -387,9 +387,9 @@ def _call_function_ex_replace_args_large(
387
387
  while search_end >= search_start:
388
388
  concat_stmt = old_body[search_end]
389
389
  if (
390
- isinstance(concat_stmt, ir.Assign)
390
+ isinstance(concat_stmt, ir.assign_types)
391
391
  and concat_stmt.target.name == target_name
392
- and isinstance(concat_stmt.value, ir.Expr)
392
+ and isinstance(concat_stmt.value, ir.expr_types)
393
393
  and concat_stmt.value.op == "build_tuple"
394
394
  and not concat_stmt.value.items
395
395
  ):
@@ -404,9 +404,9 @@ def _call_function_ex_replace_args_large(
404
404
  # We expect to find another arg to append.
405
405
  # The first stmt must be a binop "add"
406
406
  if (search_end == search_start) or not (
407
- isinstance(concat_stmt, ir.Assign)
407
+ isinstance(concat_stmt, ir.assign_types)
408
408
  and (concat_stmt.target.name == target_name)
409
- and isinstance(concat_stmt.value, ir.Expr)
409
+ and isinstance(concat_stmt.value, ir.expr_types)
410
410
  and concat_stmt.value.op == "binop"
411
411
  and concat_stmt.value.fn == operator.add
412
412
  ):
@@ -418,8 +418,8 @@ def _call_function_ex_replace_args_large(
418
418
  # build_tuple containing the arg.
419
419
  arg_tuple_stmt = old_body[search_end - 1]
420
420
  if not (
421
- isinstance(arg_tuple_stmt, ir.Assign)
422
- and isinstance(arg_tuple_stmt.value, ir.Expr)
421
+ isinstance(arg_tuple_stmt, ir.assign_types)
422
+ and isinstance(arg_tuple_stmt.value, ir.expr_types)
423
423
  and (arg_tuple_stmt.value.op == "build_tuple")
424
424
  and len(arg_tuple_stmt.value.items) == 1
425
425
  ):
@@ -448,7 +448,7 @@ def _call_function_ex_replace_args_large(
448
448
  keep_looking = True
449
449
  while search_end >= search_start and keep_looking:
450
450
  next_stmt = old_body[search_end]
451
- if isinstance(next_stmt, ir.Assign) and (
451
+ if isinstance(next_stmt, ir.assign_types) and (
452
452
  next_stmt.target.name == target_name
453
453
  ):
454
454
  keep_looking = False
@@ -522,8 +522,8 @@ def peep_hole_call_function_ex_to_call_function_kw(func_ir):
522
522
  new_body = []
523
523
  for i, stmt in enumerate(blk.body):
524
524
  if (
525
- isinstance(stmt, ir.Assign)
526
- and isinstance(stmt.value, ir.Expr)
525
+ isinstance(stmt, ir.assign_types)
526
+ and isinstance(stmt.value, ir.expr_types)
527
527
  and stmt.value.op == "call"
528
528
  and stmt.value.varkwarg is not None
529
529
  ):
@@ -548,7 +548,7 @@ def peep_hole_call_function_ex_to_call_function_kw(func_ir):
548
548
  while varkwarg_loc >= 0 and not found:
549
549
  keyword_def = blk.body[varkwarg_loc]
550
550
  if (
551
- isinstance(keyword_def, ir.Assign)
551
+ isinstance(keyword_def, ir.assign_types)
552
552
  and keyword_def.target.name == varkwarg.name
553
553
  ):
554
554
  found = True
@@ -558,7 +558,7 @@ def peep_hole_call_function_ex_to_call_function_kw(func_ir):
558
558
  kws
559
559
  or not found
560
560
  or not (
561
- isinstance(keyword_def.value, ir.Expr)
561
+ isinstance(keyword_def.value, ir.expr_types)
562
562
  and keyword_def.value.op == "build_map"
563
563
  )
564
564
  ):
@@ -624,7 +624,7 @@ def peep_hole_call_function_ex_to_call_function_kw(func_ir):
624
624
  while vararg_loc >= 0 and not found:
625
625
  args_def = blk.body[vararg_loc]
626
626
  if (
627
- isinstance(args_def, ir.Assign)
627
+ isinstance(args_def, ir.assign_types)
628
628
  and args_def.target.name == vararg.name
629
629
  ):
630
630
  found = True
@@ -635,7 +635,7 @@ def peep_hole_call_function_ex_to_call_function_kw(func_ir):
635
635
  # then we can't handle this format.
636
636
  raise UnsupportedBytecodeError(errmsg)
637
637
  if (
638
- isinstance(args_def.value, ir.Expr)
638
+ isinstance(args_def.value, ir.expr_types)
639
639
  and args_def.value.op == "build_tuple"
640
640
  ):
641
641
  # n_args <= 30 case.
@@ -656,7 +656,7 @@ def peep_hole_call_function_ex_to_call_function_kw(func_ir):
656
656
  already_deleted_defs,
657
657
  )
658
658
  elif (
659
- isinstance(args_def.value, ir.Expr)
659
+ isinstance(args_def.value, ir.expr_types)
660
660
  and args_def.value.op == "list_to_tuple"
661
661
  ):
662
662
  # If there is a call with vararg we need to check
@@ -708,8 +708,8 @@ def peep_hole_call_function_ex_to_call_function_kw(func_ir):
708
708
  # Update the definition
709
709
  func_ir._definitions[stmt.target.name].append(new_call)
710
710
  elif (
711
- isinstance(stmt, ir.Assign)
712
- and isinstance(stmt.value, ir.Expr)
711
+ isinstance(stmt, ir.assign_types)
712
+ and isinstance(stmt.value, ir.expr_types)
713
713
  and stmt.value.op == "call"
714
714
  and stmt.value.vararg is not None
715
715
  ):
@@ -725,7 +725,10 @@ def peep_hole_call_function_ex_to_call_function_kw(func_ir):
725
725
  # If this value is still a list to tuple raise the
726
726
  # exception.
727
727
  expr = func_ir._definitions[vararg_name][0]
728
- if isinstance(expr, ir.Expr) and expr.op == "list_to_tuple":
728
+ if (
729
+ isinstance(expr, ir.expr_types)
730
+ and expr.op == "list_to_tuple"
731
+ ):
729
732
  raise UnsupportedBytecodeError(errmsg)
730
733
 
731
734
  new_body.append(stmt)
@@ -780,17 +783,17 @@ def peep_hole_list_to_tuple(func_ir):
780
783
  found = False
781
784
  for idx in reversed(range(len(blk.body))):
782
785
  stmt = blk.body[idx]
783
- if isinstance(stmt, ir.Assign):
786
+ if isinstance(stmt, ir.assign_types):
784
787
  value = stmt.value
785
788
  if (
786
- isinstance(value, ir.Expr)
789
+ isinstance(value, ir.expr_types)
787
790
  and value.op == "list_to_tuple"
788
791
  ):
789
792
  target_list = value.info[0]
790
793
  found = True
791
794
  bt = (idx, stmt)
792
795
  if found:
793
- if isinstance(stmt, ir.Assign):
796
+ if isinstance(stmt, ir.assign_types):
794
797
  if stmt.target.name == target_list:
795
798
  region = (bt, (idx, stmt))
796
799
  return region
@@ -812,8 +815,8 @@ def peep_hole_list_to_tuple(func_ir):
812
815
  # Walk through the peep_hole and find things that are being
813
816
  # "extend"ed and "append"ed to the BUILD_LIST
814
817
  for x in peep_hole:
815
- if isinstance(x, ir.Assign):
816
- if isinstance(x.value, ir.Expr):
818
+ if isinstance(x, ir.assign_types):
819
+ if isinstance(x.value, ir.expr_types):
817
820
  expr = x.value
818
821
  if (
819
822
  expr.op == "getattr"
@@ -857,8 +860,8 @@ def peep_hole_list_to_tuple(func_ir):
857
860
  t2l_agn = region[0][1]
858
861
  acc = the_build_list
859
862
  for x in peep_hole:
860
- if isinstance(x, ir.Assign):
861
- if isinstance(x.value, ir.Expr):
863
+ if isinstance(x, ir.assign_types):
864
+ if isinstance(x.value, ir.expr_types):
862
865
  expr = x.value
863
866
  if expr.op == "getattr":
864
867
  if (
@@ -877,7 +880,7 @@ def peep_hole_list_to_tuple(func_ir):
877
880
  fname = expr.func.name
878
881
  if fname in extends or fname in appends:
879
882
  arg = expr.args[0]
880
- if isinstance(arg, ir.Var):
883
+ if isinstance(arg, ir.var_types):
881
884
  tmp_name = "%s_var_%s" % (
882
885
  fname,
883
886
  arg.name,
@@ -997,7 +1000,7 @@ def peep_hole_delete_with_exit(func_ir):
997
1000
  # Any assignment that uses any of the dead variable is considered
998
1001
  # dead.
999
1002
  if used & dead_vars:
1000
- if isinstance(stmt, ir.Assign):
1003
+ if isinstance(stmt, ir.assign_types):
1001
1004
  dead_vars.add(stmt.target)
1002
1005
 
1003
1006
  new_body = []
@@ -1112,7 +1115,9 @@ def peep_hole_fuse_dict_add_updates(func_ir):
1112
1115
  # vars in statement. This is always the lhs with
1113
1116
  # a build_map.
1114
1117
  stmt_build_map_out = None
1115
- if isinstance(stmt, ir.Assign) and isinstance(stmt.value, ir.Expr):
1118
+ if isinstance(stmt, ir.assign_types) and isinstance(
1119
+ stmt.value, ir.expr_types
1120
+ ):
1116
1121
  if stmt.value.op == "build_map":
1117
1122
  # Skip the output build_map when looking for used vars.
1118
1123
  stmt_build_map_out = stmt.target.name
@@ -1130,9 +1135,9 @@ def peep_hole_fuse_dict_add_updates(func_ir):
1130
1135
  getattr_stmt = blk.body[i - 1]
1131
1136
  args = stmt.value.args
1132
1137
  if (
1133
- isinstance(getattr_stmt, ir.Assign)
1138
+ isinstance(getattr_stmt, ir.assign_types)
1134
1139
  and getattr_stmt.target.name == func_name
1135
- and isinstance(getattr_stmt.value, ir.Expr)
1140
+ and isinstance(getattr_stmt.value, ir.expr_types)
1136
1141
  and getattr_stmt.value.op == "getattr"
1137
1142
  and getattr_stmt.value.attr
1138
1143
  in ("__setitem__", "_update_from_bytecode")
@@ -1207,8 +1212,8 @@ def peep_hole_fuse_dict_add_updates(func_ir):
1207
1212
  # will be removed when handling their call in the next
1208
1213
  # iteration.
1209
1214
  if not (
1210
- isinstance(stmt, ir.Assign)
1211
- and isinstance(stmt.value, ir.Expr)
1215
+ isinstance(stmt, ir.assign_types)
1216
+ and isinstance(stmt.value, ir.expr_types)
1212
1217
  and stmt.value.op == "getattr"
1213
1218
  and stmt.value.value.name in lit_map_use_idx
1214
1219
  and stmt.value.attr in ("__setitem__", "_update_from_bytecode")
@@ -1249,7 +1254,7 @@ def peep_hole_split_at_pop_block(func_ir):
1249
1254
  # Gather locations of PopBlock
1250
1255
  pop_block_locs = []
1251
1256
  for i, inst in enumerate(blk.body):
1252
- if isinstance(inst, ir.PopBlock):
1257
+ if isinstance(inst, ir.popblock_types):
1253
1258
  pop_block_locs.append(i)
1254
1259
  # Rewrite block with PopBlock
1255
1260
  if pop_block_locs:
@@ -1301,10 +1306,14 @@ def _build_new_build_map(func_ir, name, old_body, old_lineno, new_items):
1301
1306
  for pair in new_items:
1302
1307
  k, v = pair
1303
1308
  key_def = ir_utils.guard(ir_utils.get_definition, func_ir, k)
1304
- if isinstance(key_def, (ir.Const, ir.Global, ir.FreeVar)):
1309
+ if isinstance(
1310
+ key_def, ir.const_types + ir.global_types + ir.freevar_types
1311
+ ):
1305
1312
  literal_keys.append(key_def.value)
1306
1313
  value_def = ir_utils.guard(ir_utils.get_definition, func_ir, v)
1307
- if isinstance(value_def, (ir.Const, ir.Global, ir.FreeVar)):
1314
+ if isinstance(
1315
+ value_def, ir.const_types + ir.global_types + ir.freevar_types
1316
+ ):
1308
1317
  values.append(value_def.value)
1309
1318
  else:
1310
1319
  # Append unknown value if not a literal.
@@ -1514,7 +1523,7 @@ class Interpreter(object):
1514
1523
  # Propagate the exception variables to LHS of assignment
1515
1524
  for varname, defnvars in self.definitions.items():
1516
1525
  for v in defnvars:
1517
- if isinstance(v, ir.Var):
1526
+ if isinstance(v, ir.var_types):
1518
1527
  k = v.name
1519
1528
  if k in excvars:
1520
1529
  excvars.add(varname)
@@ -1587,7 +1596,7 @@ class Interpreter(object):
1587
1596
  while self.syntax_blocks:
1588
1597
  if offset >= self.syntax_blocks[-1].exit:
1589
1598
  synblk = self.syntax_blocks.pop()
1590
- if isinstance(synblk, ir.With):
1599
+ if isinstance(synblk, ir.with_types):
1591
1600
  self.current_block.append(ir.PopBlock(self.loc))
1592
1601
  else:
1593
1602
  break
@@ -1684,11 +1693,11 @@ class Interpreter(object):
1684
1693
  # like a = b[i] = 1, so need to handle replaced temporaries in
1685
1694
  # later setitem/setattr nodes
1686
1695
  if (
1687
- isinstance(inst, (ir.SetItem, ir.SetAttr))
1696
+ isinstance(inst, ir.setitem_types + ir.setattr_types)
1688
1697
  and inst.value.name in replaced_var
1689
1698
  ):
1690
1699
  inst.value = replaced_var[inst.value.name]
1691
- elif isinstance(inst, ir.Assign):
1700
+ elif isinstance(inst, ir.assign_types):
1692
1701
  if (
1693
1702
  inst.target.is_temp
1694
1703
  and inst.target.name in self.assigner.unused_dests
@@ -1698,7 +1707,7 @@ class Interpreter(object):
1698
1707
  # like a = b = 1, so need to handle replaced temporaries in
1699
1708
  # later assignments
1700
1709
  if (
1701
- isinstance(inst.value, ir.Var)
1710
+ isinstance(inst.value, ir.var_types)
1702
1711
  and inst.value.name in replaced_var
1703
1712
  ):
1704
1713
  inst.value = replaced_var[inst.value.name]
@@ -1707,7 +1716,7 @@ class Interpreter(object):
1707
1716
  # chained unpack cases may reuse temporary
1708
1717
  # e.g. a = (b, c) = (x, y)
1709
1718
  if (
1710
- isinstance(inst.value, ir.Expr)
1719
+ isinstance(inst.value, ir.expr_types)
1711
1720
  and inst.value.op == "exhaust_iter"
1712
1721
  and inst.value.value.name in replaced_var
1713
1722
  ):
@@ -1720,10 +1729,10 @@ class Interpreter(object):
1720
1729
  # the temporary variable is not reused elsewhere since CPython
1721
1730
  # bytecode is stack-based and this pattern corresponds to a pop
1722
1731
  if (
1723
- isinstance(inst.value, ir.Var)
1732
+ isinstance(inst.value, ir.var_types)
1724
1733
  and inst.value.is_temp
1725
1734
  and new_body
1726
- and isinstance(new_body[-1], ir.Assign)
1735
+ and isinstance(new_body[-1], ir.assign_types)
1727
1736
  ):
1728
1737
  prev_assign = new_body[-1]
1729
1738
  # _var_used_in_binop check makes sure we don't create a new
@@ -1753,7 +1762,7 @@ class Interpreter(object):
1753
1762
  in it as an argument
1754
1763
  """
1755
1764
  return (
1756
- isinstance(expr, ir.Expr)
1765
+ isinstance(expr, ir.expr_types)
1757
1766
  and expr.op in ("binop", "inplace_binop")
1758
1767
  and (varname == expr.lhs.name or varname == expr.rhs.name)
1759
1768
  )
@@ -1832,7 +1841,7 @@ class Interpreter(object):
1832
1841
  if PYVERSION in ((3, 11), (3, 12), (3, 13)):
1833
1842
  if self.syntax_blocks:
1834
1843
  top = self.syntax_blocks[-1]
1835
- if isinstance(top, ir.With):
1844
+ if isinstance(top, ir.with_types):
1836
1845
  if inst.offset >= top.exit:
1837
1846
  self.current_block.append(ir.PopBlock(loc=self.loc))
1838
1847
  self.syntax_blocks.pop()
@@ -1881,7 +1890,7 @@ class Interpreter(object):
1881
1890
  )
1882
1891
  else:
1883
1892
  target = self.current_scope.get_or_define(name, loc=self.loc)
1884
- if isinstance(value, ir.Var):
1893
+ if isinstance(value, ir.var_types):
1885
1894
  value = self.assigner.assign(value, target)
1886
1895
  stmt = ir.Assign(value=value, target=target, loc=self.loc)
1887
1896
  self.current_block.append(stmt)
@@ -2649,7 +2658,7 @@ class Interpreter(object):
2649
2658
  # Find names const
2650
2659
  names = self.get(names)
2651
2660
  for inst in self.current_block.body:
2652
- if isinstance(inst, ir.Assign) and inst.target is names:
2661
+ if isinstance(inst, ir.assign_types) and inst.target is names:
2653
2662
  self.current_block.remove(inst)
2654
2663
  # scan up the block looking for the values, remove them
2655
2664
  # and find their name strings
@@ -2750,7 +2759,7 @@ class Interpreter(object):
2750
2759
  keyvar = self.get(keys)
2751
2760
  # TODO: refactor this pattern. occurred several times.
2752
2761
  for inst in self.current_block.body:
2753
- if isinstance(inst, ir.Assign) and inst.target is keyvar:
2762
+ if isinstance(inst, ir.assign_types) and inst.target is keyvar:
2754
2763
  self.current_block.remove(inst)
2755
2764
  # scan up the block looking for the values, remove them
2756
2765
  # and find their name strings
@@ -2776,7 +2785,7 @@ class Interpreter(object):
2776
2785
  if len(defns) != 1:
2777
2786
  break
2778
2787
  defn = defns[0]
2779
- if not isinstance(defn, ir.Const):
2788
+ if not isinstance(defn, ir.const_types):
2780
2789
  break
2781
2790
  literal_items.append(defn.value)
2782
2791
 
@@ -2785,7 +2794,7 @@ class Interpreter(object):
2785
2794
  if len(defns) != 1:
2786
2795
  return _UNKNOWN_VALUE(self.get(v).name)
2787
2796
  defn = defns[0]
2788
- if not isinstance(defn, ir.Const):
2797
+ if not isinstance(defn, ir.const_types):
2789
2798
  return _UNKNOWN_VALUE(self.get(v).name)
2790
2799
  return defn.value
2791
2800
 
@@ -2921,7 +2930,7 @@ class Interpreter(object):
2921
2930
  if len(defns) != 1:
2922
2931
  break
2923
2932
  defn = defns[0]
2924
- if not isinstance(defn, ir.Const):
2933
+ if not isinstance(defn, ir.const_types):
2925
2934
  break
2926
2935
  literal_items.append(defn.value)
2927
2936
  return literal_items
@@ -3196,7 +3205,7 @@ class Interpreter(object):
3196
3205
  def op_BREAK_LOOP(self, inst, end=None):
3197
3206
  if end is None:
3198
3207
  loop = self.syntax_blocks[-1]
3199
- assert isinstance(loop, ir.Loop)
3208
+ assert isinstance(loop, ir.loop_types)
3200
3209
  end = loop.exit
3201
3210
  jmp = ir.Jump(target=end, loc=self.loc)
3202
3211
  self.current_block.append(jmp)
@@ -3408,7 +3417,7 @@ class Interpreter(object):
3408
3417
  defaults = self.get(defaults)
3409
3418
 
3410
3419
  assume_code_const = self.definitions[code][0]
3411
- if not isinstance(assume_code_const, ir.Const):
3420
+ if not isinstance(assume_code_const, ir.const_types):
3412
3421
  msg = (
3413
3422
  "Unsupported use of closure. "
3414
3423
  "Probably caused by complex control-flow constructs; "
@@ -3504,23 +3513,29 @@ class Interpreter(object):
3504
3513
 
3505
3514
  # is last emitted statement a build_tuple?
3506
3515
  stmt = self.current_block.body[-1]
3507
- ok = isinstance(stmt.value, ir.Expr) and stmt.value.op == "build_tuple"
3516
+ ok = (
3517
+ isinstance(stmt.value, ir.expr_types)
3518
+ and stmt.value.op == "build_tuple"
3519
+ )
3508
3520
  # check statements from self.current_block.body[-1] through to target,
3509
3521
  # make sure they are consts
3510
3522
  build_empty_list = None
3511
3523
  if ok:
3512
3524
  for stmt in reversed(self.current_block.body[:-1]):
3513
- if not isinstance(stmt, ir.Assign):
3525
+ if not isinstance(stmt, ir.assign_types):
3514
3526
  ok = False
3515
3527
  break
3516
3528
  # if its not a const, it needs to be the `build_list` for the
3517
3529
  # target, else it's something else we don't know about so just
3518
3530
  # bail
3519
- if isinstance(stmt.value, ir.Const):
3531
+ if isinstance(stmt.value, ir.const_types):
3520
3532
  continue
3521
3533
 
3522
3534
  # it's not a const, check for target
3523
- elif isinstance(stmt.value, ir.Expr) and stmt.target == target:
3535
+ elif (
3536
+ isinstance(stmt.value, ir.expr_types)
3537
+ and stmt.target == target
3538
+ ):
3524
3539
  build_empty_list = stmt
3525
3540
  # it's only ok to do this if the target has no initializer
3526
3541
  # already