mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-07 12:28:24 +00:00
Fix pr13145 - Naming a function like a register name confuses the asm parser.
Patch by Stepan Dyatkovskiy <stpworld@narod.ru> rdar://13457826 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177463 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -4593,6 +4593,11 @@ bool ARMAsmParser::parseOperand(SmallVectorImpl<MCParsedAsmOperand*> &Operands,
|
||||
Error(Parser.getTok().getLoc(), "unexpected token in operand");
|
||||
return true;
|
||||
case AsmToken::Identifier: {
|
||||
// If we've seen a branch mnemonic, the next operand must be a label. This
|
||||
// is true even if the label is a register name. So "br r1" means branch to
|
||||
// label "r1".
|
||||
bool ExpectLabel = Mnemonic == "b" || Mnemonic == "bl";
|
||||
if (!ExpectLabel) {
|
||||
if (!tryParseRegisterWithWriteBack(Operands))
|
||||
return false;
|
||||
int Res = tryParseShiftRegister(Operands);
|
||||
@@ -4608,6 +4613,7 @@ bool ARMAsmParser::parseOperand(SmallVectorImpl<MCParsedAsmOperand*> &Operands,
|
||||
Operands.push_back(ARMOperand::CreateToken("APSR_nzcv", S));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Fall though for the Identifier case that is not a register or a
|
||||
// special name.
|
||||
|
5
test/MC/ARM/2013-03-18-Br-to-label-named-like-reg.s
Normal file
5
test/MC/ARM/2013-03-18-Br-to-label-named-like-reg.s
Normal file
@@ -0,0 +1,5 @@
|
||||
@ RUN: llvm-mc -arch arm %s
|
||||
@ CHECK: test:
|
||||
@ CHECK: br r1
|
||||
test:
|
||||
bl r1
|
Reference in New Issue
Block a user