summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/AArch64
diff options
context:
space:
mode:
authorStepan Dyatkovskiy <stpworld@narod.ru>2014-03-30 17:09:54 +0000
committerStepan Dyatkovskiy <stpworld@narod.ru>2014-03-30 17:09:54 +0000
commit8baf17fc5fc5605460c793ea3f988e842ccd47d3 (patch)
tree76e2386d6b7c04203ef6dba0f3678ae2b1042441 /llvm/lib/Target/AArch64
parent981c306e4af81d6c7800d2eda172d22c4fc85046 (diff)
downloadbcm5719-llvm-8baf17fc5fc5605460c793ea3f988e842ccd47d3.tar.gz
bcm5719-llvm-8baf17fc5fc5605460c793ea3f988e842ccd47d3.zip
PR18929:
According to ARM assembler language hash symbol is optional before immediates. For example, see here for more details: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0473j/dom1359731154529.html llvm-svn: 205157
Diffstat (limited to 'llvm/lib/Target/AArch64')
-rw-r--r--llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp38
1 files changed, 22 insertions, 16 deletions
diff --git a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
index e672fdd64e8..e933ec11cd1 100644
--- a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
+++ b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
@@ -1481,12 +1481,14 @@ AArch64AsmParser::ParseRelocPrefix(AArch64MCExpr::VariantKind &RefKind) {
AArch64AsmParser::OperandMatchResultTy
AArch64AsmParser::ParseImmWithLSLOperand(
SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
- // FIXME?: I want to live in a world where immediates must start with
- // #. Please don't dash my hopes (well, do if you have a good reason).
- if (Parser.getTok().isNot(AsmToken::Hash)) return MatchOperand_NoMatch;
SMLoc S = Parser.getTok().getLoc();
- Parser.Lex(); // Eat '#'
+
+ if (Parser.getTok().is(AsmToken::Hash))
+ Parser.Lex(); // Eat '#'
+ else if (Parser.getTok().isNot(AsmToken::Integer))
+ // Operand should start from # or should be integer, emit error otherwise.
+ return MatchOperand_NoMatch;
const MCExpr *Imm;
if (ParseImmediate(Imm) != MatchOperand_Success)
@@ -1585,12 +1587,13 @@ AArch64AsmParser::OperandMatchResultTy
AArch64AsmParser::ParseFPImmOperand(
SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
- // FIXME?: I want to live in a world where immediates must start with
- // #. Please don't dash my hopes (well, do if you have a good reason).
- if (Parser.getTok().isNot(AsmToken::Hash)) return MatchOperand_NoMatch;
-
SMLoc S = Parser.getTok().getLoc();
- Parser.Lex(); // Eat '#'
+
+ bool Hash = false;
+ if (Parser.getTok().is(AsmToken::Hash)) {
+ Parser.Lex(); // Eat '#'
+ Hash = true;
+ }
bool Negative = false;
if (Parser.getTok().is(AsmToken::Minus)) {
@@ -1601,6 +1604,8 @@ AArch64AsmParser::ParseFPImmOperand(
}
if (Parser.getTok().isNot(AsmToken::Real)) {
+ if (!Hash)
+ return MatchOperand_NoMatch;
Error(S, "Expected floating-point immediate");
return MatchOperand_ParseFail;
}
@@ -1619,15 +1624,14 @@ AArch64AsmParser::ParseFPImmOperand(
AArch64AsmParser::OperandMatchResultTy
AArch64AsmParser::ParseFPImm0AndImm0Operand(
SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
- // FIXME?: I want to live in a world where immediates must start with
- // #. Please don't dash my hopes (well, do if you have a good reason).
-
- //This function is only used in floating compare with zero instructions to get
- //those instructions accept both #0.0 and #0.
- if (Parser.getTok().isNot(AsmToken::Hash)) return MatchOperand_NoMatch;
SMLoc S = Parser.getTok().getLoc();
- Parser.Lex(); // Eat '#'
+
+ bool Hash = false;
+ if (Parser.getTok().is(AsmToken::Hash)) {
+ Parser.Lex(); // Eat '#'
+ Hash = true;
+ }
APFloat RealVal(0.0);
if (Parser.getTok().is(AsmToken::Real)) {
@@ -1643,6 +1647,8 @@ AArch64AsmParser::ParseFPImm0AndImm0Operand(
}
}
else {
+ if (!Hash)
+ return MatchOperand_NoMatch;
Error(S, "only #0.0 is acceptable as immediate");
return MatchOperand_ParseFail;
}
OpenPOWER on IntegriCloud