Changeset View
Changeset View
Standalone View
Standalone View
mlir/docs/Tutorials/Toy/Ch-2.md
Show First 20 Lines • Show All 204 Lines • ▼ Show 20 Lines | |||||
customize its behavior. These traits may provide additional accessors, | customize its behavior. These traits may provide additional accessors, | ||||
verification, etc. | verification, etc. | ||||
```c++ | ```c++ | ||||
class ConstantOp : public mlir::Op<ConstantOp, | class ConstantOp : public mlir::Op<ConstantOp, | ||||
/// The ConstantOp takes no inputs. | /// The ConstantOp takes no inputs. | ||||
mlir::OpTrait::ZeroOperands, | mlir::OpTrait::ZeroOperands, | ||||
/// The ConstantOp returns a single result. | /// The ConstantOp returns a single result. | ||||
mlir::OpTrait::OneResult> { | mlir::OpTrait::OneResult, | ||||
/// The result of getType is `Type`. | |||||
mlir::OpTraits::OneTypedResult<Type>::Impl> { | |||||
public: | public: | ||||
/// Inherit the constructors from the base Op class. | /// Inherit the constructors from the base Op class. | ||||
using Op::Op; | using Op::Op; | ||||
/// Provide the unique name for this operation. MLIR will use this to register | /// Provide the unique name for this operation. MLIR will use this to register | ||||
/// the operation and uniquely identify it throughout the system. | /// the operation and uniquely identify it throughout the system. | ||||
static llvm::StringRef getOperationName() { return "toy.constant"; } | static llvm::StringRef getOperationName() { return "toy.constant"; } | ||||
▲ Show 20 Lines • Show All 473 Lines • Show Last 20 Lines |