diff options
| author | River Riddle <riverriddle@google.com> | 2019-12-23 14:45:01 -0800 |
|---|---|---|
| committer | A. Unique TensorFlower <gardener@tensorflow.org> | 2019-12-23 16:36:53 -0800 |
| commit | e62a69561fb9d7b1013d2853da68d79a7907fead (patch) | |
| tree | 0dd059094cbfb8d904513abcdc1fbe8cfa89bb09 /mlir/lib/Parser | |
| parent | 5d5bd2e1da29d976cb125dbb3cd097a5e42b2be4 (diff) | |
| download | bcm5719-llvm-e62a69561fb9d7b1013d2853da68d79a7907fead.tar.gz bcm5719-llvm-e62a69561fb9d7b1013d2853da68d79a7907fead.zip | |
NFC: Replace ValuePtr with Value and remove it now that Value is value-typed.
ValuePtr was a temporary typedef during the transition to a value-typed Value.
PiperOrigin-RevId: 286945714
Diffstat (limited to 'mlir/lib/Parser')
| -rw-r--r-- | mlir/lib/Parser/Parser.cpp | 59 |
1 files changed, 28 insertions, 31 deletions
diff --git a/mlir/lib/Parser/Parser.cpp b/mlir/lib/Parser/Parser.cpp index e25f4d19654..0198a45172b 100644 --- a/mlir/lib/Parser/Parser.cpp +++ b/mlir/lib/Parser/Parser.cpp @@ -3084,7 +3084,7 @@ public: ParseResult popSSANameScope(); /// Register a definition of a value with the symbol table. - ParseResult addDefinition(SSAUseInfo useInfo, ValuePtr value); + ParseResult addDefinition(SSAUseInfo useInfo, Value value); /// Parse an optional list of SSA uses into 'results'. ParseResult parseOptionalSSAUseList(SmallVectorImpl<SSAUseInfo> &results); @@ -3094,13 +3094,12 @@ public: /// Given a reference to an SSA value and its type, return a reference. This /// returns null on failure. - ValuePtr resolveSSAUse(SSAUseInfo useInfo, Type type); + Value resolveSSAUse(SSAUseInfo useInfo, Type type); ParseResult parseSSADefOrUseAndType( const std::function<ParseResult(SSAUseInfo, Type)> &action); - ParseResult - parseOptionalSSAUseAndTypeList(SmallVectorImpl<ValuePtr> &results); + ParseResult parseOptionalSSAUseAndTypeList(SmallVectorImpl<Value> &results); /// Return the location of the value identified by its name and number if it /// has been already reference. @@ -3122,12 +3121,11 @@ public: /// Parse a single operation successor and its operand list. ParseResult parseSuccessorAndUseList(Block *&dest, - SmallVectorImpl<ValuePtr> &operands); + SmallVectorImpl<Value> &operands); /// Parse a comma-separated list of operation successors in brackets. - ParseResult - parseSuccessors(SmallVectorImpl<Block *> &destinations, - SmallVectorImpl<SmallVector<ValuePtr, 4>> &operands); + ParseResult parseSuccessors(SmallVectorImpl<Block *> &destinations, + SmallVectorImpl<SmallVector<Value, 4>> &operands); /// Parse an operation instance that is in the generic form. Operation *parseGenericOperation(); @@ -3165,9 +3163,8 @@ public: ParseResult parseBlockBody(Block *block); /// Parse a (possibly empty) list of block arguments. - ParseResult - parseOptionalBlockArgList(SmallVectorImpl<BlockArgumentPtr> &results, - Block *owner); + ParseResult parseOptionalBlockArgList(SmallVectorImpl<BlockArgument> &results, + Block *owner); /// Get the block with the specified name, creating it if it doesn't /// already exist. The location specified is the point of use, which allows @@ -3196,14 +3193,14 @@ private: void recordDefinition(StringRef def); /// Get the value entry for the given SSA name. - SmallVectorImpl<std::pair<ValuePtr, SMLoc>> &getSSAValueEntry(StringRef name); + SmallVectorImpl<std::pair<Value, SMLoc>> &getSSAValueEntry(StringRef name); /// Create a forward reference placeholder value with the given location and /// result type. - ValuePtr createForwardRefPlaceholder(SMLoc loc, Type type); + Value createForwardRefPlaceholder(SMLoc loc, Type type); /// Return true if this is a forward reference. - bool isForwardRefPlaceholder(ValuePtr value) { + bool isForwardRefPlaceholder(Value value) { return forwardRefPlaceholders.count(value); } @@ -3228,7 +3225,7 @@ private: /// This keeps track of all of the SSA values we are tracking for each name /// scope, indexed by their name. This has one entry per result number. - llvm::StringMap<SmallVector<std::pair<ValuePtr, SMLoc>, 1>> values; + llvm::StringMap<SmallVector<std::pair<Value, SMLoc>, 1>> values; /// This keeps track of all of the values defined by a specific name scope. SmallVector<llvm::StringSet<>, 2> definitionsPerScope; @@ -3245,7 +3242,7 @@ private: /// These are all of the placeholders we've made along with the location of /// their first reference, to allow checking for use of undefined values. - DenseMap<ValuePtr, SMLoc> forwardRefPlaceholders; + DenseMap<Value, SMLoc> forwardRefPlaceholders; /// The builder used when creating parsed operation instances. OpBuilder opBuilder; @@ -3270,7 +3267,7 @@ ParseResult OperationParser::finalize() { // Check for any forward references that are left. If we find any, error // out. if (!forwardRefPlaceholders.empty()) { - SmallVector<std::pair<const char *, ValuePtr>, 4> errors; + SmallVector<std::pair<const char *, Value>, 4> errors; // Iteration over the map isn't deterministic, so sort by source location. for (auto entry : forwardRefPlaceholders) errors.push_back({entry.second.getPointer(), entry.first}); @@ -3334,7 +3331,7 @@ ParseResult OperationParser::popSSANameScope() { } /// Register a definition of a value with the symbol table. -ParseResult OperationParser::addDefinition(SSAUseInfo useInfo, ValuePtr value) { +ParseResult OperationParser::addDefinition(SSAUseInfo useInfo, Value value) { auto &entries = getSSAValueEntry(useInfo.name); // Make sure there is a slot for this value. @@ -3408,7 +3405,7 @@ ParseResult OperationParser::parseSSAUse(SSAUseInfo &result) { /// Given an unbound reference to an SSA value and its type, return the value /// it specifies. This returns null on failure. -ValuePtr OperationParser::resolveSSAUse(SSAUseInfo useInfo, Type type) { +Value OperationParser::resolveSSAUse(SSAUseInfo useInfo, Type type) { auto &entries = getSSAValueEntry(useInfo.name); // If we have already seen a value of this name, return it. @@ -3469,7 +3466,7 @@ ParseResult OperationParser::parseSSADefOrUseAndType( /// ::= ssa-use-list ':' type-list-no-parens /// ParseResult OperationParser::parseOptionalSSAUseAndTypeList( - SmallVectorImpl<ValuePtr> &results) { + SmallVectorImpl<Value> &results) { SmallVector<SSAUseInfo, 4> valueIDs; if (parseOptionalSSAUseList(valueIDs)) return failure(); @@ -3504,13 +3501,13 @@ void OperationParser::recordDefinition(StringRef def) { } /// Get the value entry for the given SSA name. -SmallVectorImpl<std::pair<ValuePtr, SMLoc>> & +SmallVectorImpl<std::pair<Value, SMLoc>> & OperationParser::getSSAValueEntry(StringRef name) { return isolatedNameScopes.back().values[name]; } /// Create and remember a new placeholder for a forward reference. -ValuePtr OperationParser::createForwardRefPlaceholder(SMLoc loc, Type type) { +Value OperationParser::createForwardRefPlaceholder(SMLoc loc, Type type) { // Forward references are always created as operations, because we just need // something with a def/use chain. // @@ -3624,7 +3621,7 @@ ParseResult OperationParser::parseOperation() { /// ParseResult OperationParser::parseSuccessorAndUseList(Block *&dest, - SmallVectorImpl<ValuePtr> &operands) { + SmallVectorImpl<Value> &operands) { // Verify branch is identifier and get the matching block. if (!getToken().is(Token::caret_identifier)) return emitError("expected block name"); @@ -3647,13 +3644,13 @@ OperationParser::parseSuccessorAndUseList(Block *&dest, /// ParseResult OperationParser::parseSuccessors( SmallVectorImpl<Block *> &destinations, - SmallVectorImpl<SmallVector<ValuePtr, 4>> &operands) { + SmallVectorImpl<SmallVector<Value, 4>> &operands) { if (parseToken(Token::l_square, "expected '['")) return failure(); auto parseElt = [this, &destinations, &operands]() { Block *dest; - SmallVector<ValuePtr, 4> destOperands; + SmallVector<Value, 4> destOperands; auto res = parseSuccessorAndUseList(dest, destOperands); destinations.push_back(dest); operands.push_back(destOperands); @@ -3710,7 +3707,7 @@ Operation *OperationParser::parseGenericOperation() { // Parse the successor list but don't add successors to the result yet to // avoid messing up with the argument order. SmallVector<Block *, 2> successors; - SmallVector<SmallVector<ValuePtr, 4>, 2> successorOperands; + SmallVector<SmallVector<Value, 4>, 2> successorOperands; if (getToken().is(Token::l_square)) { // Check if the operation is a known terminator. const AbstractOperation *abstractOp = result.name.getAbstractOperation(); @@ -3771,7 +3768,7 @@ Operation *OperationParser::parseGenericOperation() { // Add the successors, and their operands after the proper operands. for (const auto &succ : llvm::zip(successors, successorOperands)) { Block *successor = std::get<0>(succ); - const SmallVector<ValuePtr, 4> &operands = std::get<1>(succ); + const SmallVector<Value, 4> &operands = std::get<1>(succ); result.addSuccessor(successor, operands); } @@ -4121,7 +4118,7 @@ public: /// Resolve an operand to an SSA value, emitting an error on failure. ParseResult resolveOperand(const OperandType &operand, Type type, - SmallVectorImpl<ValuePtr> &result) override { + SmallVectorImpl<Value> &result) override { OperationParser::SSAUseInfo operandInfo = {operand.name, operand.number, operand.location}; if (auto value = parser.resolveSSAUse(operandInfo, type)) { @@ -4234,7 +4231,7 @@ public: /// Parse a single operation successor and its operand list. ParseResult parseSuccessorAndUseList(Block *&dest, - SmallVectorImpl<ValuePtr> &operands) override { + SmallVectorImpl<Value> &operands) override { return parser.parseSuccessorAndUseList(dest, operands); } @@ -4462,7 +4459,7 @@ ParseResult OperationParser::parseBlock(Block *&block) { // If an argument list is present, parse it. if (consumeIf(Token::l_paren)) { - SmallVector<BlockArgumentPtr, 8> bbArgs; + SmallVector<BlockArgument, 8> bbArgs; if (parseOptionalBlockArgList(bbArgs, block) || parseToken(Token::r_paren, "expected ')' to end argument list")) return failure(); @@ -4526,7 +4523,7 @@ Block *OperationParser::defineBlockNamed(StringRef name, SMLoc loc, /// ssa-id-and-type-list ::= ssa-id-and-type (`,` ssa-id-and-type)* /// ParseResult OperationParser::parseOptionalBlockArgList( - SmallVectorImpl<BlockArgumentPtr> &results, Block *owner) { + SmallVectorImpl<BlockArgument> &results, Block *owner) { if (getToken().is(Token::r_brace)) return success(); |

