forked from OSchip/llvm-project
[mlir][NFC] Move several small methods from .cpp to .h to allow more aggressive inlining
Differential Revision: https://reviews.llvm.org/D104756
This commit is contained in:
parent
0439ba9903
commit
36b538f583
|
@ -67,7 +67,9 @@ public:
|
|||
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;
|
||||
|
|
|
@ -96,11 +96,11 @@ public:
|
|||
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; }
|
||||
|
@ -110,11 +110,11 @@ public:
|
|||
|
||||
/// 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() {
|
||||
|
|
|
@ -191,7 +191,7 @@ public:
|
|||
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.
|
||||
|
|
|
@ -111,7 +111,7 @@ public:
|
|||
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.
|
||||
|
|
|
@ -37,11 +37,6 @@ Type Attribute::getType() const { return impl->getType(); }
|
|||
/// 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
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
|
@ -216,21 +216,6 @@ void Operation::destroy() {
|
|||
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) {
|
||||
|
|
|
@ -48,8 +48,6 @@ Region *Region::getParentRegion() {
|
|||
return container->getParentRegion();
|
||||
}
|
||||
|
||||
Operation *Region::getParentOp() { return container; }
|
||||
|
||||
bool Region::isProperAncestor(Region *other) {
|
||||
if (this == other)
|
||||
return false;
|
||||
|
|
|
@ -16,10 +16,6 @@ using namespace mlir::detail;
|
|||
// Type
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
Dialect &Type::getDialect() const {
|
||||
return impl->getAbstractType().getDialect();
|
||||
}
|
||||
|
||||
MLIRContext *Type::getContext() const { return getDialect().getContext(); }
|
||||
|
||||
bool Type::isBF16() const { return isa<BFloat16Type>(); }
|
||||
|
|
Loading…
Reference in New Issue