projects
/
platform
/
upstream
/
llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9b4a02c
)
Add a utility function to Op that allows for checking if an operation has a specific...
author
River Riddle
<riverriddle@google.com>
Tue, 4 Jun 2019 19:14:43 +0000
(12:14 -0700)
committer
Mehdi Amini
<joker.eph@gmail.com>
Sun, 9 Jun 2019 23:17:23 +0000
(16:17 -0700)
PiperOrigin-RevId:
251489498
mlir/include/mlir/IR/OpDefinition.h
patch
|
blob
|
history
diff --git
a/mlir/include/mlir/IR/OpDefinition.h
b/mlir/include/mlir/IR/OpDefinition.h
index
35c248f
..
7a6b861
100644
(file)
--- a/
mlir/include/mlir/IR/OpDefinition.h
+++ b/
mlir/include/mlir/IR/OpDefinition.h
@@
-749,6
+749,13
@@
class Op : public OpState,
typelist_contains<OpTrait::OneResult<ConcreteType>, OpState,
Traits<ConcreteType>...>::value> {
public:
+ /// Return if this operation contains the provided trait.
+ template <template <typename T> class Trait>
+ static constexpr bool hasTrait() {
+ return typelist_contains<Trait<ConcreteType>, OpState,
+ Traits<ConcreteType>...>::value;
+ }
+
/// Return the operation that this refers to.
Operation *getOperation() { return OpState::getOperation(); }