summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDmitry Preobrazhensky <dmitry.preobrazhensky@amd.com>2017-08-04 13:55:24 +0000
committerDmitry Preobrazhensky <dmitry.preobrazhensky@amd.com>2017-08-04 13:55:24 +0000
commit4b11a78a6e34eee30b41e7edec47d9af5c400ed6 (patch)
tree6778dd48f298aeedf0e001866960c0876d1102be /llvm/lib
parent5c6358648961c704d79521388c41ff0586f78716 (diff)
downloadbcm5719-llvm-4b11a78a6e34eee30b41e7edec47d9af5c400ed6.tar.gz
bcm5719-llvm-4b11a78a6e34eee30b41e7edec47d9af5c400ed6.zip
[AMDGPU][MC] Enabled expressions as operands
See bug 33579: https://bugs.llvm.org//show_bug.cgi?id=33579 Reviewers: vpykhtin, SamWot, arsenm Differential Revision: https://reviews.llvm.org/D36091 llvm-svn: 310059
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp26
1 files changed, 12 insertions, 14 deletions
diff --git a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
index ba16e698b3f..abf0b1a2c24 100644
--- a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
+++ b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
@@ -2530,24 +2530,22 @@ AMDGPUAsmParser::parseOperand(OperandVector &Operands, StringRef Mnemonic) {
if (ResTy == MatchOperand_Success)
return ResTy;
- if (getLexer().getKind() == AsmToken::Identifier) {
- // If this identifier is a symbol, we want to create an expression for it.
- // It is a little difficult to distinguish between a symbol name, and
- // an instruction flag like 'gds'. In order to do this, we parse
- // all tokens as expressions and then treate the symbol name as the token
- // string when we want to interpret the operand as a token.
- const auto &Tok = Parser.getTok();
- SMLoc S = Tok.getLoc();
- const MCExpr *Expr = nullptr;
- if (!Parser.parseExpression(Expr)) {
- Operands.push_back(AMDGPUOperand::CreateExpr(this, Expr, S));
- return MatchOperand_Success;
- }
+ const auto &Tok = Parser.getTok();
+ SMLoc S = Tok.getLoc();
- Operands.push_back(AMDGPUOperand::CreateToken(this, Tok.getString(), Tok.getLoc()));
+ const MCExpr *Expr = nullptr;
+ if (!Parser.parseExpression(Expr)) {
+ Operands.push_back(AMDGPUOperand::CreateExpr(this, Expr, S));
+ return MatchOperand_Success;
+ }
+
+ // Possibly this is an instruction flag like 'gds'.
+ if (Tok.getKind() == AsmToken::Identifier) {
+ Operands.push_back(AMDGPUOperand::CreateToken(this, Tok.getString(), S));
Parser.Lex();
return MatchOperand_Success;
}
+
return MatchOperand_NoMatch;
}
OpenPOWER on IntegriCloud