Han-Chung Wang 66b0b0466b
[MLIR][NFC] Fix incomplete boundary comments. (#133516)
I observed that we have the boundary comments in the codebase like:

```
//===----------------------------------------------------------------------===//
// ...
//===----------------------------------------------------------------------===//
```

I also observed that there are incomplete boundary comments. The
revision is generated by a script that completes the boundary comments.

```
//===----------------------------------------------------------------------===//
// ...

...
```

Signed-off-by: hanhanW <hanhan0912@gmail.com>
2025-03-31 09:29:54 -07:00

58 lines
2.0 KiB
C++

//===- Predicate.cpp - Pattern predicates ---------------------------------===//
//
// Part of the LLVM Project, 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
//
//===----------------------------------------------------------------------===//
#include "Predicate.h"
using namespace mlir;
using namespace mlir::pdl_to_pdl_interp;
//===----------------------------------------------------------------------===//
// Positions
//===----------------------------------------------------------------------===//
Position::~Position() = default;
/// Returns the depth of the first ancestor operation position.
unsigned Position::getOperationDepth() const {
if (const auto *operationPos = dyn_cast<OperationPosition>(this))
return operationPos->getDepth();
return parent ? parent->getOperationDepth() : 0;
}
//===----------------------------------------------------------------------===//
// AttributePosition
//===----------------------------------------------------------------------===//
AttributePosition::AttributePosition(const KeyTy &key) : Base(key) {
parent = key.first;
}
//===----------------------------------------------------------------------===//
// OperandPosition
//===----------------------------------------------------------------------===//
OperandPosition::OperandPosition(const KeyTy &key) : Base(key) {
parent = key.first;
}
//===----------------------------------------------------------------------===//
// OperandGroupPosition
//===----------------------------------------------------------------------===//
OperandGroupPosition::OperandGroupPosition(const KeyTy &key) : Base(key) {
parent = std::get<0>(key);
}
//===----------------------------------------------------------------------===//
// OperationPosition
//===----------------------------------------------------------------------===//
bool OperationPosition::isOperandDefiningOp() const {
return isa_and_nonnull<OperandPosition, OperandGroupPosition>(parent);
}