[llvm-commits] [llvm] r93867 - in /llvm/trunk/tools/llvm-mc: AsmLexer.h AsmParser.cpp
Chris Lattner
sabre at nondot.org
Mon Jan 18 22:22:22 PST 2010
Author: lattner
Date: Tue Jan 19 00:22:22 2010
New Revision: 93867
URL: http://llvm.org/viewvc/llvm-project?rev=93867&view=rev
Log:
fix parsing .comm directives on systems which do not represent alignments
as a power of 2. This fixes MC/AsmParser/directive_comm.s
Modified:
llvm/trunk/tools/llvm-mc/AsmLexer.h
llvm/trunk/tools/llvm-mc/AsmParser.cpp
Modified: llvm/trunk/tools/llvm-mc/AsmLexer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmLexer.h?rev=93867&r1=93866&r2=93867&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/AsmLexer.h (original)
+++ llvm/trunk/tools/llvm-mc/AsmLexer.h Tue Jan 19 00:22:22 2010
@@ -62,7 +62,9 @@
bool EnterIncludeFile(const std::string &Filename);
void PrintMessage(SMLoc Loc, const std::string &Msg, const char *Type) const;
-
+
+ const MCAsmInfo &getMAI() const { return MAI; }
+
private:
int getNextChar();
AsmToken ReturnError(const char *Loc, const std::string &Msg);
Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=93867&r1=93866&r2=93867&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original)
+++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Tue Jan 19 00:22:22 2010
@@ -1278,6 +1278,13 @@
Pow2AlignmentLoc = Lexer.getLoc();
if (ParseAbsoluteExpression(Pow2Alignment))
return true;
+
+ // If this target takes alignments in bytes (not log) validate and convert.
+ if (Lexer.getMAI().getAlignmentIsInBytes()) {
+ if (!isPowerOf2_64(Pow2Alignment))
+ return Error(Pow2AlignmentLoc, "alignment must be a power of 2");
+ Pow2Alignment = Log2_64(Pow2Alignment);
+ }
}
if (Lexer.isNot(AsmToken::EndOfStatement))
More information about the llvm-commits
mailing list