parameters: (match_generic: Sequence[Any] = (),
                                 match_specific: Sequence[Any] = ())
return_statement: return IrPatternCallIntrinsic()
docstring: Defines a multi-function call intrinsic.
docstring_summary: Defines a multi-function call intrinsic.
docstring_tokens: Defines a multi - function call intrinsic .
function: def def_pattern_call_intrinsic(match_generic: Sequence[Any] = (),
                                 match_specific: Sequence[Any] = ()):
    """Defines a multi-function call intrinsic."""
  
    def _extract_symbol_intrinsics(
        matches: Sequence[Any]) -> Sequence[FuncProvidingIntrinsic]:
      names = []
      for m in matches:
        assert isinstance(m, FuncProvidingIntrinsic), (
            f"Match functions for a def_multi_func_intrinsic must be "
            f"a FuncProvidingIntrinsic. Got: {m}")
        names.append(m)
      return names
  
    generic_intrinsics = _extract_symbol_intrinsics(match_generic)
    specific_intrinsics = _extract_symbol_intrinsics(match_specific)
  
    class IrPatternCallIntrinsic(Intrinsic):
  
      def emit_call(self, stage: ImportStage, args: Sequence[ir.Value],
                    keywords: Sequence[Any]) -> ir.Value:
        ic = stage.ic
        if keywords:
          ic.abort(f"{self} only supports positional arguments")
  
        generic_symbol_names = [
            i.get_or_create_provided_func_symbol(stage)
            for i in generic_intrinsics
        ]
        specific_symbol_names = [
            i.get_or_create_provided_func_symbol(stage)
            for i in specific_intrinsics
        ]
  
        with ic.ip, ic.loc:
          generic_attrs = ir.ArrayAttr.get(
              [ir.FlatSymbolRefAttr.get(s) for s in generic_symbol_names])
          specific_attrs = ir.ArrayAttr.get(
              [ir.FlatSymbolRefAttr.get(s) for s in specific_symbol_names])
          exc_result, call_result = d.PatternMatchCallOp(
              d.ExceptionResultType.get(), d.ObjectType.get(), generic_attrs,
              specific_attrs, args).results
          d.RaiseOnFailureOp(exc_result)
          return call_result
  
      def __repr__(self):
        return (f"<pattern call generic={generic_intrinsics}, "
                f"specific={specific_intrinsics}>")
  
    return IrPatternCallIntrinsic()
function_tokens: def def_pattern_call_intrinsic ( match_generic : Sequence [ Any ] = ( ) , match_specific : Sequence [ Any ] = ( ) ) : def _extract_symbol_intrinsics ( matches : Sequence [ Any ] ) -> Sequence [ FuncProvidingIntrinsic ] : names = [ ] for m in matches : assert isinstance ( m , FuncProvidingIntrinsic ) , ( f"Match functions for a def_multi_func_intrinsic must be " f"a FuncProvidingIntrinsic. Got: {m}" ) names . append ( m ) return names generic_intrinsics = _extract_symbol_intrinsics ( match_generic ) specific_intrinsics = _extract_symbol_intrinsics ( match_specific ) class IrPatternCallIntrinsic ( Intrinsic ) : def emit_call ( self , stage : ImportStage , args : Sequence [ ir . Value ] , keywords : Sequence [ Any ] ) -> ir . Value : ic = stage . ic if keywords : ic . abort ( f"{self} only supports positional arguments" ) generic_symbol_names = [ i . get_or_create_provided_func_symbol ( stage ) for i in generic_intrinsics ] specific_symbol_names = [ i . get_or_create_provided_func_symbol ( stage ) for i in specific_intrinsics ] with ic . ip , ic . loc : generic_attrs = ir . ArrayAttr . get ( [ ir . FlatSymbolRefAttr . get ( s ) for s in generic_symbol_names ] ) specific_attrs = ir . ArrayAttr . get ( [ ir . FlatSymbolRefAttr . get ( s ) for s in specific_symbol_names ] ) exc_result , call_result = d . PatternMatchCallOp ( d . ExceptionResultType . get ( ) , d . ObjectType . get ( ) , generic_attrs , specific_attrs , args ) . results d . RaiseOnFailureOp ( exc_result ) return call_result def __repr__ ( self ) : return ( f"<pattern call generic={generic_intrinsics}, " f"specific={specific_intrinsics}>" ) return IrPatternCallIntrinsic ( )