summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC
Commit message (Collapse)AuthorAgeFilesLines
...
* [Assembler] Allow non-fatal errors after parsingOliver Stannard2015-11-172-6/+18
| | | | | | | | | | | | | | | | | 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-172-14/+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
* [ARM,AArch64] Store source location of asm constant pool entriesOliver Stannard2015-11-161-5/+5
| | | | | | | | | | Storing the source location of the expression that created a constant pool entry allows us to emit better error messages if we later discover that the expression cannot be represented by a relocation. Differential Revision: http://reviews.llvm.org/D14646 llvm-svn: 253220
* [ARM] Introduce subtarget features per ARM architecture.Bradley Smith2015-11-161-2/+2
| | | | | | | This allows for accurate architecture targeting as well as removing duplicate information (hardcoded feature strings) from MCTargetDesc. llvm-svn: 253196
* Reduce the size of MCRelaxableFragment.Akira Hatanaka2015-11-142-3/+14
| | | | | | | | | | | | | | | | | | | | | | 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-124-0/+91
| | | | | | | | | | | | | | | | 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
* [MC] Use LShr for constant evaluation of ">>" on non-arm64 darwin.Ahmed Bougacha2015-11-112-7/+1
| | | | | | | Follow-up to r235963: this matches other assemblers and is less unexpected (e.g. PR23227). llvm-svn: 252681
* [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
* Bring r252305 back with a test fix.Rafael Espindola2015-11-062-24/+20
| | | | | | | | | | We now create the .eh_frame section early, just like every other special section. This means that the special flags are visible in code that explicitly asks for ".eh_frame". llvm-svn: 252313
* Revert "Simplify the creation of .eh_frame/.debug_frame sections."Rafael Espindola2015-11-061-18/+24
| | | | | | | | This reverts commit r252305. Investigating a test failure. llvm-svn: 252306
* Simplify the creation of .eh_frame/.debug_frame sections.Rafael Espindola2015-11-061-24/+18
| | | | llvm-svn: 252305
* git clang-format and fix variable names. NFC.Rafael Espindola2015-11-061-42/+34
| | | | llvm-svn: 252304
* Use SHT_X86_64_UNWIND on every OS.Rafael Espindola2015-11-061-7/+5
| | | | | | | That is the ABI required type. Linkers still check the section name, so everything should still work. llvm-svn: 252300
* Pass SectionStart directly to the one function that uses it.Rafael Espindola2015-11-061-8/+5
| | | | llvm-svn: 252299
* Simplify the alignment handling in FDE emission.Rafael Espindola2015-11-061-16/+15
| | | | llvm-svn: 252271
* Delete dead store. NFC.Rafael Espindola2015-11-061-1/+0
| | | | llvm-svn: 252270
* Use a range loop.Rafael Espindola2015-11-061-3/+1
| | | | llvm-svn: 252260
* Pass the streamer to the constructor instead of every other method. NFC.Rafael Espindola2015-11-061-76/+66
| | | | llvm-svn: 252246
* Simplify the constructor. NFC.Rafael Espindola2015-11-051-5/+4
| | | | llvm-svn: 252243
* git-clang-format an area I am about to change.Rafael Espindola2015-11-051-32/+29
| | | | llvm-svn: 252241
* Small simplification by moving early continue earlier.Rafael Espindola2015-11-051-6/+4
| | | | llvm-svn: 252237
* Fix pr24832.Rafael Espindola2015-11-051-9/+1
| | | | | | It is pretty simple now that the yak is shaved. llvm-svn: 252105
* Simplify now that emitValueToOffset always returns false.Rafael Espindola2015-11-044-21/+6
| | | | llvm-svn: 252102
* Simplify .org processing and make it a bit more powerful.Rafael Espindola2015-11-042-19/+10
| | | | | | | We now always create the fragment, which lets us handle things like .org after a .align. llvm-svn: 252101
* Fix some Clang-tidy modernize warnings, other minor fixes.Eugene Zelenko2015-11-041-5/+3
| | | | | | | | Fixed warnings are: modernize-use-override, modernize-use-nullptr and modernize-redundant-void-arg. Differential revision: http://reviews.llvm.org/D14312 llvm-svn: 252087
* Don't create empty sections just to look like gas.Rafael Espindola2015-11-031-10/+0
| | | | | | | We are long past the time when this much bug for bug compatibility was useful. llvm-svn: 251970
* Delete dead code.Rafael Espindola2015-11-031-6/+0
| | | | llvm-svn: 251960
* Simplify local common output.Rafael Espindola2015-11-031-20/+14
| | | | | | | | We now create them as they are found and use higher level APIs. This is a step in avoiding creating unnecessary sections. llvm-svn: 251958
* Move code out of a loop and use a range loop.Rafael Espindola2015-11-031-10/+8
| | | | llvm-svn: 251952
* ELF can handle some relocations of the form -sym + constant.Rafael Espindola2015-11-021-5/+0
| | | | | | | | Remove code that was assuming that this would never work. Thanks to Colin LeMahie for finding and diagnosing the bug. llvm-svn: 251818
* ARM: add support for WatchOS's compact unwind information.Tim Northover2015-10-282-3/+14
| | | | llvm-svn: 251573
* ARM: support .watchos_version_min and .tvos_version_min.Tim Northover2015-10-284-7/+60
| | | | | | | | 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
* Rename qsort -> multikey_qsort. NFC.Rui Ueyama2015-10-271-4/+4
| | | | | | `qsort` as a file-scope local function name was confusing. llvm-svn: 251414
* Optimize StringTableBuilder.Rui Ueyama2015-10-261-14/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is a patch to improve StringTableBuilder's performance. That class' finalize function is very hot particularly in LLD because the function does tail-merge strings in string tables or SHF_MERGE sections. Generic std::sort-style sorter is not efficient for sorting strings. The function implemented in this patch seems to be more efficient. Here's a benchmark of LLD to link Clang with or without this patch. The numbers are medians of 50 runs. -O0 real 0m0.455s real 0m0.430s (5.5% faster) -O3 real 0m0.487s real 0m0.452s (7.2% faster) Since that is a benchmark of the whole linker, the speedup of StringTableBuilder itself is much more than that. http://reviews.llvm.org/D14053 llvm-svn: 251337
* ARM/ELF: Better codegen for global variable addresses.Peter Collingbourne2015-10-261-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In PIC mode we were previously computing global variable addresses (or GOT entry addresses) by adding the PC, the PC-relative GOT displacement and the GOT-relative symbol/GOT entry displacement. Because the latter two displacements are fixed, we ended up performing one more addition than necessary. This change causes us to compute addresses using a single PC-relative displacement, resulting in a shorter code sequence. This reduces code size by about 4% in a recent build of Chromium for Android. As a result of this change we no longer need to compute the GOT base address in the ARM backend, which allows us to remove the Global Base Reg pass and SDAG lowering for the GOT. We also now no longer use the GOT when addressing a symbol which is known to be defined in the same linkage unit. Specifically, the symbol must have either hidden visibility or a strong definition in the current module in order to not use the the GOT. This is a change from the previous behaviour where we would use the GOT to address externally visible symbols defined in the same module. I think the only cases where this could matter are cases involving symbol interposition, but we don't really support that well anyway. Differential Revision: http://reviews.llvm.org/D13650 llvm-svn: 251322
* [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
* Add a RAW mode to StringTableBuilder.Rafael Espindola2015-10-234-10/+21
| | | | | | | | | | | | In this mode it just tries to tail merge the strings without imposing any other format constrains. It will not, for example, add a null byte between them. Also add support for keeping a tentative size and offset if we decide to not optimize after all. This will be used shortly in lld for merging SHF_STRINGS sections. llvm-svn: 251153
* Fix the variable names to match the LLVM style.Rafael Espindola2015-10-231-27/+27
| | | | llvm-svn: 251143
* Avoid storing a second copy of each string in StringTableBuilder.Rafael Espindola2015-10-222-12/+28
| | | | | | This was only use in the extremely uncommon case of @@@ symbols on ELF. llvm-svn: 251039
* Fix broken build under MSVC.Zachary Turner2015-10-221-0/+2
| | | | llvm-svn: 251030
* Avoid hash lookups when finalizing StringTableBuilder. NFC.Rafael Espindola2015-10-221-10/+11
| | | | llvm-svn: 251024
* Use array_pod_sort. NFC.Rafael Espindola2015-10-221-4/+7
| | | | llvm-svn: 251023
* Use std::begin/end and std::is_sorted to simplify some code. NFCCraig Topper2015-10-171-7/+6
| | | | llvm-svn: 250614
* 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
* Prevent assertion with "llc -debug" and anonymous symbols.Tim Northover2015-10-151-1/+1
| | | | llvm-svn: 250425
* [MachO] Stop generating *coal* sections.Akira Hatanaka2015-10-152-13/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
OpenPOWER on IntegriCloud