2020-04-27 08:20:58 +08:00
|
|
|
//===- NumpyOps.td - Core numpy dialect ops ----------------*- tablegen -*-===//
|
|
|
|
//
|
|
|
|
// This file is licensed under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef NPCOMP_DIALECT_NUMPY_NUMPY_OPS
|
|
|
|
#define NPCOMP_DIALECT_NUMPY_NUMPY_OPS
|
|
|
|
|
|
|
|
include "NumpyDialect.td"
|
|
|
|
include "mlir/Interfaces/SideEffects.td"
|
2020-04-29 11:32:49 +08:00
|
|
|
include "mlir/IR/SymbolInterfaces.td"
|
2020-04-27 08:20:58 +08:00
|
|
|
|
2020-04-29 11:32:49 +08:00
|
|
|
def Numpy_BuiltinUfuncOp : Numpy_Op<"builtin_ufunc", [Symbol]> {
|
|
|
|
let summary = "References a built-in universal function";
|
|
|
|
let description = [{
|
|
|
|
This module-level op binds by name to a fully-qualified numpy built-in
|
|
|
|
ufunc (i.e. "numpy.add") and carries metadata associated with it.
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
|
|
|
|
def Numpy_GenericUfuncOp : Numpy_Op<"generic_ufunc", [
|
|
|
|
IsolatedFromAbove,
|
|
|
|
Symbol]> {
|
|
|
|
let summary = "Defines a ufunc in terms of overloaded element-wise functions";
|
2020-04-27 08:20:58 +08:00
|
|
|
let description = [{
|
|
|
|
}];
|
|
|
|
|
2020-04-29 11:32:49 +08:00
|
|
|
let arguments = (ins
|
|
|
|
TypeArrayAttr:$overload_types);
|
2020-04-27 08:20:58 +08:00
|
|
|
|
2020-04-29 11:32:49 +08:00
|
|
|
let regions = (region
|
|
|
|
VariadicRegion<AnyRegion>:$overloads);
|
|
|
|
}
|
|
|
|
|
|
|
|
def Numpy_UfuncReturnOp : Numpy_Op<"ufunc_return", [
|
|
|
|
Terminator,
|
2020-04-30 08:10:10 +08:00
|
|
|
HasParent<"numpy::GenericUfuncOp">]> {
|
2020-04-29 11:32:49 +08:00
|
|
|
let summary = "Return a value from a generic_ufunc";
|
|
|
|
let description = [{
|
|
|
|
Must terminate the basic block of a generic_ufunc overload.
|
2020-04-27 08:20:58 +08:00
|
|
|
}];
|
2020-04-29 11:32:49 +08:00
|
|
|
let arguments = (ins
|
|
|
|
Variadic<AnyType>:$operands
|
|
|
|
);
|
|
|
|
|
|
|
|
let assemblyFormat = "attr-dict ($operands^ `:` type($operands))?";
|
2020-04-27 08:20:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // NPCOMP_DIALECT_NUMPY_NUMPY_OPS
|