summaryrefslogtreecommitdiffstats
path: root/mlir/lib/Dialect/QuantOps
diff options
context:
space:
mode:
authorRiver Riddle <riverriddle@google.com>2019-11-01 15:39:30 -0700
committerA. Unique TensorFlower <gardener@tensorflow.org>2019-11-01 15:40:16 -0700
commit2ba4d802e030b51e78b7d29238ccc552ea19d1c4 (patch)
tree849e569f89352035e505f006fb81a3f46efb7e2f /mlir/lib/Dialect/QuantOps
parent445cc3f6dd74e86575153a95ecfb8754d6d5b726 (diff)
downloadbcm5719-llvm-2ba4d802e030b51e78b7d29238ccc552ea19d1c4.tar.gz
bcm5719-llvm-2ba4d802e030b51e78b7d29238ccc552ea19d1c4.zip
Remove the need for passing a location to parseAttribute/parseType.
Now that a proper parser is passed to these methods, there isn't a need to explicitly pass a source location. The source location can be recovered from the parser as necessary. This removes the need to explicitly decode an SMLoc in the case where we don't need to, which can be expensive. This requires adding some basic nesting support to the parser for supporting nested parsers to allow for remapping source locations of the nested parsers to the top level parser for accurate diagnostics. This is due to the fact that the attribute and type parsers use different source buffers than the top level parser, as they may be represented in string form. PiperOrigin-RevId: 278014858
Diffstat (limited to 'mlir/lib/Dialect/QuantOps')
-rw-r--r--mlir/lib/Dialect/QuantOps/IR/TypeParser.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/mlir/lib/Dialect/QuantOps/IR/TypeParser.cpp b/mlir/lib/Dialect/QuantOps/IR/TypeParser.cpp
index 360c1b58f88..26212f69c3c 100644
--- a/mlir/lib/Dialect/QuantOps/IR/TypeParser.cpp
+++ b/mlir/lib/Dialect/QuantOps/IR/TypeParser.cpp
@@ -616,8 +616,8 @@ bool TypeParser::parseQuantParams(double &scale, int64_t &zeroPoint) {
}
/// Parse a type registered to this dialect.
-Type QuantizationDialect::parseType(DialectAsmParser &parser,
- Location loc) const {
+Type QuantizationDialect::parseType(DialectAsmParser &parser) const {
+ Location loc = parser.getEncodedSourceLoc(parser.getNameLoc());
TypeParser typeParser(parser.getFullSymbolSpec(), getContext(), loc);
Type parsedType = typeParser.parseType();
if (parsedType == nullptr) {
OpenPOWER on IntegriCloud