llvm.org GIT mirror llvm / d627819
[ARM][AsmParser] handles offset expression in parentheses Summary: Integrated assembler does not accept offset expressions surrounded by parenthesis. Handle this case for GAS compability. https://bugs.llvm.org/show_bug.cgi?id=43631 Subscribers: kristof.beyls, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68764 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374832 91177308-0d34-0410-b5e6-96231b3b80d8 Jian Cai 9 months ago
2 changed file(s) with 27 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
57325732 return false;
57335733 }
57345734
5735 // If we have a '#', it's an immediate offset, else assume it's a register
5736 // offset. Be friendly and also accept a plain integer (without a leading
5737 // hash) for gas compatibility.
5735 // If we have a '#' or '$', it's an immediate offset, else assume it's a
5736 // register offset. Be friendly and also accept a plain integer or expression
5737 // (without a leading hash) for gas compatibility.
57385738 if (Parser.getTok().is(AsmToken::Hash) ||
57395739 Parser.getTok().is(AsmToken::Dollar) ||
5740 Parser.getTok().is(AsmToken::LParen) ||
57405741 Parser.getTok().is(AsmToken::Integer)) {
5741 if (Parser.getTok().isNot(AsmToken::Integer))
5742 Parser.Lex(); // Eat '#' or '$'.
5742 if (Parser.getTok().is(AsmToken::Hash) ||
5743 Parser.getTok().is(AsmToken::Dollar))
5744 Parser.Lex(); // Eat '#' or '$'
57435745 E = Parser.getTok().getLoc();
57445746
57455747 bool isNegative = getParser().getTok().is(AsmToken::Minus);
0 @ RUN: llvm-mc -triple=arm-linux-gnueabi < %s | FileCheck %s
1
2 @ CHECK: ldr r12, [sp, #15]
3 ldr r12, [sp, (15)]
4
5 @ CHECK: ldr r12, [sp, #15]
6 ldr r12, [sp, #(15)]
7
8 @ CHECK: ldr r12, [sp, #15]
9 ldr r12, [sp, $(15)]
10
11 @ CHECK: ldr r12, [sp, #100]
12 ldr r12, [sp, (((15+5)*5))]
13
14 @ CHECK: ldr r12, [sp, #100]
15 ldr r12, [sp, #(((15+5)*5))]
16
17
18 @ CHECK: ldr r12, [sp, #100]
19 ldr r12, [sp, $(((15+5)*5))]