summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC
Commit message (Collapse)AuthorAgeFilesLines
...
* Write the string table directly to the output file.Rafael Espindola2015-04-291-14/+22
| | | | | | There is no need to accumulate it in fragments first. llvm-svn: 236148
* [Sparc] Really add sparcel architecture support.Douglas Katzman2015-04-291-0/+1
| | | | | | | | Mostly copy-and-paste from Sparc v8 architecture. Differential Revision: http://reviews.llvm.org/D8741 llvm-svn: 236146
* Write the section header string table directly to the output stream.Rafael Espindola2015-04-291-30/+38
| | | | | | | | | | Instead of accumulating the content in a fragment first, just write it to the output stream. Also put it first in the section table, so that we never have to worry about its index being >= SHN_LORESERVE. llvm-svn: 236145
* Avoid a few const_cast.Rafael Espindola2015-04-291-13/+12
| | | | llvm-svn: 236141
* Map directly from signature symbol to group index. NFC.Rafael Espindola2015-04-281-10/+13
| | | | llvm-svn: 236058
* Remove redundant temporary std::vector.Rafael Espindola2015-04-281-25/+7
| | | | | | | New sections are added to the end of the list, so the RelSections array was redundant. llvm-svn: 236053
* Avoid one more walk over all sections. NFC.Rafael Espindola2015-04-281-9/+3
| | | | | | Set the group section index as they are created. llvm-svn: 236049
* Use a range loop. NFC.Rafael Espindola2015-04-281-3/+2
| | | | llvm-svn: 236047
* Avoid an extra walk over the sections just to assign sections to groups.Rafael Espindola2015-04-281-30/+41
| | | | | | Assign the sections in the same pass we compute the index. llvm-svn: 236045
* Remove the GroupMapTy DenseMap. NFC.Rafael Espindola2015-04-282-20/+12
| | | | | | Instead use the Group symbol of MCSectionELF. llvm-svn: 236033
* Use range loops. NFC.Rafael Espindola2015-04-281-7/+3
| | | | llvm-svn: 236028
* Avoid adding to SectionIndexMap sections that we never lookup. NFC.Rafael Espindola2015-04-281-33/+28
| | | | llvm-svn: 236026
* Use a range loop. NFC.Rafael Espindola2015-04-281-3/+2
| | | | llvm-svn: 236015
* Use a std::vector to record the offsets of the sections. NFC.Rafael Espindola2015-04-281-10/+8
| | | | llvm-svn: 235995
* Avoid an extra loop for computing the section size. NFC.Rafael Espindola2015-04-281-29/+13
| | | | llvm-svn: 235994
* Use CIE version 4 for dwarf4.Rafael Espindola2015-04-281-4/+15
| | | | | | | According to http://www.dwarfstd.org/doc/DWARF4.pdf appendix F the CIE version for dwarf 4 is 4. llvm-svn: 235988
* [MC] Use LShr for constant evaluation of ">>" on ELF/arm64--darwin.Ahmed Bougacha2015-04-283-1/+10
| | | | | | | | | | This matches other assemblers and is less unexpected (e.g. PR23227). On ELF, I tried binutils gas v2.24 and nasm 2.10.09, and they both agree on LShr. On COFF, I couldn't get my hands on an assembler yet, so don't change the behavior. For now, don't change it on non-AArch64 Darwin either, as the other assembler is gas v1.38, which does an AShr. llvm-svn: 235963
* [MC] Split MCBinaryExpr::Shr into LShr and AShr.Ahmed Bougacha2015-04-283-5/+8
| | | | | | | | Defaulting to AShr without consulting the target MCAsmInfo isn't OK. Add a flag to fix that. Keep it off for now: target migrations will follow in separate commits. llvm-svn: 235951
* [MC] Move getBinOpPrecedence into AsmParser. NFC.Ahmed Bougacha2015-04-281-2/+5
| | | | | | In preparation for a future patch. llvm-svn: 235950
* Use CIE version 1 for .eh_frame.Rafael Espindola2015-04-271-1/+2
| | | | | | | | | | According to http://www.linuxbase.org/betaspecs/lsb/LSB-Core-generic/LSB-Core-generic/ehframechpt.html we should always use 1. llvm-svn: 235923
* [MC] [IAS] Add support for the \@ .macro pseudo-variable.Toma Tabacu2015-04-271-29/+53
| | | | | | | | | | | | | | | | | | Summary: When used, it is substituted with the number of .macro instantiations we've done up to that point in time. So if this is the 1st time we've instantiated a .macro (any .macro, regardless of name), \@ will instantiate to 0, if it's the 2nd .macro instantiation, it will instantiate to 1 etc. It can only be used inside a .macro definition, an .irp definition or an .irpc definition (those last 2 uses are undocumented). Reviewers: echristo, rafael Reviewed By: rafael Subscribers: dsanders, llvm-commits Differential Revision: http://reviews.llvm.org/D9197 llvm-svn: 235862
* Revert accidentally committed "MC: Allow targets to stop symbol name quoting"Matt Arsenault2015-04-233-6/+3
| | | | llvm-svn: 235672
* MC: Allow targets to stop symbol name quotingMatt Arsenault2015-04-233-3/+6
| | | | | | | | | Currently symbol names are printed in quotes if it contains something outside of the arbitrary set of characters that isAcceptableChar tests for. On somem targets, it is never OK to print a symbol name in quotes so allow targets to opt out of this behavior. llvm-svn: 235670
* [mips] [IAS] Implement the .asciiz directive.Toma Tabacu2015-04-211-0/+4
| | | | | | | | | | | | | | | | Summary: This directive is exactly the same as .asciz, except it's only used by MIPS. It is used to store null terminated strings in object files. Reviewers: rafael, dsanders, echristo Reviewed By: dsanders, echristo Subscribers: echristo, llvm-commits Differential Revision: http://reviews.llvm.org/D7530 llvm-svn: 235382
* [MC] When using bundle aligment, align sections to bundle sizeDerek Schuff2015-04-211-0/+15
| | | | | | | | | | | | | | | Summary: Bundle aligment requires that the functions always start at an aligned address. Usually this is ensured by the compiler, but assembly code does not always begin with a .align directive. This change ensures that sections get the correct alignment if they contain any instructions and bundling is enabled. (It also makes LLVM match the behavior of GNU as). Differential Revision: http://reviews.llvm.org/D9131 llvm-svn: 235365
* Look past locals in comdats.Rafael Espindola2015-04-201-9/+8
| | | | | | | | | | | We have to avoid converting a reference to a global into a reference to a local, but it is fine to look past a local. Patch by Vasileios Kalintiris. I just moved the comment and added thet test. llvm-svn: 235300
* Compute A-B when A or B is weak.Rafael Espindola2015-04-175-26/+20
| | | | | | | | | | | | | | | | | | | | Similar to r235222, but for the weak symbol case. In an "ideal" assembler/object format an expression would always refer to the final value and A-B would only be computed from a section in the same comdat as A and B with A and B strong. Unfortunately that is not the case with debug info on ELF, so we need an heuristic. Since we need an heuristic, we may as well use the same one as gas: * call weak_sym : produces a relocation, even if in the same section. * A - weak_sym and weak_sym -A: don't produce a relocation if we can compute it. This fixes pr23272 and changes the fix of pr22815 to match what gas does. llvm-svn: 235227
* Compute A-B if both A and B are in the same comdat section.Rafael Espindola2015-04-171-18/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Part of pr23272. A small annoyance with the assembly syntax we implement is that given an expression there is no way to know if what is desired is the value of that expression for the symbols in this file or for the final values of those symbols in a link. The first case is useful for use in sections that get discarded or ignored if the section they are describing is discarded. For axample, consider A-B where A and B are in the same comdat section. We can compute the value of the difference in the section that is present in the current .o and if that section survives to the final DSO the value will still will be correct. But the section is in a comdat. Another section from another object file might be used istead. We know that that section will define A and B, but we have no idea what the value of A-B might be. In practice we have to assume that the intention is to compute the value in the current section since otherwise the is no way to create something like the debug aranges section. llvm-svn: 235222
* Move AliasedSymbol to MachObjectWriter.Rafael Espindola2015-04-172-14/+14
| | | | | | | It was only used by MachO. Part of pr19627. llvm-svn: 235185
* Add a proper fix for pr23025.Rafael Espindola2015-04-171-4/+16
| | | | | | | Instead of avoiding looking past every global symbol, only do so if the symbol is in a comdat. llvm-svn: 235181
* [mc] Clean up emission of byte sequencesBenjamin Kramer2015-04-173-8/+3
| | | | | | No functional change intended. llvm-svn: 235178
* Don't walk aliases from global to local symbols in comdats.Rafael Espindola2015-04-171-1/+30
| | | | | | This fixes pr23196. llvm-svn: 235167
* Write relocation sections contiguously.Rafael Espindola2015-04-171-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Linkers normally read all the relocations upfront to compute the references between sections. Putting them together is a bit more cache friendly. I benchmarked linking a Release+Asserts clang with gold on a vm. I tried all 4 combinations of --gc-sections/no --gc-section hot and cold cache. I cleared the cache with echo 3 > /proc/sys/vm/drop_caches and warmed it up by running the link once before timing the subsequent ones. With cold cache and --gc-sections the time goes from 1.86130781665 +- 0.01713126697463843 seconds to 1.82370735105 +- 0.014127522318814516 seconds With cold cache and no --gc-sections the time goes from 1.6087245435500002 +- 0.012999066825178644 seconds to 1.5687122041500001 +- 0.013145850126026619 seconds With hot cache and no --gc-sections the time goes from 0.926200939 ( +- 0.33% ) seconds to 0.907200079 ( +- 0.31% ) seconds With hot cache and gc sections the time goes from 1.183038049 ( +- 0.34% ) seconds to 1.147355862 ( +- 0.39% ) seconds llvm-svn: 235165
* Write section and section table entries in the same order.Rafael Espindola2015-04-151-50/+15
| | | | | | We had two different orders, which has no value. llvm-svn: 235004
* Change range-based for-loops to be -Wrange-loop-analysis clean.Richard Trieu2015-04-151-1/+1
| | | | | | No functionality change. llvm-svn: 234963
* Use the ability to pwrite to simplify the ELF writer.Rafael Espindola2015-04-141-44/+31
| | | | | | | | | | | | Now we don't have to do 2 synchronized passes to compute offsets and then write the file. This also includes a fix for the corner case of seeking in /dev/null. It is not an error, but on some systems (Linux) the returned offset is always 0. An error is signaled by returning -1. This is checked by the existing tests now that "clang -o /dev/null ..." seeks. llvm-svn: 234952
* Use raw_pwrite_stream in the object writer/streamer.Rafael Espindola2015-04-147-11/+12
| | | | | | The ELF object writer will take advantage of that in the next commit. llvm-svn: 234950
* Re-enable target-specific relocation table sorting and use it for MipsPetar Jovanovic2015-04-142-31/+24
| | | | | | | | | | | | | | Some targets (ie. Mips) have additional rules for ordering the relocation table entries. Allow them to override generic sortRelocs(), which sorts entries by Offset. Then override this function for Mips, to emit HI16 and GOT16 relocations against the local symbol in pair with the corresponding LO16 relocation. Patch by Vladimir Stefanovic. Differential Revision: http://reviews.llvm.org/D7414 llvm-svn: 234883
* [MC] Write padding into fragments when -mc-relax-all flag is usedPetr Hosek2015-04-123-24/+129
| | | | | | | | | | | | | | | | | | Summary: When instruction bundling is enabled and the -mc-relax-all flag is set, we can write bundle padding directly into fragments and avoid creating large number of fragments significantly reducing LLVM MC memory usage. Test Plan: Regression test attached Reviewers: eliben Subscribers: jfb, mseaborn Differential Revision: http://reviews.llvm.org/D8072 llvm-svn: 234714
* Use 'override/final' instead of 'virtual' for overridden methodsAlexander Kornienko2015-04-112-2/+2
| | | | | | | | | | | | | | The patch is generated using clang-tidy misc-use-override check. This command was used: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \ -checks='-*,misc-use-override' -header-filter='llvm|clang' \ -j=32 -fix -format http://reviews.llvm.org/D8925 llvm-svn: 234679
* Simplify use of formatted_raw_ostream.Rafael Espindola2015-04-091-8/+10
| | | | | | | | | | | | | | | formatted_raw_ostream is a wrapper over another stream to add column and line number tracking. It is used only for asm printing. This patch moves the its creation down to where we know we are printing assembly. This has the following advantages: * Simpler lifetime management: std::unique_ptr * We don't compute column and line number of object files :-) llvm-svn: 234535
* Define a function with "... llvm::func...".Rafael Espindola2015-04-091-6/+5
| | | | | | | | | | | | Using this instead of namespace llvm { func... } Has the advantage that the build fails with a compiler error if it gets out of sync with the .h file. llvm-svn: 234515
* Nothing inherits from the asm streamer.Rafael Espindola2015-04-091-3/+1
| | | | | | Make that explicit and remove protected: llvm-svn: 234484
* Remove unused variable.Rafael Espindola2015-04-081-2/+0
| | | | llvm-svn: 234426
* Write the section header in the end.Rafael Espindola2015-04-081-27/+4
| | | | | | | | One could make the argument for writing it immediately after the ELF header, but writing it in the middle of the sections like we were doing just makes it harder for no reason. llvm-svn: 234400
* ELFObjectWriter.cpp: Prune obsolete \param since r234342. [-Wdocumentation]NAKAMURA Takumi2015-04-081-1/+0
| | | | llvm-svn: 234377
* Delete commented code. Don't repeat name in comment.Rafael Espindola2015-04-071-7/+1
| | | | llvm-svn: 234370
* Don't subtract the header size just to add it back.Rafael Espindola2015-04-071-5/+4
| | | | llvm-svn: 234362
* Remove dead code. NFC.Rafael Espindola2015-04-071-6/+0
| | | | llvm-svn: 234352
* Remove intermediate variables.Rafael Espindola2015-04-071-7/+1
| | | | | | | The name of these variables was completely out of date with the information stored in them. llvm-svn: 234345
OpenPOWER on IntegriCloud