diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2014-02-23 17:45:32 +0000 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2014-02-23 17:45:32 +0000 |
commit | fd6ed1ea6be300b2e563d145a583ebab03c2db7a (patch) | |
tree | 63d05664d9ef5d7de874938a78b8a00a6f2c7030 /llvm/lib/Target/ARM | |
parent | 5afdd1d770ff48e4425ee14b429fde882f2d5477 (diff) | |
download | bcm5719-llvm-fd6ed1ea6be300b2e563d145a583ebab03c2db7a.tar.gz bcm5719-llvm-fd6ed1ea6be300b2e563d145a583ebab03c2db7a.zip |
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.
llvm-svn: 201988
Diffstat (limited to 'llvm/lib/Target/ARM')
-rw-r--r-- | llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp index 82b510b9a5d..7c0dcd6c7d2 100644 --- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -228,6 +228,7 @@ class ARMAsmParser : public MCTargetAsmParser { bool parseDirectiveMovSP(SMLoc L); bool parseDirectiveObjectArch(SMLoc L); bool parseDirectiveArchExtension(SMLoc L); + bool parseDirectiveAlign(SMLoc L); StringRef splitMnemonic(StringRef Mnemonic, unsigned &PredicationCode, bool &CarrySetting, unsigned &ProcessorIMod, @@ -8022,6 +8023,8 @@ bool ARMAsmParser::ParseDirective(AsmToken DirectiveID) { return parseDirectiveObjectArch(DirectiveID.getLoc()); else if (IDVal == ".arch_extension") return parseDirectiveArchExtension(DirectiveID.getLoc()); + else if (IDVal == ".align") + return parseDirectiveAlign(DirectiveID.getLoc()); return true; } @@ -9061,6 +9064,23 @@ bool ARMAsmParser::parseDirectiveObjectArch(SMLoc L) { return false; } +/// parseDirectiveAlign +/// ::= .align +bool ARMAsmParser::parseDirectiveAlign(SMLoc L) { + // NOTE: if this is not the end of the statement, fall back to the target + // agnostic handling for this directive which will correctly handle this. + if (getLexer().isNot(AsmToken::EndOfStatement)) + return true; + + // '.align' is target specifically handled to mean 2**2 byte alignment. + if (getStreamer().getCurrentSection().first->UseCodeAlign()) + getStreamer().EmitCodeAlignment(4, 0); + else + getStreamer().EmitValueToAlignment(4, 0, 1, 0); + + return false; +} + /// Force static initialization. extern "C" void LLVMInitializeARMAsmParser() { RegisterMCAsmParser<ARMAsmParser> X(TheARMTarget); |