aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2011-12-21 01:19:23 +0000
committerJim Grosbach <grosbach@apple.com>2011-12-21 01:19:23 +0000
commitc931325d99a93c273844c38d3c762705c454ae93 (patch)
treefaead1b4c4fa448b8a91a7a2a6adf9b48a003c75 /lib/Target
parentf33ab86aad52671b603a45b22bff828a2fe52301 (diff)
downloadexternal_llvm-c931325d99a93c273844c38d3c762705c454ae93.zip
external_llvm-c931325d99a93c273844c38d3c762705c454ae93.tar.gz
external_llvm-c931325d99a93c273844c38d3c762705c454ae93.tar.bz2
ARM assembly parsing allows constant expressions for lane indices.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147028 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r--lib/Target/ARM/AsmParser/ARMAsmParser.cpp39
1 files changed, 25 insertions, 14 deletions
diff --git a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
index 75e273a..b6e0d1b 100644
--- a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
+++ b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
@@ -2831,21 +2831,32 @@ parseVectorLane(VectorLaneTy &LaneKind, unsigned &Index) {
Parser.Lex(); // Eat the ']'.
return MatchOperand_Success;
}
- if (Parser.getTok().is(AsmToken::Integer)) {
- int64_t Val = Parser.getTok().getIntVal();
- // Make this range check context sensitive for .8, .16, .32.
- if (Val < 0 && Val > 7)
- Error(Parser.getTok().getLoc(), "lane index out of range");
- Index = Val;
- LaneKind = IndexedLane;
- Parser.Lex(); // Eat the token;
- if (Parser.getTok().isNot(AsmToken::RBrac))
- Error(Parser.getTok().getLoc(), "']' expected");
- Parser.Lex(); // Eat the ']'.
- return MatchOperand_Success;
+ const MCExpr *LaneIndex;
+ SMLoc Loc = Parser.getTok().getLoc();
+ if (getParser().ParseExpression(LaneIndex)) {
+ Error(Loc, "illegal expression");
+ return MatchOperand_ParseFail;
}
- Error(Parser.getTok().getLoc(), "lane index must be empty or an integer");
- return MatchOperand_ParseFail;
+ const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(LaneIndex);
+ if (!CE) {
+ Error(Loc, "lane index must be empty or an integer");
+ return MatchOperand_ParseFail;
+ }
+ if (Parser.getTok().isNot(AsmToken::RBrac)) {
+ Error(Parser.getTok().getLoc(), "']' expected");
+ return MatchOperand_ParseFail;
+ }
+ Parser.Lex(); // Eat the ']'.
+ int64_t Val = CE->getValue();
+
+ // FIXME: Make this range check context sensitive for .8, .16, .32.
+ if (Val < 0 || Val > 7) {
+ Error(Parser.getTok().getLoc(), "lane index out of range");
+ return MatchOperand_ParseFail;
+ }
+ Index = Val;
+ LaneKind = IndexedLane;
+ return MatchOperand_Success;
}
LaneKind = NoLanes;
return MatchOperand_Success;