1 | //===-- FirAliasTagOpInterface.cpp ----------------------------------===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | // |
9 | // Coding style: https://mlir.llvm.org/getting_started/DeveloperGuide/ |
10 | // |
11 | //===----------------------------------------------------------------------===// |
12 | |
13 | #include "flang/Optimizer/Dialect/FirAliasTagOpInterface.h" |
14 | #include "mlir/Dialect/LLVMIR/LLVMDialect.h" |
15 | |
16 | #include "flang/Optimizer/Dialect/FirAliasTagOpInterface.cpp.inc" |
17 | |
18 | mlir::LogicalResult |
19 | fir::detail::verifyFirAliasTagOpInterface(mlir::Operation *op) { |
20 | auto iface = mlir::cast<FirAliasTagOpInterface>(op); |
21 | |
22 | mlir::ArrayAttr tags = iface.getTBAATagsOrNull(); |
23 | if (!tags) |
24 | return mlir::success(); |
25 | |
26 | for (mlir::Attribute iter : tags) |
27 | if (!mlir::isa<mlir::LLVM::TBAATagAttr>(iter)) |
28 | return op->emitOpError("expected op to return array of " ) |
29 | << mlir::LLVM::TBAATagAttr::getMnemonic() << " attributes" ; |
30 | return mlir::success(); |
31 | } |
32 | |