Register a method for a operand type, AST operator node and operand index. Parameters ---------- operand_type : Type The type of operands, e.g., tirx.PrimExpr, tirx.IterVar. op_node_type : AST The doc AST operator node type, e.g., doc.Add, doc.Eq. operand_index
(
operand_type: type,
op_node_type: type,
operand_index: int,
default: OpMethod | None = None,
)
| 125 | |
| 126 | |
| 127 | def get_op( |
| 128 | operand_type: type, |
| 129 | op_node_type: type, |
| 130 | operand_index: int, |
| 131 | default: OpMethod | None = None, |
| 132 | ) -> OpMethod | None: |
| 133 | """Register a method for a operand type, AST operator node and operand index. |
| 134 | |
| 135 | Parameters |
| 136 | ---------- |
| 137 | operand_type : Type |
| 138 | The type of operands, e.g., tirx.PrimExpr, tirx.IterVar. |
| 139 | |
| 140 | op_node_type : AST |
| 141 | The doc AST operator node type, e.g., doc.Add, doc.Eq. |
| 142 | |
| 143 | operand_index : int |
| 144 | The operand index, i.e., 0 for left operand and 1 for right operand. |
| 145 | |
| 146 | |
| 147 | default : Optional[OpMethod] |
| 148 | The default method when no registered methods with this operand type, |
| 149 | AST operator node and operand index. |
| 150 | |
| 151 | Returns |
| 152 | ------- |
| 153 | func : Optional[OpMethod] |
| 154 | The function to register dispatched method of parsing |
| 155 | corresponding a operand type, AST operator node and operand index. |
| 156 | """ |
| 157 | return OpVTable.get((operand_type, op_node_type, operand_index), default) |
nothing calls this directly
no test coverage detected
searching dependent graphs…