[PATCH] D68764: [ARM][AsmParser] handles offset expression in parentheses
Jian Cai via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 10 11:50:39 PDT 2019
jcai19 updated this revision to Diff 224430.
jcai19 added a comment.
Fix a typo.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D68764/new/
https://reviews.llvm.org/D68764
Files:
llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
llvm/test/MC/ARM/gas-compl.s
Index: llvm/test/MC/ARM/gas-compl.s
===================================================================
--- /dev/null
+++ llvm/test/MC/ARM/gas-compl.s
@@ -0,0 +1,26 @@
+@ RUN: llvm-mc -triple=arm < %s | FileCheck %s
+
+@ CHECK: ldr r12, [sp, #15]
+.syntax unified
+ ldr r12, [sp, (15)]
+
+@ CHECK: ldr r12, [sp, #15]
+.syntax unified
+ ldr r12, [sp, #(15)]
+
+@ CHECK: ldr r12, [sp, #15]
+.syntax unified
+ ldr r12, [sp, $(15)]
+
+@ CHECK: ldr r12, [sp, #40]
+.syntax unified
+ ldr r12, [sp, (15+5*5)]
+
+@ CHECK: ldr r12, [sp, #40]
+.syntax unified
+ ldr r12, [sp, #(15+5*5)]
+
+
+@ CHECK: ldr r12, [sp, #40]
+.syntax unified
+ ldr r12, [sp, $(15+5*5)]
Index: llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
===================================================================
--- llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
+++ llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
@@ -5734,13 +5734,15 @@
}
// If we have a '#', it's an immediate offset, else assume it's a register
- // offset. Be friendly and also accept a plain integer (without a leading
- // hash) for gas compatibility.
+ // offset. Be friendly and also accept a plain integer or expression (without
+ // a leading hash) for gas compatibility.
if (Parser.getTok().is(AsmToken::Hash) ||
Parser.getTok().is(AsmToken::Dollar) ||
+ Parser.getTok().is(AsmToken::LParen) ||
Parser.getTok().is(AsmToken::Integer)) {
if (Parser.getTok().isNot(AsmToken::Integer))
- Parser.Lex(); // Eat '#' or '$'.
+ if (!Parser.getTok().is(AsmToken::LParen))
+ Parser.Lex(); // Eat '#' or '$'
E = Parser.getTok().getLoc();
bool isNegative = getParser().getTok().is(AsmToken::Minus);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68764.224430.patch
Type: text/x-patch
Size: 1702 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191010/0b397ab4/attachment.bin>
More information about the llvm-commits
mailing list