summaryrefslogtreecommitdiffstats
path: root/mlir/lib/TableGen
diff options
context:
space:
mode:
authorLei Zhang <antiagainst@google.com>2019-11-01 11:17:23 -0700
committerA. Unique TensorFlower <gardener@tensorflow.org>2019-11-01 11:18:19 -0700
commit2fa865719b1fdbb2319b9e38ea36f747642c4c83 (patch)
treee3f774d5990d5b4aa2fac0dc4607e438fc923751 /mlir/lib/TableGen
parent9cbbd8f4dfa47d84bd7531b255f065762b981fba (diff)
downloadbcm5719-llvm-2fa865719b1fdbb2319b9e38ea36f747642c4c83.tar.gz
bcm5719-llvm-2fa865719b1fdbb2319b9e38ea36f747642c4c83.zip
Move BitEnumAttr from SPIRVBase.td to OpBase.td
BitEnumAttr is a mechanism for modelling attributes whose value is a bitfield. It should not be scoped to the SPIR-V dialect and can be used by other dialects too. This CL is mostly shuffling code around and adding tests and docs. Functionality changes are: * Fixed to use `getZExtValue()` instead of `getSExtValue()` when getting the value from the underlying IntegerAttr for a case. * Changed to auto-detect whether there is a case whose value is all bits unset (i.e., zero). If so handle it specially in all helper methods. PiperOrigin-RevId: 277964926
Diffstat (limited to 'mlir/lib/TableGen')
-rw-r--r--mlir/lib/TableGen/Attribute.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/mlir/lib/TableGen/Attribute.cpp b/mlir/lib/TableGen/Attribute.cpp
index 46bbfff7137..b9432e5a729 100644
--- a/mlir/lib/TableGen/Attribute.cpp
+++ b/mlir/lib/TableGen/Attribute.cpp
@@ -170,8 +170,8 @@ tblgen::EnumAttr::EnumAttr(const llvm::Record &record) : Attribute(&record) {}
tblgen::EnumAttr::EnumAttr(const llvm::DefInit *init)
: EnumAttr(init->getDef()) {}
-bool tblgen::EnumAttr::skipAutoGen() const {
- return def->getValueAsBit("skipAutoGen");
+bool tblgen::EnumAttr::isBitEnum() const {
+ return def->isSubClassOf("BitEnumAttr");
}
StringRef tblgen::EnumAttr::getEnumClassName() const {
OpenPOWER on IntegriCloud