-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
//===- DLTIUtils.h -----------------------------------------------*- C++-*-===// | ||
// | ||
// 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef TPP_TRANSFORMS_UTILS_DLTIUTILS_H | ||
#define TPP_TRANSFORMS_UTILS_DLTIUTILS_H | ||
|
||
#include "mlir/Dialect/DLTI/DLTI.h" | ||
|
||
namespace llvm { | ||
class StringRef; | ||
} // namespace llvm | ||
|
||
namespace mlir { | ||
namespace dlti { | ||
namespace utils { | ||
|
||
// Perform a DLTI-query using string keys. | ||
FailureOr<Attribute> query(Operation *op, ArrayRef<StringRef> keys, | ||
bool emitError = false); | ||
|
||
} // namespace utils | ||
} // namespace dlti | ||
} // namespace mlir | ||
|
||
#endif // TPP_TRANSFORMS_UTILS_DLTIUTILS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
//===- DLTIUtils.cpp ---------------------------------------------*- C++-*-===// | ||
// | ||
// 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 "TPP/Transforms/Utils/DLTIUtils.h" | ||
|
||
namespace mlir { | ||
namespace dlti { | ||
namespace utils { | ||
|
||
FailureOr<Attribute> query(Operation *op, ArrayRef<StringRef> keys, | ||
bool emitError) { | ||
if (!op) | ||
return failure(); | ||
|
||
auto ctx = op->getContext(); | ||
SmallVector<DataLayoutEntryKey> entryKeys; | ||
for (auto &key : keys) { | ||
auto entry = StringAttr::get(ctx, key); | ||
entryKeys.push_back(entry); | ||
} | ||
|
||
return dlti::query(op, entryKeys, emitError); | ||
} | ||
|
||
} // namespace utils | ||
} // namespace dlti | ||
} // namespace mlir |