summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MIRParser/MILexer.h
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2015-07-20 20:31:01 +0000
committerAlex Lorenz <arphaman@gmail.com>2015-07-20 20:31:01 +0000
commitb29554dab927a92dda672cb597d3675f457a4ca2 (patch)
tree056fc98353fdcc8ee436ba3f3fb491df7099beae /llvm/lib/CodeGen/MIRParser/MILexer.h
parentd285d3fbb7bed80d324d0ed4eae7f956a1fe11a3 (diff)
downloadbcm5719-llvm-b29554dab927a92dda672cb597d3675f457a4ca2.tar.gz
bcm5719-llvm-b29554dab927a92dda672cb597d3675f457a4ca2.zip
MIR Parser: Add support for quoted named global value operands.
This commit extends the machine instruction lexer and implements support for the quoted global value tokens. With this change the syntax for the global value identifier tokens becomes identical to the syntax for the global identifier tokens from the LLVM's assembly language. Reviewers: Duncan P. N. Exon Smith llvm-svn: 242702
Diffstat (limited to 'llvm/lib/CodeGen/MIRParser/MILexer.h')
-rw-r--r--llvm/lib/CodeGen/MIRParser/MILexer.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MIRParser/MILexer.h b/llvm/lib/CodeGen/MIRParser/MILexer.h
index 2085eb38f0c..778640a2c81 100644
--- a/llvm/lib/CodeGen/MIRParser/MILexer.h
+++ b/llvm/lib/CodeGen/MIRParser/MILexer.h
@@ -52,6 +52,7 @@ struct MIToken {
StackObject,
FixedStackObject,
NamedGlobalValue,
+ QuotedNamedGlobalValue,
GlobalValue,
// Other tokens
@@ -94,7 +95,26 @@ public:
StringRef::iterator location() const { return Range.begin(); }
- StringRef stringValue() const { return Range.drop_front(StringOffset); }
+ bool isStringValueQuoted() const { return Kind == QuotedNamedGlobalValue; }
+
+ /// Return the token's raw string value.
+ ///
+ /// If the string value is quoted, this method returns that quoted string as
+ /// it is, without unescaping the string value.
+ StringRef rawStringValue() const { return Range.drop_front(StringOffset); }
+
+ /// Return token's string value.
+ ///
+ /// Expects the string value to be unquoted.
+ StringRef stringValue() const {
+ assert(!isStringValueQuoted() && "String value is quoted");
+ return Range.drop_front(StringOffset);
+ }
+
+ /// Unescapes the token's string value.
+ ///
+ /// Expects the string value to be quoted.
+ void unescapeQuotedStringValue(std::string &Str) const;
const APSInt &integerValue() const { return IntVal; }
OpenPOWER on IntegriCloud