diff options
author | Kevin Enderby <enderby@apple.com> | 2010-02-25 18:46:04 +0000 |
---|---|---|
committer | Kevin Enderby <enderby@apple.com> | 2010-02-25 18:46:04 +0000 |
commit | 7f99302dc956e77f11989ce07a25fb7d5dd57a39 (patch) | |
tree | 0fe1c3c6440085ef6b53e24aba3befd74b6a1208 /llvm/lib/MC/MCParser/AsmParser.cpp | |
parent | 8e3b9db27fb1fae13fd326e67d3c88e6f5fc55aa (diff) | |
download | bcm5719-llvm-7f99302dc956e77f11989ce07a25fb7d5dd57a39.tar.gz bcm5719-llvm-7f99302dc956e77f11989ce07a25fb7d5dd57a39.zip |
This is a patch to the assembler frontend to detect when aligning a text
section with TextAlignFillValue and calls EmitCodeAlignment() instead of
calling EmitValueToAlignment(). This allows x86 assembly code to be aligned
with optimal nops.
llvm-svn: 97158
Diffstat (limited to 'llvm/lib/MC/MCParser/AsmParser.cpp')
-rw-r--r-- | llvm/lib/MC/MCParser/AsmParser.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp index 51ad5d18f3b..1b22166f6a4 100644 --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -146,7 +146,7 @@ bool AsmParser::Run() { // FIXME: Target hook & command line option for initial section. Out.SwitchSection(getMachOSection("__TEXT", "__text", MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS, - 0, SectionKind())); + 0, SectionKind::getText())); // Prime the lexer. @@ -1237,8 +1237,14 @@ bool AsmParser::ParseDirectiveAlign(bool IsPow2, unsigned ValueSize) { } } - // FIXME: Target specific behavior about how the "extra" bytes are filled. - Out.EmitValueToAlignment(Alignment, FillExpr, ValueSize, MaxBytesToFill); + // FIXME: hard code the parser to use EmitCodeAlignment for text when using + // the TextAlignFillValue. + if(Out.getCurrentSection()->getKind().isText() && + Lexer.getMAI().getTextAlignFillValue() == FillExpr) + Out.EmitCodeAlignment(Alignment, MaxBytesToFill); + else + // FIXME: Target specific behavior about how the "extra" bytes are filled. + Out.EmitValueToAlignment(Alignment, FillExpr, ValueSize, MaxBytesToFill); return false; } |