llvm.org GIT mirror llvm / ec1c805
ARM IAS: support .align without parameters .align is handled specially on certain targets. .align without any parameters on ARM indicates a default alignment (4). Handle the special case in the target parser, but fall back to the generic parser for the normal version. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201988 91177308-0d34-0410-b5e6-96231b3b80d8 Saleem Abdulrasool 6 years ago
2 changed file(s) with 48 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
227227 bool parseDirectiveMovSP(SMLoc L);
228228 bool parseDirectiveObjectArch(SMLoc L);
229229 bool parseDirectiveArchExtension(SMLoc L);
230 bool parseDirectiveAlign(SMLoc L);
230231
231232 StringRef splitMnemonic(StringRef Mnemonic, unsigned &PredicationCode,
232233 bool &CarrySetting, unsigned &ProcessorIMod,
80218022 return parseDirectiveObjectArch(DirectiveID.getLoc());
80228023 else if (IDVal == ".arch_extension")
80238024 return parseDirectiveArchExtension(DirectiveID.getLoc());
8025 else if (IDVal == ".align")
8026 return parseDirectiveAlign(DirectiveID.getLoc());
80248027 return true;
80258028 }
80268029
90569059 Error(getLexer().getLoc(), "unexpected token");
90579060 Parser.eatToEndOfStatement();
90589061 }
9062
9063 return false;
9064 }
9065
9066 /// parseDirectiveAlign
9067 /// ::= .align
9068 bool ARMAsmParser::parseDirectiveAlign(SMLoc L) {
9069 // NOTE: if this is not the end of the statement, fall back to the target
9070 // agnostic handling for this directive which will correctly handle this.
9071 if (getLexer().isNot(AsmToken::EndOfStatement))
9072 return true;
9073
9074 // '.align' is target specifically handled to mean 2**2 byte alignment.
9075 if (getStreamer().getCurrentSection().first->UseCodeAlign())
9076 getStreamer().EmitCodeAlignment(4, 0);
9077 else
9078 getStreamer().EmitValueToAlignment(4, 0, 1, 0);
90599079
90609080 return false;
90619081 }
0 @ RUN: llvm-mc -triple armv7-eabi %s | FileCheck %s
1
2 .data
3
4 unaligned:
5 .byte 1
6 .align
7
8 @ CHECK-LABEL: unaligned
9 @ CHECK-NEXT: .byte 1
10 @ CHECK-NEXT: .align 2
11
12 aligned:
13 .long 0x1d10c1e5
14 .align
15
16 @ CHECK-LABEL: aligned
17 @ CHECK-NEXT: .long 487637477
18 @ CHECK-NEXT: .align 2
19
20 trailer:
21 .long 0xd1ab011c
22 .align 2
23
24 @ CHECK-LABEL: trailer
25 @ CHECK-NEXT: .long 3517645084
26 @ CHECK-NEXT: .align 2
27