summaryrefslogtreecommitdiff
path: root/lib/MC/MCParser
AgeCommit message (Collapse)Author
2018-02-16Merging r325139:Hans Wennborg
------------------------------------------------------------------------ r325139 | rafael | 2018-02-14 17:34:27 +0100 (Wed, 14 Feb 2018) | 12 lines Store defined macros in MCContext. So that macros defined in inline assembly blocks are available to the whole file. This provides a consistent behavior with other assembly directives, since equations for example are already preserved between inline assembly blocks. PR: 36110 Patch by Roger! ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@325330 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-31[MC] - Stop ignoring invalid meta data symbols.George Rimar
Previously llvm-mc would silently accept code from testcase, that contains invalid metadata symbol in section declaration. Patch fixes the issue. Differential revision: https://reviews.llvm.org/D41641 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321599 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-25[MC] - Disallow invalid section groups declarations.George Rimar
This fixes parseGroup() so that it always sets error condition on error. Previously it was not done, because parseIdentifier looks never do that, assuming that caller should do it if he wants to. So previously cases from test were silently accepted and produced broken output. Differential revision: https://reviews.llvm.org/D41559 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321439 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-24Make helpers static. No functionality change.Benjamin Kramer
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321425 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-24[MC] - Teach llvm-mc to handle comdats whose names are numbers.George Rimar
Currently llvm-mc ignores COMDATs whose names are numbers, for example following code: .section .foo,"G",@progbits,123,comdat would produce no COMDATs at all. Patch fixes the issue. Differential revision: https://reviews.llvm.org/D41552 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321419 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14MC: Add support for mach-o build_versionMatthias Braun
LC_BUILD_VERSION is a new load command superseding the previously used LC_XXX_MIN_VERSION commands. This adds an assembler directive along with encoding/streaming support. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320661 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-17[MC] Fix regression tests on Windows when git “core.autocrlf” is set to ↵Zhen Cao
true. Differential Revision: https://reviews.llvm.org/D39737 This is the second attempt to commit this. The test was broken on Linux in the first attempt. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318560 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-17Revert "[MC] Fix regression tests on Windows when git “core.autocrlf” is ↵Rafael Espindola
set to true." This reverts commit r318528. MC/AsmParser/preserve-comments-crlf.s fails on linux. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318533 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-17[MC] Fix regression tests on Windows when git “core.autocrlf” is set to ↵Zhen Cao
true. Differential Revision: https://reviews.llvm.org/D39737 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318528 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-16[MC] Lex CRLF as one tokenReid Kleckner
This will prevent doubling of line endings when parsing assembly and emitting assembly. Otherwise we'd parse the directive, consume the end of statement, hit the next end of statement, and emit a fresh newline. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315943 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-15Reverting r315590; it did not include changes for llvm-tblgen, which is ↵Aaron Ballman
causing link errors for several people. Error LNK2019 unresolved external symbol "public: void __cdecl `anonymous namespace'::MatchableInfo::dump(void)const " (?dump@MatchableInfo@?A0xf4f1c304@@QEBAXXZ) referenced in function "public: void __cdecl `anonymous namespace'::AsmMatcherEmitter::run(class llvm::raw_ostream &)" (?run@AsmMatcherEmitter@?A0xf4f1c304@@QEAAXAEAVraw_ostream@llvm@@@Z) llvm-tblgen D:\llvm\2017\utils\TableGen\AsmMatcherEmitter.obj 1 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315854 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-12[dump] Remove NDEBUG from test to enable dump methods [NFC]Don Hinton
Summary: Add LLVM_FORCE_ENABLE_DUMP cmake option, and use it along with LLVM_ENABLE_ASSERTIONS to set LLVM_ENABLE_DUMP. Remove NDEBUG and only use LLVM_ENABLE_DUMP to enable dump methods. Move definition of LLVM_ENABLE_DUMP from config.h to llvm-config.h so it'll be picked up by public headers. Differential Revision: https://reviews.llvm.org/D38406 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315590 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-11[codeview] Implement FPO data assembler directivesReid Kleckner
Summary: This adds a set of new directives that describe 32-bit x86 prologues. The directives are limited and do not expose the full complexity of codeview FPO data. They are merely a convenience for the compiler to generate more readable assembly so we don't need to generate tons of labels in CodeGen. If our prologue emission changes in the future, we can change the set of available directives to suit our needs. These are modelled after the .seh_ directives, which use a different format that interacts with exception handling. The directives are: .cv_fpo_proc _foo .cv_fpo_pushreg ebp/ebx/etc .cv_fpo_setframe ebp/esi/etc .cv_fpo_stackalloc 200 .cv_fpo_endprologue .cv_fpo_endproc .cv_fpo_data _foo I tried to follow the implementation of ARM EHABI CFI directives by sinking most directives out of MCStreamer and into X86TargetStreamer. This helps avoid polluting non-X86 code with WinCOFF specific logic. I used cdb to confirm that this can show locals in parent CSRs in a few cases, most importantly the one where we use ESI as a frame pointer, i.e. the one in http://crbug.com/756153#c28 Once we have cdb integration in debuginfo-tests, we can add integration tests there. Reviewers: majnemer, hans Subscribers: aemerson, mgorny, kristof.beyls, llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D38776 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315513 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-11[Asm] Add debug tracing in table-generated assembly matcherOliver Stannard
This adds debug tracing to the table-generated assembly instruction matcher, enabled by the -debug-only=asm-matcher option. The changes in the target AsmParsers are to add an MCInstrInfo reference under a consistent name, so that we can use it from table-generated code. This was already being used this way for targets that use deprecation warnings, but 5 targets did not have it, and Hexagon had it under a different name to the other backends. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315445 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-10[SEH] Use reportError instead of report_fatal_error for bad directivesReid Kleckner
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315262 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-08Remove unused variables. No functionality change.Benjamin Kramer
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315185 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-05[MC] - llvm-mc hangs on non-english characters.George Rimar
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314973 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-04[MC] - Don't assert when non-english characters are used.George Rimar
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314883 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-02[AsmParser] Support GAS's .print directiveCoby Tayree
Differential Revision: https://reviews.llvm.org/D38448 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314674 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-19Re-land "Fix Bug 30978 by emitting cv file checksums."Reid Kleckner
This reverts r313431 and brings back r313374 with a fix to write checksums as binary data and not ASCII hex strings. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313657 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-16Revert "Fix Bug 30978 by emitting cv file checksums."Eric Beckmann
This reverts commit 6389e7aa724ea7671d096f4770f016c3d86b0d54. There is a bug in this implementation where the string value of the checksum is outputted, instead of the actual hex bytes. Therefore the checksum is incorrect, and this prevent pdbs from being loaded by visual studio. Revert this until the checksum is emitted correctly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313431 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-15Fix Bug 30978 by emitting cv file checksums.Eric Beckmann
Summary: The checksums had already been placed in the IR, this patch allows MCCodeView to actually write it out to an MCStreamer. Subscribers: llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D37157 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313374 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-12bpf: Add BPF AsmParser support in LLVMYonghong Song
Reviewed-by: Yonghong Song <yhs@fb.com> Signed-off-by: Jiong Wang <jiong.wang@netronome.com> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313055 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28Untabify.NAKAMURA Takumi
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311875 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-24[X86AsmParser] Refactoring, (almost) NFC.Coby Tayree
Some refactoring to X86AsmParser, mostly regarding the way rewrites are conducted. Mainly, we try to concentrate all the rewrite effort under one hood, so it'll hopefully be less of a mess and easier to maintain and understand. naturally, some frontend tests were affected: D36794 Differential Revision: https://reviews.llvm.org/D36793 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311639 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-21[AsmParser] Recommit: Hash is not a comment on some targetsOliver Stannard
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311326 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-10Revert "[AsmParser] Hash is not a comment on some targets"Ahmed Bougacha
This reverts commit r310457. It causes clang-produced IR to fail llvm codegen. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310662 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-09[AsmParser] Hash is not a comment on some targetsOliver Stannard
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310457 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-02[AsmParser][GAS-compatibility] Ignore an empty 'p2align' directiveCoby Tayree
GAS ignores the aforementioned issue this patch aligns LLVM + throws in an appropriate warning Differential Revision: https://reviews.llvm.org/D36060 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309841 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-28MC: add support for cfi_return_columnSaleem Abdulrasool
This adds support for the CFI pseudo-op return_column. This specifies the frame table column which contains the return address. Addresses PR33953! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309360 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-28MC: clang-format enumeration (NFC)Saleem Abdulrasool
This was hard to insert elements into. clang-format it so that it is easier. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309359 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-14MC, Object: Reserve a section type, SHT_LLVM_ODRTAB, for the ODR table.Peter Collingbourne
This is part of the ODR checker proposal: http://lists.llvm.org/pipermail/llvm-dev/2017-June/113820.html Per discussion on the gnu-gabi mailing list [1] the section type range 0x6fff4c00..0x6fff4cff is reserved for LLVM. [1] https://sourceware.org/ml/gnu-gabi/2017-q2/msg00030.html Differential Revision: https://reviews.llvm.org/D33978 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305407 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-09[MC] Fix compiler crash in AsmParser::LexNirav Dave
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305077 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-07Move Object format code to lib/BinaryFormat.Zachary Turner
This creates a new library called BinaryFormat that has all of the headers from llvm/Support containing structure and layout definitions for various types of binary formats like dwarf, coff, elf, etc as well as the code for identifying a file from its magic. Differential Revision: https://reviews.llvm.org/D33843 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304864 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-06Sort the remaining #include lines in include/... and lib/....Chandler Carruth
I did this a long time ago with a janky python script, but now clang-format has built-in support for this. I fed clang-format every line with a #include and let it re-sort things according to the precise LLVM rules for include ordering baked into clang-format these days. I've reverted a number of files where the results of sorting includes isn't healthy. Either places where we have legacy code relying on particular include ordering (where possible, I'll fix these separately) or where we have particular formatting around #include lines that I didn't want to disturb in this patch. This patch is *entirely* mechanical. If you get merge conflicts or anything, just ignore the changes in this patch and run clang-format over your #include lines in the files. Sorry for any noise here, but it is important to keep these things stable. I was seeing an increasing number of patches with irrelevant re-ordering of #include lines because clang-format was used. This patch at least isolates that churn, makes it easy to skip when resolving conflicts, and gets us to a clean baseline (again). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304787 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10chang type from 'int' to 'size_t'. This will fix revision number 302652Michael Zuckerman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302660 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10[LLVM][inline-asm] Altmacro string escape character '!'Michael Zuckerman
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302652 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-04[LLVM][inline-asm][Altmacor] Altmacro string delimiter '<..>'Michael Zuckerman
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302135 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-01[LLVM][inline-asm] Altmacro absolute expression '%' featureMichael Zuckerman
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301797 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26PR31007 and PR27884 will be closed: a possibility to compile constants like ↵Andrew V. Tischenko
0bH is now supported in MS asm. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301390 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17Distinguish between code pointer size and DataLayout::getPointerSize() in ↵Konstantin Zhuravlyov
DWARF info generation git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300463 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-08[AsmParser]Emit an error if a macro has two (or more) parameters sharing the ↵Coby Tayree
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299815 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-04[MC] Set defaults based on section names and support name suffixesPetr Hosek
Set correct default flags and section type based on its name for .text, .data, .bss, .init_array, .fini_array, .preinit_array, .tdata, and .tbss and support section name suffixes for .data.*, .rodata.*, .text.*, .bss.*, .tdata.* and .tbss.* which matches the behavior of GAS. Fixes PR31888. Differential Revision: https://reviews.llvm.org/D30229 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299484 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-04Change section flag character for SHF_LINK_ORDER to "o".Evgeniy Stepanov
GAS uses "m" as a compatibility alias for "M" (SHF_MERGE). "o" is free, except on ia64, where it already means SHF_LINK_ORDER. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299479 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-04[X86][inline-asm] Add support for MS 'EVEN' directiveCoby Tayree
MS assembly syntax provide us with the 'EVEN' directive as a synonymous to at&t '.even'. This patch include the (small, simple) changes need to allow it. Test is provided at the following (clang-side) review: https://reviews.llvm.org/D27418 Differential Revision: https://reviews.llvm.org/D27417 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299453 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22Add default typo to .tbss.*Rafael Espindola
This matches gas behavior and is part of pr31888. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298508 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22Set the default type for .bss.foo.Rafael Espindola
This matches gas and is part of pr31888. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298506 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22Produce INIT_ARRAY for sections named .init_array.*Rafael Espindola
These sections are merged together by the linker, so they should have the same time. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298505 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-17[Asm] Don't list '@<type>' in diag when '@' is a commentOliver Stannard
This fixes https://bugs.llvm.org//show_bug.cgi?id=31280 Differential revision: https://reviews.llvm.org/D31026 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298067 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14Fix asm printing of associated sections.Evgeniy Stepanov
Make MCSectionELF::AssociatedSection be a link to a symbol, because that's how it works in the assembly, and use it in the asm printer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297769 91177308-0d34-0410-b5e6-96231b3b80d8