summaryrefslogtreecommitdiff
path: root/lib/MC/MCParser/AsmLexer.cpp
Commit message (Collapse)AuthorAge
* MC: Add AsmLexer::BigNum token for integers greater than 64 bitsDavid Woodhouse2014-02-01
| | | | | | | | | | | | | | | | | | | | This will be needed for .octa support, but we don't want to just use the existing AsmLexer::Integer for it and then have to litter all its users with explicit checks for the size, and make them use the new get APIntVal() method. So let the lexer produce an AsmLexer::Integer as before for numbers which are small enough — which appears to cover what was previously a nasty special case handling of numbers which don't fit in int64_t but *do* fit in uint64_t. Where the number is too large even for that, produce an AsmLexer::BigNum instead. We do nothing with these except complain about them for now, but that will be changed shortly... Based on a patch from PaX Team <pageexec@freemail.hu> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200613 91177308-0d34-0410-b5e6-96231b3b80d8
* Cache AllowAtInIdentifier as class variable in AsmLexerDavid Peixotto2013-12-06
| | | | | | | | | This commit caches the value of the AllowAtInIdentifier variable as a class variable in AsmLexer. We do this to avoid repeated MAI queries and string comparisons each time we lex an identifier. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196622 91177308-0d34-0410-b5e6-96231b3b80d8
* Integrated assembler incorrectly lexes ARM-style commentsDavid Peixotto2013-12-06
| | | | | | | | | | | | | | | | | | | | | | | | | The integrated assembler fails to properly lex arm comments when they are adjacent to an identifier in the input stream. The reason is that the arm comment symbol '@' is also used as symbol variant in other assembly languages so when lexing an identifier it allows the '@' symbol as part of the identifier. Example: $ cat comment.s foo: add r0, r0@got to parse this as a comment $ llvm-mc -triple armv7 comment.s comment.s:4:18: error: unexpected token in argument list add r0, r0@got to parse this as a comment ^ This should be parsed as correctly as `add r0, r0`. This commit modifes the assembly lexer to not include the '@' symbol in identifiers when lexing for targets that use '@' for comments. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196607 91177308-0d34-0410-b5e6-96231b3b80d8
* MC asm parser: allow ?'s in symbol names, and handle @'s in names in MS asmHans Wennborg2013-10-18
| | | | | | | | | | | | | | | | | | | | This is another (final?) stab at making us able to parse our own asm output on Windows. Symbols on Windows often contain @'s and ?'s in their names. Our asm parser didn't like this. ?'s were not allowed, and @'s were intepreted as trying to reference PLT/GOT/etc. We can't just add quotes around the bad names, since e.g. for MinGW, we use gas to assemble, and it doesn't like quotes in some places (notably in .def directives). This commit makes us allow ?'s in symbol names, and @'s in symbol names for MS assembly. Differential Revision: http://llvm-reviews.chandlerc.com/D1978 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193000 91177308-0d34-0410-b5e6-96231b3b80d8
* Support C99 hexadecimal floating-point literals in assemblyTim Northover2013-08-14
| | | | | | | | It's useful to be able to write down floating-point numbers without having to worry about what they'll be rounded to (as C99 discovered), this extends that ability to the MC assembly parsers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188370 91177308-0d34-0410-b5e6-96231b3b80d8
* AsmParser: More generic support for integer type suffices.Jim Grosbach2013-02-26
| | | | | | | | | | For integer constants, allow 'L', 'UL' as well as 'ULL' and 'LL'. This provides better support for shared headers between .s and .c files that define bunches of constant values. rdar://9321056 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176118 91177308-0d34-0410-b5e6-96231b3b80d8
* 'Hexadecimal' has two 'a's and only one 'i'.Matt Beaumont-Gay2013-02-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176031 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r15266. This fixes llvm.org/pr15266.Rafael Espindola2013-02-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175173 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] Add support for lexing binary integers with a [bB] suffix.Chad Rosier2013-02-12
| | | | | | | | | | | | | | | This is complicated by backward labels (e.g., 0b can be both a backward label and a binary zero). The current implementation assumes [0-9]b is always a label and thus it's possible for 0b and 1b to not be interpreted correctly for ms-style inline assembly. However, this is relatively simple to fix in the inline assembly (i.e., drop the [bB]). This patch also limits backward labels to [0-9]b, so that only 0b and 1b are ambiguous. Part of rdar://12470373 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174983 91177308-0d34-0410-b5e6-96231b3b80d8
* Update error message due to previous commit, r174926.Chad Rosier2013-02-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174927 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] Add support for lexing hexidecimal integers with a [hH] suffix.Chad Rosier2013-02-12
| | | | | | Part of rdar://12470373 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174926 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-03
| | | | | | | | | | | | | | | | | Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169131 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for macro parameters/arguments delimited by spaces,Preston Gurd2012-09-19
| | | | | | | | | | | | to improve compatibility with GNU as. Based on a patch by PaX Team. Fixed assertion failures on non-Darwin and added additional test cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164248 91177308-0d34-0410-b5e6-96231b3b80d8
* Handle missing newline at EOF more gracefully in MC AsmLexer.Jim Grosbach2011-09-15
| | | | | | | | | | If we see an EOF w/o a preceding end-of-line, return an EndOfStatement token before returning the Eof token. Based on patch by Stepan Dyatkovskiy. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139798 91177308-0d34-0410-b5e6-96231b3b80d8
* Move state var to private class member.Jim Grosbach2011-09-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139697 91177308-0d34-0410-b5e6-96231b3b80d8
* First step in supporting #line directives in assembler. This step parses theKevin Enderby2011-09-13
| | | | | | | | | | #line directives with the needed support in the lexer. Next will be to build a simple file/line# table mapping source SMLoc's for later use by diagnostics. And the last step will be to get the diagnostics to use the mapping for file and line numbers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139669 91177308-0d34-0410-b5e6-96231b3b80d8
* allow \r's in .s files.Chris Lattner2011-08-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136908 91177308-0d34-0410-b5e6-96231b3b80d8
* Basic support for macros with explicit arguments.Rafael Espindola2011-06-05
| | | | | | | | | | | We still don't handle * default values * :req * :vararg * \() git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132656 91177308-0d34-0410-b5e6-96231b3b80d8
* Match case for invalid constant error messages and add a newEric Christopher2011-04-12
| | | | | | | test for invalid hexadecimals. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129326 91177308-0d34-0410-b5e6-96231b3b80d8
* Lex, and then fail on invalid constants.Eric Christopher2011-04-11
| | | | | | | | | Testcase forthcoming. rdar://8490596 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129309 91177308-0d34-0410-b5e6-96231b3b80d8
* Clean up assembly statement separator support.Jim Grosbach2011-03-24
| | | | | | | | | | The MC asm lexer wasn't honoring a non-default (anything but ';') statement separator. Fix that, and generalize a bit to support multi-character statement separators. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128227 91177308-0d34-0410-b5e6-96231b3b80d8
* More whitespace cleanup...Jim Grosbach2011-02-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125388 91177308-0d34-0410-b5e6-96231b3b80d8
* Generalize a previous change, fixing PR8855 - an valid large immediateChris Lattner2010-12-25
| | | | | | | rejected by the mc assembler. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122557 91177308-0d34-0410-b5e6-96231b3b80d8
* Add missing standard headers. Patch by Joerg Sonnenberger!Nick Lewycky2010-12-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122193 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for lexing single quotes like 'c'.Roman Divacky2010-12-18
| | | | | | | | This fixed 8615. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122150 91177308-0d34-0410-b5e6-96231b3b80d8
* MC/AsmLexer: Fix bug in source location for Slash token.Daniel Dunbar2010-10-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117298 91177308-0d34-0410-b5e6-96231b3b80d8
* MC/AsmParser: Handle exponents in floating point literals.Daniel Dunbar2010-09-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114861 91177308-0d34-0410-b5e6-96231b3b80d8
* MC/AsmParser: Handle a missed case of floating literals in the lexer.Daniel Dunbar2010-09-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114733 91177308-0d34-0410-b5e6-96231b3b80d8
* MC/Lexer: Add 'Real' token type for floating point literals.Daniel Dunbar2010-09-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114718 91177308-0d34-0410-b5e6-96231b3b80d8
* fix rdar://7997827 - Accept and ignore LL and ULL suffixes on integer literals.Chris Lattner2010-08-24
| | | | | | | Also fix 0b010 syntax to actually work while we're at it :-) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111876 91177308-0d34-0410-b5e6-96231b3b80d8
* MC: Move getLoc() to MCAsmLexer().Daniel Dunbar2010-07-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108154 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert some tab stops into spaces.Duncan Sands2010-07-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108130 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for parsing the ELF .type assembler directive.Matt Fleming2010-05-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104316 91177308-0d34-0410-b5e6-96231b3b80d8
* Incorporate Daniel's suggestion and use !isdigit(CurPtr[0]) and notKevin Enderby2010-05-18
| | | | | | | | CurPtr[0] == '\n' when testing the character after a "0b" when looking to see if it part of a something like "jmp 0b". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104039 91177308-0d34-0410-b5e6-96231b3b80d8
* Fixed the problem with a branch to "0b" that was not parsed by llvm-mcKevin Enderby2010-05-18
| | | | | | | | correctly. The Lexer was incorrectly eating the newline casusing it to branch to address 0. Updated the test case to use a "0:" label and a branch to "0b". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104038 91177308-0d34-0410-b5e6-96231b3b80d8
* Added support in MC for Directional Local Labels.Kevin Enderby2010-05-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103989 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r103137, fix for $ in labels. It looks like we can't actually handle thisDaniel Dunbar2010-05-06
| | | | | | | | | | | | at the token level. Consider the following horrible test case: a = 1 .globl $a movl ($a), %eax movl $a, %eax movl $$a, %eax git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103178 91177308-0d34-0410-b5e6-96231b3b80d8
* fix rdar://7946934 - in some limited cases, the assembler shouldChris Lattner2010-05-05
| | | | | | | | allow $ at the start of a symbol name. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103137 91177308-0d34-0410-b5e6-96231b3b80d8
* implement mc asmparser support for '.', which gets theChris Lattner2010-04-14
| | | | | | | | | | | | | | | | | | | | | current PC. rdar://7834775 We now produce an identical .o file compared to the cctools assembler for something like this: _f0: L0: jmp L1 .long . - L0 L1: jmp A .long . - L1 .zerofill __DATA,_bss,A,0 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101227 91177308-0d34-0410-b5e6-96231b3b80d8
* add a hack to allow parsing negative minint. rdar://7751341Chris Lattner2010-03-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98442 91177308-0d34-0410-b5e6-96231b3b80d8
* stop using strtoll, it gives windows heartburn.Chris Lattner2010-01-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94167 91177308-0d34-0410-b5e6-96231b3b80d8
* move some files out of the llvm-mc tool into the MCParser library soChris Lattner2010-01-22
other tools can link it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94131 91177308-0d34-0410-b5e6-96231b3b80d8