Skip to content

Commit 95c95a9

Browse files
author
David Spickett
committed
[ARM][AsmParser] Make assembly directives case insensitive
Differential Revision: https://reviews.llvm.org/D73469
1 parent 2629035 commit 95c95a9

File tree

2 files changed

+101
-2
lines changed

2 files changed

+101
-2
lines changed

llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6786,7 +6786,7 @@ bool ARMAsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
67866786

67876787
// First check for the ARM-specific .req directive.
67886788
if (Parser.getTok().is(AsmToken::Identifier) &&
6789-
Parser.getTok().getIdentifier() == ".req") {
6789+
Parser.getTok().getIdentifier().lower() == ".req") {
67906790
parseDirectiveReq(Name, NameLoc);
67916791
// We always return 'error' for this, as we're done with this
67926792
// statement and don't need to match the 'instruction."
@@ -10502,7 +10502,7 @@ bool ARMAsmParser::ParseDirective(AsmToken DirectiveID) {
1050210502
bool IsMachO = Format == MCObjectFileInfo::IsMachO;
1050310503
bool IsCOFF = Format == MCObjectFileInfo::IsCOFF;
1050410504

10505-
StringRef IDVal = DirectiveID.getIdentifier();
10505+
std::string IDVal = DirectiveID.getIdentifier().lower();
1050610506
if (IDVal == ".word")
1050710507
parseLiteralValues(4, DirectiveID.getLoc());
1050810508
else if (IDVal == ".short" || IDVal == ".hword")
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
// RUN: llvm-mc -triple armv7-eabi -filetype asm -o - %s 2>&1 | FileCheck %s
2+
3+
.WORD 0x12345678
4+
# CHECK: .long 305419896
5+
6+
.SHORT 0x1234
7+
# CHECK: .short 4660
8+
9+
.HWORD 0x3456
10+
# CHECK: .short 13398
11+
12+
.ARM
13+
# CHECK: .code 32
14+
15+
.THUMB_FUNC
16+
17+
.CODE 32
18+
# CHECK: .code 32
19+
20+
.SYNTAX unified
21+
22+
foo .REQ r5
23+
.UNREQ foo
24+
25+
.FNSTART
26+
# CHECK: .fnstart
27+
.CANTUNWIND
28+
# CHECK: .cantunwind
29+
.FNEND
30+
# CHECK: .fnend
31+
32+
.FNSTART
33+
# CHECK: .fnstart
34+
.UNWIND_RAW 4, 0xb1, 0x01
35+
# CHECK: .unwind_raw 4, 0xb1, 0x1
36+
.PERSONALITY __gxx_personality_v0
37+
# CHECK: .personality __gxx_personality_v0
38+
.HANDLERDATA
39+
# CHECK: .handlerdata
40+
.FNEND
41+
# CHECK: .fnend
42+
43+
.FNSTART
44+
# CHECK: .fnstart
45+
.MOVSP r7
46+
# CHECK: .movsp r7
47+
.PERSONALITYINDEX 0
48+
# CHECK: .personalityindex 0
49+
.PAD #16
50+
# CHECK: .pad #16
51+
.SETFP r11, sp, #8
52+
# CHECK: .setfp r11, sp, #8
53+
.SAVE {r4, r5, r11, lr}
54+
# CHECK: .save {r4, r5, r11, lr}
55+
.VSAVE {d0}
56+
# CHECK: .vsave {d0}
57+
.FNEND
58+
# CHECK: .fnend
59+
60+
.LTORG
61+
62+
.POOL
63+
64+
.EVEN
65+
# CHECK: .p2align 1
66+
67+
.ALIGN 2
68+
# CHECK: .p2align 2
69+
70+
.ARCH armv8-a
71+
# CHECK: .arch armv8-a
72+
.ARCH_EXTENSION crc
73+
74+
.CPU cortex-a8
75+
# CHECK: .cpu cortex-a8
76+
.EABI_ATTRIBUTE Tag_CPU_name, "cortex-a9"
77+
# CHECK: .cpu cortex-a9
78+
79+
.THUMB_SET bar, 1
80+
# CHECK: .thumb_set bar, 1
81+
82+
.INST 0x87654321
83+
# CHECK: .inst 0x87654321
84+
.THUMB
85+
# CHECK: .code 16
86+
.INST.N 0xCAFE
87+
# CHECK: .inst.n 0xcafe
88+
.INST.W 0x44445555
89+
# CHECK: .inst.w 0x44445555
90+
91+
.FPU neon
92+
# CHECK: .fpu neon
93+
94+
.TLSDESCSEQ variable
95+
# CHECK: .tlsdescseq variable
96+
97+
.OBJECT_ARCH armv8
98+
# CHECK: .object_arch armv8-a
99+

0 commit comments

Comments
 (0)