MLIRContext *getContext() const;
/// Get the dialect this attribute is registered to.
- Dialect &getDialect() const;
+ Dialect &getDialect() const {
+ return impl->getAbstractAttribute().getDialect();
+ }
/// Print the attribute.
void print(raw_ostream &os) const;
Block *getBlock() { return block; }
/// Return the context this operation is associated with.
- MLIRContext *getContext();
+ MLIRContext *getContext() { return location->getContext(); }
/// Return the dialect this operation is associated with, or nullptr if the
/// associated dialect is not registered.
- Dialect *getDialect();
+ Dialect *getDialect() { return getName().getDialect(); }
/// The source location the operation was defined or derived from.
Location getLoc() { return location; }
/// Returns the region to which the instruction belongs. Returns nullptr if
/// the instruction is unlinked.
- Region *getParentRegion();
+ Region *getParentRegion() { return block ? block->getParent() : nullptr; }
/// Returns the closest surrounding operation that contains this operation
/// or nullptr if this is a top-level operation.
- Operation *getParentOp();
+ Operation *getParentOp() { return block ? block->getParentOp() : nullptr; }
/// Return the closest surrounding parent operation that is of type 'OpTy'.
template <typename OpTy> OpTy getParentOfType() {
Region *getParentRegion();
/// Return the parent operation this region is attached to.
- Operation *getParentOp();
+ Operation *getParentOp() { return container; }
/// Find the first parent operation of the given type, or nullptr if there is
/// no ancestor operation.
MLIRContext *getContext() const;
/// Get the dialect this type is registered to.
- Dialect &getDialect() const;
+ Dialect &getDialect() const { return impl->getAbstractType().getDialect(); }
// Convenience predicates. This is only for floating point types,
// derived types should use isa/dyn_cast.
/// Return the context this attribute belongs to.
MLIRContext *Attribute::getContext() const { return getDialect().getContext(); }
-/// Get the dialect this attribute is registered to.
-Dialect &Attribute::getDialect() const {
- return impl->getAbstractAttribute().getDialect();
-}
-
//===----------------------------------------------------------------------===//
// NamedAttribute
//===----------------------------------------------------------------------===//
free(rawMem);
}
-/// Return the context this operation is associated with.
-MLIRContext *Operation::getContext() { return location->getContext(); }
-
-/// Return the dialect this operation is associated with, or nullptr if the
-/// associated dialect is not registered.
-Dialect *Operation::getDialect() { return getName().getDialect(); }
-
-Region *Operation::getParentRegion() {
- return block ? block->getParent() : nullptr;
-}
-
-Operation *Operation::getParentOp() {
- return block ? block->getParentOp() : nullptr;
-}
-
/// Return true if this operation is a proper ancestor of the `other`
/// operation.
bool Operation::isProperAncestor(Operation *other) {
return container->getParentRegion();
}
-Operation *Region::getParentOp() { return container; }
-
bool Region::isProperAncestor(Region *other) {
if (this == other)
return false;
// Type
//===----------------------------------------------------------------------===//
-Dialect &Type::getDialect() const {
- return impl->getAbstractType().getDialect();
-}
-
MLIRContext *Type::getContext() const { return getDialect().getContext(); }
bool Type::isBF16() const { return isa<BFloat16Type>(); }