MCPcopy Index your code
hub / github.com/python/cpython / _small_const_2

Method _small_const_2

Tools/jit/_optimizers.py:628–645  ·  view source on GitHub ↗
(self, inst: Instruction)

Source from the content-addressed store, hash-verified

626 )
627
628 def _small_const_2(self, inst: Instruction) -> tuple[str, Instruction | None]:
629 assert inst.kind is InstructionKind.SMALL_CONST_2
630 assert inst.target is not None
631 pre, _ = inst.text.split(inst.name)
632 if "16" in inst.target:
633 return "16a", Instruction(
634 InstructionKind.OTHER,
635 "movz",
636 f"{pre}movz {self._get_reg(inst)}, 0",
637 None,
638 )
639 else:
640 return "16b", Instruction(
641 InstructionKind.OTHER,
642 "movk",
643 f"{pre}movk {self._get_reg(inst)}, 0, lsl #16",
644 None,
645 )
646
647 def _small_consts_match(self, inst1: Instruction, inst2: Instruction) -> bool:
648 reg1 = self._get_reg(inst1)

Callers

nothing calls this directly

Calls 3

_get_regMethod · 0.95
InstructionClass · 0.70
splitMethod · 0.45

Tested by

no test coverage detected