summaryrefslogtreecommitdiffstats
path: root/llvm/test/MC/AsmParser
Commit message (Collapse)AuthorAgeFilesLines
...
* [MC] Fix regression tests on Windows when git “core.autocrlf” is set to ↵Zhen Cao2017-11-171-0/+13
| | | | | | | | true. Differential Revision: https://reviews.llvm.org/D39737 llvm-svn: 318528
* Give a test a tripleReid Kleckner2017-10-101-1/+1
| | | | llvm-svn: 315263
* [SEH] Use reportError instead of report_fatal_error for bad directivesReid Kleckner2017-10-101-0/+96
| | | | | | | | | | This makes the .seh_ directives slightly more usable from standalone assembly files. This removes a large number of report_fatal_errors and recovers from the error by ignoring the directive. llvm-svn: 315262
* [MC] Suppress .Lcfi labels when emitting textual assemblyReid Kleckner2017-10-101-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This suppresses the generation of .Lcfi labels in our textual assembler. It was annoying that this generated cascading .Lcfi labels: llc foo.ll -o - | llvm-mc | llvm-mc After three trips through MCAsmStreamer, we'd have three labels in the output when none are necessary. We should only bother creating the labels and frame data when making a real object file. This supercedes D38605, which moved the entire .seh_ implementation into MCObjectStreamer. This has the advantage that we do more checking when emitting textual assembly, as a minor efficiency cost. Outputting textual assembly is not performance critical, so this shouldn't matter. Reviewers: majnemer, MatzeB Subscribers: qcolombet, nemanjai, javed.absar, eraman, hiraditya, JDevlieghere, llvm-commits Differential Revision: https://reviews.llvm.org/D38638 llvm-svn: 315259
* [MC] - llvm-mc hangs on non-english characters.George Rimar2017-10-053-11/+17
| | | | | | | | | | | | | | | | | | Currently llvm-mc just hangs inside infinite loop while trying to parse file which has ".section .с" inside, where section name is non-english character. Patch fixes the issue. In this patch I also moved content of non-english-characters.s to test/MC/AsmParser/Inputs folder so that non-english-characters.s becomes a single testcase for all invalid inputs containing non-english symbols. That is convinent because llvm-mc otherwise tries to parse and tokenize the whole testcase file with tools invocations and it is harder to isolate the issue. Differential revision: https://reviews.llvm.org/D38545 llvm-svn: 314973
* [MC] - Don't assert when non-english characters are used.George Rimar2017-10-041-0/+14
| | | | | | | | | | | | | | | | | | I found that llvm-mc does not like non-english characters even in comments, which it tries to tokenize. Problem happens because of functions like isdigit(), isalnum() which takes int argument and expects it is not negative. But at the same time MCParser uses char* to store input buffer poiner, char has signed value, so it is possible to pass negative value to one of functions from above and that triggers an assert. Testcase for demonstration is provided. To fix the issue helper functions were introduced in StringExtras.h Differential revision: https://reviews.llvm.org/D38461 llvm-svn: 314883
* [AsmParser] Support GAS's .print directiveCoby Tayree2017-10-021-0/+18
| | | | | | Differential Revision: https://reviews.llvm.org/D38448 llvm-svn: 314674
* [AsmParser] Recommit: Hash is not a comment on some targetsOliver Stannard2017-08-211-62/+62
| | | | | | | | | | | | | | | Re-committing after r311325 fixed an unintentional use of '#' comments in clang. The '#' token is not a comment for all targets (on ARM and AArch64 it marks an immediate operand), so we shouldn't treat it as such. Comments are already converted to AsmToken::EndOfStatement by AsmLexer::LexLineComment, so this check was unnecessary. Differential Revision: https://reviews.llvm.org/D36405 llvm-svn: 311326
* Revert "[AsmParser] Hash is not a comment on some targets"Ahmed Bougacha2017-08-101-62/+62
| | | | | | | | This reverts commit r310457. It causes clang-produced IR to fail llvm codegen. llvm-svn: 310662
* [AsmParser] Hash is not a comment on some targetsOliver Stannard2017-08-091-62/+62
| | | | | | | | | | | | The '#' token is not a comment for all targets (on ARM and AArch64 it marks an immediate operand), so we shouldn't treat it as such. Comments are already converted to AsmToken::EndOfStatement by AsmLexer::LexLineComment, so this check was unnecessary. Differential Revision: https://reviews.llvm.org/D36405 llvm-svn: 310457
* [AsmParser][GAS-compatibility] Ignore an empty 'p2align' directiveCoby Tayree2017-08-021-1/+6
| | | | | | | | | GAS ignores the aforementioned issue this patch aligns LLVM + throws in an appropriate warning Differential Revision: https://reviews.llvm.org/D36060 llvm-svn: 309841
* fix trivial typo in comment, NFCHiroshi Inoue2017-06-261-1/+1
| | | | llvm-svn: 306274
* [MC] Fix compiler crash in AsmParser::LexNirav Dave2017-06-091-0/+4
| | | | | | | | | | | | | | | | When an empty comment is present in an assembly file, the compiler will crash because it checks the first character for '\n' or '\r'. The fix consists of also checking if the string is empty before accessing the *front* method of the StringRef. A test is included for the x86 target, but this issue is reproducible with other targets as well. Patch by Alexandru Guduleasa! Reviewers: niravd, grosbach, llvm-commits Reviewed By: niravd Differential Revision: https://reviews.llvm.org/D33993 llvm-svn: 305077
* [LLVM][inline-asm] Altmacro string escape character '!'Michael Zuckerman2017-05-101-0/+29
| | | | | | | | | | | | | This patch is the fourth patch in a series of reviews for the Altmacro feature. This patch introduces a new escape character '!' and it depends on D32701. according to https://sourceware.org/binutils/docs/as/Altmacro.html: "single-character string escape To include any single character literally in a string (even if the character would otherwise have some special meaning), you can prefix the character with !' (an exclamation mark). For example, you can write <4.3 !> 5.4!!>' to get the literal text `4.3 > 5.4!'. " Differential Revision: https://reviews.llvm.org/D32792 llvm-svn: 302652
* [LLVM][inline-asm][Altmacor] Altmacro string delimiter '<..>'Michael Zuckerman2017-05-042-0/+102
| | | | | | | | | | | | | | | | | | | | | | | | In this patch, I introduce a new altmacro string delimiter. This review is the second review in a series of four reviews. (one for each altmacro feature: LOCAL, string delimiter, string '!' escape sign and absolute expression as a string '%' ). In the alternate macro mode, you can delimit strings with matching angle brackets <..> when using it as a part of calling macro arguments. As described in the https://sourceware.org/binutils/docs-2.27/as/Altmacro.html "<string> You can delimit strings with matching angle brackets." assumptions: 1. If an argument begins with '<' and ends with '>'. The argument is considered as a string. 2. Except adding new string mark '<..>', a regular macro behavior is expected. 3. The altmacro cannot affect the regular less/greater behavior. 4. If a comma is present inside an angle brackets it considered as a character and not as a separator. Differential Revision: https://reviews.llvm.org/D32701 llvm-svn: 302135
* Fix test for altmacroMichael Zuckerman2017-05-012-2/+2
| | | | llvm-svn: 301799
* [LLVM][inline-asm] Altmacro absolute expression '%' featureMichael Zuckerman2017-05-012-0/+99
| | | | | | | | | | | | | | | | | | | | | In this patch, I introduce a new alt macro feature. This feature adds meaning for the % when using it as a prefix to the calling macro arguments. In the altmacro mode, the percent sign '%' before an absolute expression convert the expression first to a string. As described in the https://sourceware.org/binutils/docs-2.27/as/Altmacro.html "Expression results as strings You can write `%expr' to evaluate the expression expr and use the result as a string." expression assumptions: 1. '%' can only evaluate an absolute expression. 2. Altmacro '%' must be the first character of the evaluated expression. 3. If no '%' is located before the expression, a regular module operation is expected. 4. The result of Absolute Expressions can be only integer. Differential Revision: https://reviews.llvm.org/D32526 llvm-svn: 301797
* [AsmParser]Emit an error if a macro has two (or more) parameters sharing the ↵Coby Tayree2017-04-081-0/+7
| | | | | | | | | | | | | same name Introducing a new error to macro parameters' parsing: currently, llvm-mc won't complain if a macro have two (or more) named params with the same name. this behavior is false, as there's no merit in having some params sharing a name. now, instead of tolerate such a phenomena - emit an appropriate error. Differential Revision: https://reviews.llvm.org/D31674 llvm-svn: 299815
* Add default typo to .tbss.*Rafael Espindola2017-03-221-0/+8
| | | | | | This matches gas behavior and is part of pr31888. llvm-svn: 298508
* Set the default type for .bss.foo.Rafael Espindola2017-03-221-0/+8
| | | | | | This matches gas and is part of pr31888. llvm-svn: 298506
* Produce INIT_ARRAY for sections named .init_array.*Rafael Espindola2017-03-221-0/+4
| | | | | | | These sections are merged together by the linker, so they should have the same time. llvm-svn: 298505
* Move test input to directory called Inputs.Daniel Jasper2017-01-063-1/+1
| | | | | | It is a common convention that our internal test runner depends upon. llvm-svn: 291227
* test: remove unnecessary triple argumentSaleem Abdulrasool2017-01-051-1/+1
| | | | | | | This test is entirely target agnostic. Avoid the triple to repair the build bots. llvm-svn: 291088
* MC: support passing search paths to the IASSaleem Abdulrasool2017-01-053-0/+19
| | | | | | | This is needed to support inclusion in inline assembly via the `.include` directive. llvm-svn: 291085
* [Assembler] Better error messages for .org directiveOliver Stannard2016-12-141-1/+1
| | | | | | | | | | | | | | | | | | | | | Currently, the error messages we emit for the .org directive when the expression is not absolute or is out of range do not include the line number of the directive, so it can be hard to track down the problem if a file contains many .org directives. This patch stores the source location in the MCOrgFragment, so that it can be used for diagnostics emitted during layout. Since layout is an iterative process, and the errors are detected during each iteration, it would have been possible for errors to be reported multiple times. To prevent this, I've made the assembler bail out after each iteration if any errors have been reported. This will still allow multiple unrelated errors to be reported in the common case where they are all detected in the first round of layout. Differential Revision: https://reviews.llvm.org/D27411 llvm-svn: 289643
* [AsmParser] Diagnose empty symbol for .set directiveWeiming Zhao2016-12-011-1/+2
| | | | | | | | | | | | Summary: Diagnose empty symbol to avoid hitting assertion in MCContext::getOrCreateSymbol Reviewers: eli.friedman, rengolin Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D26728 llvm-svn: 288390
* [MC] Make llvm-mc fail cleanly on invalid output asm variant.Nirav Dave2016-10-311-0/+3
| | | | | | | | | | | | Fixes PR28488. Reviewers: rnk, majnemer Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D25834 llvm-svn: 285616
* [MC] Fix Various End Of Line Comment checkingsNirav Dave2016-10-243-5/+265
| | | | | | | | | | | | | Fix AsmParser lines to correctly handle end-of-line pre-processor comments parsing when '#' is not the assembly line comment prefix. Reviewers: rnk Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D25567 llvm-svn: 284978
* [MC] Fix Error Location for ParseIdentifierNirav Dave2016-10-121-1/+1
| | | | | | | Prevent partial parsing of '$' or '@' of invalid identifiers and fixup workaround points. NFC Intended. llvm-svn: 284017
* Prevent out of order HashDirective lexing in AsmLexer.Nirav Dave2016-10-031-0/+8
| | | | | | | | | | | | | | | | | | | Retrying after buildbot reset. To lex hash directives we peek ahead to find component tokens, create a unified token, and unlex the peeked tokens so the parser does not need to parse the tokens then. Make sure we do not to lex another hash directive during peek operation. This fixes PR28921. Reviewers: rnk, loladiro Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D24839 llvm-svn: 283111
* Revert "[MC] Prevent out of order HashDirective lexing in AsmLexer."Nirav Dave2016-10-011-8/+0
| | | | | | This reverts commit r282992 which appears to be causing an LTO test failure. llvm-svn: 283034
* [MC] Prevent out of order HashDirective lexing in AsmLexer.Nirav Dave2016-10-011-0/+8
| | | | | | | | | | | | | | | | | To lex hash directives we peek ahead to find component tokens, create a unified token, and unlex the peeked tokens so the parser does not need to parse the tokens then. Make sure we do not to lex another hash directive during peek operation. This fixes PR28921. Reviewers: rnk, loladiro Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D24839 llvm-svn: 282992
* [MC] Support .ds directives in assembler parserPetr Hosek2016-09-231-0/+58
| | | | | | | | These directives are already supported by GNU assembler. Differential Revision: https://reviews.llvm.org/D24740 llvm-svn: 282303
* [MC] Support .dcb directives in assembler parserPetr Hosek2016-09-231-0/+59
| | | | | | | | These directives are already supported by GNU assembler. Differential Revision: https://reviews.llvm.org/D24741 llvm-svn: 282283
* [MC] Support skip and count for .incbin directivePetr Hosek2016-09-231-1/+42
| | | | | | | | These optional arguments are supported by GNU assembler. Differential Revision: https://reviews.llvm.org/D24714 llvm-svn: 282217
* [MC] Support .dc directives in assembler parserPetr Hosek2016-08-231-0/+41
| | | | | | | | | | While these directives are mostly aliases for the existing integer and float value directives, some of them like .dc.a have no direct equivalents and are sometimes being used for convenience. Differential Revision: https://reviews.llvm.org/D23810 llvm-svn: 279577
* Revert r276895 "[MC][X86] Fix Intel Operand assembly parsing for .set ids"Hans Wennborg2016-08-011-0/+20
| | | | | | This caused PR28805. Adding a regression test. llvm-svn: 277402
* Remove inline-comment-2.ll until I can debug why it fails on some buildsNirav Dave2016-07-291-23/+0
| | | | llvm-svn: 277152
* Fix inline-comment-2.ll tripleNirav Dave2016-07-291-2/+3
| | | | llvm-svn: 277149
* [MC] When emitting output hash comments always use standard line comment ↵Nirav Dave2016-07-291-0/+22
| | | | | | seperator llvm-svn: 277146
* [MC] Add command-line option to choose the max nest level in asm macros.Davide Italiano2016-07-271-0/+20
| | | | | | | Submitted by: t83wCSLq Differential Revision: https://reviews.llvm.org/D22313 llvm-svn: 276842
* [MC] Cleanup Error Handling in AsmParserNirav Dave2016-07-181-0/+2
| | | | | | | | | | | | | | | Add parseToken and compatriot functions to stitch error checks in straight linear code. As part of this fix some erronous handling of directives where the EndOfStatement token either was not checked or Lexed on termination. Reviewers: rnk, majnemer Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D22312 llvm-svn: 275795
* [MC] Fix lexing ordering in assembly label parsing to preserve same lineNirav Dave2016-07-131-0/+2
| | | | | | comment placement. llvm-svn: 275265
* Provide support for preserving assembly commentsNirav Dave2016-07-112-0/+97
| | | | | | | | | | | | | | | | | Preserve assembly comments from input in output assembly and flags to toggle property. This is on by default for inline assembly and off in llvm-mc. Parsed comments are emitted immediately before an EOL which generally places them on the expected line. Reviewers: rtrieu, dwmw2, rnk, majnemer Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D20020 llvm-svn: 275058
* Refactor and cleanup Assembly Parsing / LexingNirav Dave2016-06-171-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | Recommiting after fixing non-atomic insert to front of SmallVector in MCAsmLexer.h Add explicit Comment Token in Assembly Lexing for future support for outputting explicit comments from inline assembly. As part of this, CPPHash Directives are now explicitly distinguished from Hash line comments in Lexer. Line comments are recorded as EndOfStatement tokens, not Comment tokens to simplify compatibility with current TargetParsers. This slightly complicates comment output. This remove all lexing tasks out of the parser, does minor cleanup to remove extraneous newlines Asm Output, and some improvements white space handling. Reviewers: rtrieu, dwmw2, rnk Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D20009 llvm-svn: 273007
* Revert "Refactor and cleanup Assembly Parsing / Lexing"Nirav Dave2016-06-161-23/+0
| | | | | | | | Reverting for unexpected crashes on various platforms. This reverts commit r272953. llvm-svn: 272957
* Refactor and cleanup Assembly Parsing / LexingNirav Dave2016-06-161-0/+23
| | | | | | | | | | | | | | | | | | | | | | | Add explicit Comment Token in Assembly Lexing for future support for outputting explicit comments from inline assembly. As part of this, CPPHash Directives are now explicitly distinguished from Hash line comments in Lexer. Line comments are recorded as EndOfStatement tokens, not Comment tokens to simplify compatibility with current TargetParsers. This slightly complicates comment output. This remove all lexing tasks out of the parser, does minor cleanup to remove extraneous newlines Asm Output, and some improvements white space handling. Reviewers: rtrieu, dwmw2, rnk Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D20009 llvm-svn: 272953
* Ignore Lexing errors in macro body definitionsNirav Dave2016-06-022-6/+16
| | | | | | | | | | | | | | | | | | | | Do not issue lexing errors found during the parsing of macro body definitions and parseIdentifier function in AsmParser. This changes the Parser to not issue a lexing error when we reach an error, but rather when it is consumed allowing us time to examine and recover from an error. As a result, of this, we stop issuing a both lexing error and a parsing error in floating-literals test. Minor tweak to parseDirectiveRealValue to favor more meaningful lexing error over less helpful parse error. Reviewers: rnk, majnemer Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D20535 llvm-svn: 271542
* [MC] Support symbolic expressions in assembly directivesPetr Hosek2016-05-282-28/+30
| | | | | | | | | This matches the behavior of GNU assembler which supports symbolic expressions in absolute expressions used in assembly directives. Differential Revision: http://reviews.llvm.org/D20752 llvm-svn: 271102
* Revert "[MC] Support symbolic expressions in assembly directives"Petr Hosek2016-05-273-47/+28
| | | | | | This reverts commit r271028, it causes the directive_fill.s to fail. llvm-svn: 271038
OpenPOWER on IntegriCloud