summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCParser
Commit message (Collapse)AuthorAgeFilesLines
...
* Reland "[CodeView] Use assembler directives for line tables"Reid Kleckner2016-01-291-0/+174
| | | | | | | | This reverts commit r259126 and relands r259117. This time with updated library dependencies. llvm-svn: 259130
* Revert "[CodeView] Use assembler directives for line tables"Reid Kleckner2016-01-291-174/+0
| | | | | | | | | This reverts commit r259117. The LineInfo constructor is defined in the codeview library and we have to link against it now. Doing that isn't trivial, so reverting for now. llvm-svn: 259126
* [CodeView] Use assembler directives for line tablesReid Kleckner2016-01-281-0/+174
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds a new family of .cv_* directives to LLVM's variant of GAS syntax: - .cv_file: Similar to DWARF .file directives - .cv_loc: Similar to the DWARF .loc directive, but starts with a function id. CodeView line tables are emitted by function instead of by compilation unit, so we needed an extra field to communicate this. Rather than overloading the .loc direction further, we decided it was better to have our own directive. - .cv_stringtable: Emits the codeview string table at the current position. Currently this just contains the filenames as null-terminated strings. - .cv_filechecksums: Emits the file checksum table for all files used with .cv_file so far. There is currently no support for emitting actual checksums, just filenames. This moves the line table emission code down into the assembler. This is in preparation for implementing the inlined call site line table format. The inline line table format encoding algorithm requires knowing the absolute code offsets, so it must run after the assembler has laid out the code. David Majnemer collaborated on this patch. llvm-svn: 259117
* Move MCTargetAsmParser.h to llvm/MC/MCParser where it belongs.Benjamin Kramer2016-01-274-4/+4
| | | | llvm-svn: 258917
* Remove autoconf supportChris Bieneman2016-01-261-15/+0
| | | | | | | | | | | | | | | | Summary: This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html "I felt a great disturbance in the [build system], as if millions of [makefiles] suddenly cried out in terror and were suddenly silenced. I fear something [amazing] has happened." - Obi Wan Kenobi Reviewers: chandlerc, grosbach, bob.wilson, tstellarAMD, echristo, whitequark Subscribers: chfast, simoncook, emaste, jholewinski, tberghammer, jfb, danalbert, srhines, arsenm, dschuff, jyknight, dsanders, joker.eph, llvm-commits Differential Revision: http://reviews.llvm.org/D16471 llvm-svn: 258861
* [MC, COFF] Add .reloc support for WinCOFFDavid Majnemer2016-01-191-0/+3
| | | | | | | This adds rudimentary support for a few relocations that we will use for the CodeView debug format. llvm-svn: 258216
* Use std::unique_ptr. NFC.Rafael Espindola2015-12-161-7/+7
| | | | llvm-svn: 255852
* [X86][inline asm] support even directive Michael Zuckerman2015-12-131-0/+5
| | | | | | | | | | | The .even directive aligns content to an evan-numbered address. In at&t syntax .even In Microsoft syntax even (without the dot). Differential Revision: http://reviews.llvm.org/D15413 llvm-svn: 255462
* Replace uint16_t with the MCPhysReg typedef in many places. A lot of ↵Craig Topper2015-12-051-2/+2
| | | | | | physical register arrays already use this typedef. llvm-svn: 254843
* Stop producing .data.rel sections.Rafael Espindola2015-11-183-20/+15
| | | | | | | | | | | | | | | | | If a section is rw, it is irrelevant if the dynamic linker will write to it or not. It looks like llvm implemented this because gcc was doing it. It looks like gcc implemented this in the hope that it would put all the relocated items close together and speed up the dynamic linker. There are two problem with this: * It doesn't work. Both bfd and gold will map .data.rel to .data and concatenate the input sections in the order they are seen. * If we want a feature like that, it can be implemented directly in the linker since it knowns where the dynamic relocations are. llvm-svn: 253436
* [Assembler] Allow non-fatal errors after parsingOliver Stannard2015-11-171-1/+1
| | | | | | | | | | | | | | | | | This adds reportError to MCContext, which can be used as an alternative to reportFatalError when the assembler wants to try to continue processing the rest of the file after the error is reported, so that all of the errors ina file can be reported. It records the fact that an error was encountered, so we can avoid emitting an object file if any errors occurred. This patch doesn't add any uses of this function (a later patch will convert most uses of reportFatalError to use it), but there is a small functional change: we use the SourceManager to print the error message, even if we have a null SMLoc. This means that we get a SourceManager-style message, with the file and line information shown as <unknown>, rather than the "LLVM ERROR" style used by report_fatal_error. llvm-svn: 253327
* Drop prelink support.Rafael Espindola2015-11-171-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The way prelink used to work was * The compiler decides if a given section only has relocations that are know to point to the same DSO. If so, it names it .data.rel.ro.local<something>. * The static linker puts all of these together. * The prelinker program assigns addresses to each library and resolves the local relocations. There are many problems with this: * It is incompatible with address space randomization. * The information passed by the compiler is redundant. The linker knows if a given relocation is in the same DSO or not. If could sort by that if so desired. * There are newer ways of speeding up DSO (gnu hash for example). * Even if we want to implement this again in the compiler, the previous implementation is pretty broken. It talks about relocations that are "resolved by the static linker". If they are resolved, there are none left for the prelinker. What one needs to track is if an expression will require only dynamic relocations that point to the same DSO. At this point it looks like the prelinker is an historical curiosity. For example, fedora has retired it because it failed to build for two releases (http://pkgs.fedoraproject.org/cgit/prelink.git/commit/?id=eb43100a8331d91c801ee3dcdb0a0bb9babfdc1f) This patch removes support for it. That is, it stops printing the ".local" sections. llvm-svn: 253280
* Reduce the size of MCRelaxableFragment.Akira Hatanaka2015-11-141-3/+9
| | | | | | | | | | | | | | | | | | | | | | MCRelaxableFragment previously kept a copy of MCSubtargetInfo and MCInst to enable re-encoding the MCInst later during relaxation. A copy of MCSubtargetInfo (instead of a reference or pointer) was needed because the feature bits could be modified by the parser. This commit replaces the MCSubtargetInfo copy in MCRelaxableFragment with a constant reference to MCSubtargetInfo. The copies of MCSubtargetInfo are kept in MCContext, and the target parsers are now responsible for asking MCContext to provide a copy whenever the feature bits of MCSubtargetInfo have to be toggled. With this patch, I saw a 4% reduction in peak memory usage when I compiled verify-uselistorder.lto.bc using llc. rdar://problem/21736951 Differential Revision: http://reviews.llvm.org/D14346 llvm-svn: 253127
* [MCTargetAsmParser] Move the member varialbes that referenceAkira Hatanaka2015-11-141-2/+9
| | | | | | | | | | MCSubtargetInfo in the subclasses into MCTargetAsmParser and define a member function getSTI. This is done in preparation for making changes to shrink the size of MCRelaxableFragment. (see http://reviews.llvm.org/D14346). llvm-svn: 253124
* Implement .reloc (constant offset only) with support for R_MIPS_NONE and ↵Daniel Sanders2015-11-121-0/+51
| | | | | | | | | | | | | | | | R_MIPS_32. Summary: Support for R_MIPS_NONE allows us to parse MIPS16's usage of .reloc. R_MIPS_32 was included to be able to better test the directive. Targets can add their relocations by overriding MCAsmBackend::getFixupKind(). Subscribers: grosbach, rafael, majnemer, dsanders, llvm-commits Differential Revision: http://reviews.llvm.org/D13659 llvm-svn: 252888
* [AsmParser] Backends can parameterize ASM tokenization.Colin LeMahieu2015-11-091-0/+9
| | | | llvm-svn: 252439
* [AsmParser] Provide target direct access to mnemonic token. Allow ↵Colin LeMahieu2015-11-091-1/+5
| | | | | | | | assignment parsing to be hooked by target. Allow target to specify if identifier is a label. Differential Revision: http://reviews.llvm.org/D14255 llvm-svn: 252435
* [AsmParser] Allow tokens to be put back in to the token stream.Colin LeMahieu2015-11-081-2/+2
| | | | | | Differential Revision: http://reviews.llvm.org/D14252 llvm-svn: 252432
* Simplify now that emitValueToOffset always returns false.Rafael Espindola2015-11-041-13/+2
| | | | llvm-svn: 252102
* ARM: support .watchos_version_min and .tvos_version_min.Tim Northover2015-10-281-1/+28
| | | | | | | | These MachO file directives are used by linkers and other tools to provide compatibility information, much like the existing .ios_version_min and .macosx_version_min. llvm-svn: 251569
* [ms-inline-asm] Leave alignment in bytes if the native assembler uses bytesReid Kleckner2015-10-271-3/+9
| | | | | | | | | | | | | The existing behavior was correct on Darwin, which is probably the platform it was written for. Before this change, we would rewrite "align 8" to ".align 3" and then fail to make it through the integrated assembler because 3 is not a power of 2. Differential Revision: http://reviews.llvm.org/D14120 llvm-svn: 251418
* [MC] Add support for GNU as-compatible binary operator precedenceDavid Majnemer2015-10-261-3/+87
| | | | | | | | | | GNU as and Darwin give the various binary operators different precedence. LLVM's MC supported the Darwin semantics but not the GNU semantics. This fixes PR25311. llvm-svn: 251271
* MC: Don't crash after issuing a diagnostic.Jim Grosbach2015-10-161-3/+2
| | | | | | | | | | | | | | | | Crashing is bad, m'kay? Fixing a 4 year old bug of my own creation. Adding the testcase now which I should have added then which would have long since caught this. The problem is that printMessage() will display the diagnostic but not set HadError to true, resulting in the assembler continuing on its way and trying to create relocations for things that may not allow them or otherwise get itself into trouble. Using the Error() helper function here rather than calling printMessage() directly resolves this. rdar://23133240 llvm-svn: 250557
* [MachO] Stop generating *coal* sections.Akira Hatanaka2015-10-151-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Recommit r250342: move coal-sections-powerpc.s to subdirectory for powerpc. Some background on why we don't have to use *coal* sections anymore: Long ago when C++ was new and "weak" had not been standardized, an attempt was made in cctools to support C++ inlines that can be coalesced by putting them into their own section (TEXT/textcoal_nt instead of TEXT/text). The current macho linker supports the weak-def bit on any symbol to allow it to be coalesced, but the compiler still puts weak-def functions/data into alternate section names, which the linker must map back to the base section name. This patch makes changes that are necessary to prevent the compiler from using the "coal" sections and have it use the non-coal sections instead when the target architecture is not powerpc: TEXT/textcoal_nt instead use TEXT/text TEXT/const_coal instead use TEXT/const DATA/datacoal_nt instead use DATA/data If the target is powerpc, we continue to use the *coal* sections since anyone targeting powerpc is probably using an old linker that doesn't have support for the weak-def bits. Also, have the assembler issue a warning if it encounters a *coal* section in the assembly file and inform the users to use the non-coal sections instead. rdar://problem/14265330 Differential Revision: http://reviews.llvm.org/D13188 llvm-svn: 250370
* Revert r250349.Akira Hatanaka2015-10-151-25/+0
| | | | | | Test case coal-sections-powerpc.s is still failing on some buildbots. llvm-svn: 250351
* [MachO] Stop generating *coal* sections.Akira Hatanaka2015-10-141-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Recommit r250342: add -arch=ppc32 to the RUN lines of powerpc tests. Some background on why we don't have to use *coal* sections anymore: Long ago when C++ was new and "weak" had not been standardized, an attempt was made in cctools to support C++ inlines that can be coalesced by putting them into their own section (TEXT/textcoal_nt instead of TEXT/text). The current macho linker supports the weak-def bit on any symbol to allow it to be coalesced, but the compiler still puts weak-def functions/data into alternate section names, which the linker must map back to the base section name. This patch makes changes that are necessary to prevent the compiler from using the "coal" sections and have it use the non-coal sections instead when the target architecture is not powerpc: TEXT/textcoal_nt instead use TEXT/text TEXT/const_coal instead use TEXT/const DATA/datacoal_nt instead use DATA/data If the target is powerpc, we continue to use the *coal* sections since anyone targeting powerpc is probably using an old linker that doesn't have support for the weak-def bits. Also, have the assembler issue a warning if it encounters a *coal* section in the assembly file and inform the users to use the non-coal sections instead. rdar://problem/14265330 Differential Revision: http://reviews.llvm.org/D13188 llvm-svn: 250349
* Revert r250342.Akira Hatanaka2015-10-141-25/+0
| | | | | | Investigate why coal-sections-powerpc.s is failing on some buildbots. llvm-svn: 250346
* [MachO] Stop generating *coal* sections.Akira Hatanaka2015-10-141-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some background on why we don't have to use *coal* sections anymore: Long ago when C++ was new and "weak" had not been standardized, an attempt was made in cctools to support C++ inlines that can be coalesced by putting them into their own section (TEXT/textcoal_nt instead of TEXT/text). The current macho linker supports the weak-def bit on any symbol to allow it to be coalesced, but the compiler still puts weak-def functions/data into alternate section names, which the linker must map back to the base section name. This patch makes changes that are necessary to prevent the compiler from using the "coal" sections and have it use the non-coal sections instead when the target architecture is not powerpc: TEXT/textcoal_nt instead use TEXT/text TEXT/const_coal instead use TEXT/const DATA/datacoal_nt instead use DATA/data If the target is powerpc, we continue to use the *coal* sections since anyone targeting powerpc is probably using an old linker that doesn't have support for the weak-def bits. Also, have the assembler issue a warning if it encounters a *coal* section in the assembly file and inform the users to use the non-coal sections instead. rdar://problem/14265330 Differential Revision: http://reviews.llvm.org/D13188 llvm-svn: 250342
* Change isUIntN/isIntN calls with constant N to use the template version. NFCCraig Topper2015-10-101-1/+1
| | | | llvm-svn: 249952
* Use range-based for loops. NFCCraig Topper2015-10-101-17/+10
| | | | llvm-svn: 249943
* Use emplace_back instead of a constructor call and push_back. NFCCraig Topper2015-10-101-7/+6
| | | | llvm-svn: 249940
* Cleanup places that passed SMLoc by const reference to pass it by value ↵Craig Topper2015-09-201-5/+5
| | | | | | instead. NFC llvm-svn: 248135
* [MC/ELF] Accept zero for .align directiveDavide Italiano2015-09-081-1/+5
| | | | | | | | | | .align directive refuses alignment 0 -- a comment in the code hints this is done for GNU as compatibility, but it seems GNU as accepts .align 0 (and silently rounds up alignment to 1). Differential Revision: http://reviews.llvm.org/D12682 llvm-svn: 247048
* [MC/AsmParser] Avoid setting MCSymbol.IsUsed in some casesVedant Kumar2015-08-311-9/+8
| | | | | | | | | | | | | | | | | | | | Avoid marking some MCSymbols as used in MC/AsmParser.cpp when no uses exist. This fixes a bug in parseAssignmentExpression() which inadvertently sets IsUsed, thereby triggering: "invalid re-assignment of non-absolute variable" on otherwise valid code. No other functionality change intended. The original version of this patch touched many calls to MCSymbol accessors. On rafael's advice, I have stripped this patch down a bit. As a follow-up, I intend to find the call sites which intentionally set IsUsed and force them to do so explicitly. Differential Revision: http://reviews.llvm.org/D12347 llvm-svn: 246457
* Extend MCAsmLexer so that it can peek forward several tokensBenjamin Kramer2015-08-171-3/+13
| | | | | | | | | | | | | | | This commit adds a virtual `peekTokens()` function to `MCAsmLexer` which can peek forward an arbitrary number of tokens. It also makes the `peekTok()` method call `peekTokens()` method, but only requesting one token. The idea is to better support targets which more more ambiguous assembly syntaxes. Patch by Dylan McKay! llvm-svn: 245221
* Revert "Centralize the information about which object format we are using."Rafael Espindola2015-08-141-6/+4
| | | | | | | | | | | | | | | | | | | | | This reverts commit r245047. It was failing on the darwin bots. The problem was that when running ./bin/llc -march=msp430 llc gets to if (TheTriple.getTriple().empty()) TheTriple.setTriple(sys::getDefaultTargetTriple()); Which means that we go with an arch of msp430 but a triple of x86_64-apple-darwin14.4.0 which fails badly. That code has to be updated to select a triple based on the value of march, but that is not a trivial fix. llvm-svn: 245062
* Centralize the information about which object format we are using.Rafael Espindola2015-08-141-4/+6
| | | | | | | | | | | Other than some places that were handling unknown as ELF, this should have no change. The test updates are because we were detecting arm-coff or x86_64-win64-coff as ELF targets before. It is not clear if the enum should live on the Triple. At least now it lives in a single location and should be easier to move somewhere else. llvm-svn: 245047
* [llvm-mc] Add --no-warn flag with -W alias to disable outputting warnings ↵Colin LeMahieu2015-07-271-0/+2
| | | | | | while assembling. llvm-svn: 243338
* [llvm-mc] Pushing plumbing through for --fatal-warnings flag.Colin LeMahieu2015-07-271-2/+2
| | | | llvm-svn: 243334
* Fix PR23872: Integrated assembler error message when using .type directive ↵Gabor Ballabas2015-07-011-4/+10
| | | | | | | | | | | with @ in AArch32 assembly. The AArch32 assembler parses the '@' as a comment symbol, so the error message shouldn't suggest that '@<type>' is a valid replacement when assembling for AArch32 target. Differential Revision: http://reviews.llvm.org/D10651 llvm-svn: 241149
* Reverting r241058 because it's causing buildbot failures.Ranjeet Singh2015-06-301-3/+1
| | | | llvm-svn: 241061
* There are a few places where subtarget features are stillRanjeet Singh2015-06-301-1/+3
| | | | | | | | | represented by uint64_t, this patch replaces these usages with the FeatureBitset (std::bitset) type. Differential Revision: http://reviews.llvm.org/D10542 llvm-svn: 241058
* IAS: Use the root macro instanciation for locationFrederic Riss2015-06-251-2/+2
| | | | | | | | | | | | | | r224810 fixed the handling of macro debug locations in AsmParser. This patch fixes the logic to actually do what was intended: it uses the first macro of the macro stack instead of the last one. The updated testcase shows that the current scheme doesn't work when macro instanciations are nested and multiple files are used. Reviewers: compnerd Differential Revision: http://reviews.llvm.org/D10463 llvm-svn: 240705
* [mips] [IAS] Fix parsing of memory offset expressions with parenthesis depth >1.Toma Tabacu2015-06-251-0/+23
| | | | | | | | | | | | | | | | | | | Summary: In an expression such as "(((a+b)+c)+d)", parseParenExpression() would only parse the "a+b)+c", which would result in an error later on in the parser. This means that we can only parse one level of inner parentheses. In order to fix this, I added a new function called parseParenExprOfDepth(), which parses a specified number of trailing parenthesis expressions (except for the outermost parenthesis), and changed MipsAsmParser to use it in parseMemOffset instead of parseParenExpression(). Reviewers: dsanders, rafael Reviewed By: dsanders, rafael Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D9742 llvm-svn: 240625
* Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC)Alexander Kornienko2015-06-233-4/+4
| | | | | | Apparently, the style needs to be agreed upon first. llvm-svn: 240390
* Change .thumb_set to have the same error checks as .set.Pete Cooper2015-06-221-70/+106
| | | | | | | | | | | | | | According to the documentation, .thumb_set is 'the equivalent of a .set directive'. We didn't have equivalent behaviour in terms of all the errors we could throw, for example, when a symbol is redefined. This change refactors parseAssignment so that it can be used by .set and .thumb_set and implements tests for .thumb_set for all the errors thrown by that method. Reviewed by Rafael Espíndola. llvm-svn: 240318
* Revert 240130, it caused crashes (repro in PR23900).Nico Weber2015-06-191-2/+4
| | | | llvm-svn: 240193
* Fix header path in CMake. NFC.Pete Cooper2015-06-191-1/+1
| | | | | | | The ADDITIONAL_HEADER_DIRS command can be used to tell UIs that a given library owns certain headers. The path for MCParser was missing MC/ in it. llvm-svn: 240175
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-193-4/+4
| | | | | | | | | | | | | The patch is generated using this command: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ llvm/lib/ Thanks to Eugene Kosov for the original patch! llvm-svn: 240137
* Removing spurious semi colons; NFC.Aaron Ballman2015-06-091-1/+1
| | | | llvm-svn: 239399
OpenPOWER on IntegriCloud