summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCAssembler.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix spelling, NFC.Yaron Keren2015-07-041-1/+1
| | | | llvm-svn: 241392
* [MC] Align fragments when -mc-relax-all flag is usedPetr Hosek2015-06-271-6/+12
| | | | | | | | | | | | | | | | | | | | | | | Summary: Ensure that fragments are bundle aligned when instruction bundling is enabled and the -mc-relax-all flag is set. This is implicitly assumed by the bundle padding implementation but this assumption does not hold when custom alignment is being used. The change was tested by running PNaCl toolchain trybots with -mc-relax-all flag set. Fixes https://code.google.com/p/nativeclient/issues/detail?id=4063 Test Plan: Regression test attached Reviewers: mseaborn Subscribers: jfb, llvm-commits Differential Revision: http://reviews.llvm.org/D10044 llvm-svn: 240869
* Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC)Alexander Kornienko2015-06-231-2/+2
| | | | | | Apparently, the style needs to be agreed upon first. llvm-svn: 240390
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-191-2/+2
| | | | | | | | | | | | | 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
* Devirtualize and pack MCFragment to reduce memory usage.Pete Cooper2015-06-171-48/+78
| | | | | | | | | | | | | MCFragment didn't really need vtables. The majority of virtual methods were just getters and setters. This removes the vtables and uses dispatch on the kind to do things like delete which needs to get the appropriate class. This reduces memory on the verify use list order test case by about 2MB out of 800MB. Reviewed by Rafael EspĂ­ndola llvm-svn: 239952
* Move IsUsedInReloc from MCSymbolELF to MCSymbol.Rafael Espindola2015-06-171-11/+1
| | | | | | There is a free bit is MCSymbol and MachO needs the same information. llvm-svn: 239933
* MC: Add target hook to control symbol quotingMatt Arsenault2015-06-091-2/+1
| | | | llvm-svn: 239370
* MC: Clean up the naming for MCMachObjectWriter. NFC.Jim Grosbach2015-06-041-1/+1
| | | | | | | | | | | | | | | | | | s/ExecutePostLayoutBinding/executePostLayoutBinding/ s/ComputeSymbolTable/computeSymbolTable/ s/BindIndirectSymbols/bindIndirectSymbols/ s/RecordTLVPRelocation/recordTLVPRelocation/ s/RecordScatteredRelocation/recordScatteredRelocation/ s/WriteLinkerOptionsLoadCommand/writeLinkerOptionsLoadCommand/ s/WriteLinkeditLoadCommand/writeLinkeditLoadCommand/ s/WriteNlist/writeNlist/ s/WriteDysymtabLoadCommand/writeDysymtabLoadCommand/ s/WriteSymtabLoadCommand/writeSymtabLoadCommand/ s/WriteSection/writeSection/ s/WriteSegmentLoadCommand/writeSegmentLoadCommand/ s/WriteHeader/writeHeader/ llvm-svn: 239119
* MC: Clean up naming in MCObjectWriter. NFC.Jim Grosbach2015-06-041-18/+18
| | | | | | | | | | | | | | | | | | | | s/WriteObject/writeObject/ s/RecordRelocation/recordRelocation/ s/IsSymbolRefDifferenceFullyResolved/isSymbolRefDifferenceFullyResolved/ s/Write8/write8/ s/WriteLE16/writeLE16/ s/WriteLE32/writeLE32/ s/WriteLE64/writeLE64/ s/WriteBE16/writeBE16/ s/WriteBE32/writeBE32/ s/WriteBE64/writeBE64/ s/Write16/write16/ s/Write32/write32/ s/Write64/write64/ s/WriteZeroes/writeZeroes/ s/WriteBytes/writeBytes/ llvm-svn: 239108
* The fragment implies the section, don't store both.Rafael Espindola2015-06-011-0/+10
| | | | | | This reduces MCSymbol from 64 to 56 bytes on x86_64. llvm-svn: 238747
* [MC] Allow backends to decide relaxation for unresolved fixups.Colin LeMahieu2015-05-301-5/+3
| | | | | | Differential Revision: http://reviews.llvm.org/D8217 llvm-svn: 238659
* [WinCOFF] Add support for the .safeseh directiveDavid Majnemer2015-05-301-0/+18
| | | | | | | | | .safeseh adds an entry to the .sxdata section to register all the appropriate functions which may handle an exception. This entry is not a relocation to the symbol but instead the symbol table index of the function. llvm-svn: 238641
* MC: Clean up MCExpr naming. NFC.Jim Grosbach2015-05-301-3/+3
| | | | llvm-svn: 238634
* Remove getData.Rafael Espindola2015-05-291-7/+5
| | | | | | This completes the mechanical part of merging MCSymbol and MCSymbolData. llvm-svn: 238617
* Remove the MCSymbolData typedef.Rafael Espindola2015-05-291-1/+1
| | | | | | The getData member function is next. llvm-svn: 238611
* Merge MCSymbol and MCSymbolData.Rafael Espindola2015-05-291-12/+0
| | | | | | | As a transition hack leave MCSymbolData as a typedef of MCSymbol. I will be removing that in a second. llvm-svn: 238609
* Move Flags from MCSymbolData to MCSymbol.Rafael Espindola2015-05-291-1/+0
| | | | llvm-svn: 238598
* Move common symbol related information from MCSectionData to MCSymbol.Rafael Espindola2015-05-291-8/+2
| | | | llvm-svn: 238583
* Remove a trivial forwarding function. NFC.Rafael Espindola2015-05-281-1/+1
| | | | llvm-svn: 238506
* Delete MCSectionData.Rafael Espindola2015-05-271-25/+9
| | | | llvm-svn: 238331
* Move getSubsectionInsertionPoint to MCSection.Rafael Espindola2015-05-271-31/+0
| | | | llvm-svn: 238320
* Remove most uses of MCSectionData from MCAssembler.Rafael Espindola2015-05-261-12/+11
| | | | llvm-svn: 238172
* Stop using MCSectionData in MCAsmLayout.h.Rafael Espindola2015-05-261-23/+22
| | | | llvm-svn: 238170
* Return a MCSection from MCFragment::getParent().Rafael Espindola2015-05-261-5/+5
| | | | | | Another step in merging MCSectionData and MCSection. llvm-svn: 238162
* Store a MCSection in MCFragment.Rafael Espindola2015-05-251-3/+3
| | | | | | Part of the work to merge MCSectionData into MCSection. llvm-svn: 238160
* Turn MCSectionData into a field of MCSection.Rafael Espindola2015-05-251-12/+9
| | | | | | | This also changes MCAssembler to store a vector of MCSections instead of an iplist of MCSectionData. llvm-svn: 238159
* Insert MCSectionData into the section list directly in getOrCreateSectionData.Rafael Espindola2015-05-251-5/+1
| | | | | | | Removing the logic from the constructor will make it easier to merge MCSectionData and MCSection. llvm-svn: 238155
* Move HasInstructions to MCSection.Rafael Espindola2015-05-251-1/+1
| | | | llvm-svn: 238150
* Move bundle info from MCSectionData to MCSection.Rafael Espindola2015-05-251-22/+1
| | | | llvm-svn: 238143
* Move LayoutOrder to MCSection.Rafael Espindola2015-05-251-1/+1
| | | | llvm-svn: 238141
* Stop forwarding getOrdinal and setOrdinal.Rafael Espindola2015-05-251-4/+1
| | | | llvm-svn: 238139
* Move Ordinal from MCSectionData to MCSection. NFC.Rafael Espindola2015-05-251-3/+6
| | | | | | Part of the work to merge MCSectionData and MCSection. llvm-svn: 238137
* MC: Lift MCSymbolData::Index up to MCSymbol::Index, NFCDuncan P. N. Exon Smith2015-05-221-2/+2
| | | | | | | Lift `MCSymbolData::Index` up a level to `MCSymbol`, as preparation for packing it into the bitfield in `MCSymbol`. llvm-svn: 238001
* Stop forwarding (get|set)Aligment from MCSectionData to MCSection.Rafael Espindola2015-05-211-8/+1
| | | | llvm-svn: 237956
* Move alignment from MCSectionData to MCSection.Rafael Espindola2015-05-211-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | This starts merging MCSection and MCSectionData. There are a few issues with the current split between MCSection and MCSectionData. * It optimizes the the not as important case. We want the production of .o files to be really fast, but the split puts the information used for .o emission in a separate data structure. * The ELF/COFF/MachO hierarchy is not represented in MCSectionData, leading to some ad-hoc ways to represent the various flags. * It makes it harder to remember where each item is. The attached patch starts merging the two by moving the alignment from MCSectionData to MCSection. Most of the patch is actually just dropping 'const', since MCSectionData is mutable, but MCSection was not. llvm-svn: 237936
* MC: Simplify MCSymbolData initialization and remove MCSymbol pointerDuncan P. N. Exon Smith2015-05-211-17/+0
| | | | | | | | | | | | | | | | | | | Finally remove the `MCSymbolData::Symbol` pointer. It was still being used to track whether `MCSymbolData` had been initialized, but this is better tracked by the bitfield in `MCSymbol`. The only caller of `MCSymbolData::initialize()` was `MCAssembler`, which (other than `Symbol`) passed in all-0 values. Replace all that indirection with a default constructor. The main point is a cleanup (and there's more cleanup to do), but there are also some small memory savings. I measured ~989 MB down to ~975 MB, cutting a little over 1% off the top of `llc`. (I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`; see r236629 for details.) llvm-svn: 237873
* MC: Add MCSymbolData back to MCAssembler dumpDuncan P. N. Exon Smith2015-05-201-1/+5
| | | | | | | | | r237490 accidentally dropped MCSymbolData from the MCAssembler dump. Add it back underneath the MCSymbol dump. Remove the MCSymbol dump from MCSymbolData, since this would cause an infinite co-recursion, and besides, that back pointer is going away. llvm-svn: 237807
* MC: Update MCAssembler to use MCSymbol, NFCDuncan P. N. Exon Smith2015-05-201-15/+12
| | | | | | Use `MCSymbol` over `MCSymbolData` where both are needed. llvm-svn: 237803
* MC: Use MCSymbol in MCAsmLayout::getSymbolOffset(), NFCDuncan P. N. Exon Smith2015-05-191-12/+9
| | | | | | | Continue to canonicalize on MCSymbol instead of MCSymbolData when both are needed. llvm-svn: 237749
* MC: Clean up method names in MCContext.Jim Grosbach2015-05-181-3/+3
| | | | | | | The naming was a mish-mash of old and new style. Update to be consistent with the new. NFC. llvm-svn: 237594
* MC: Use MCSymbol in MCObject::IsSymbolRefDifferenceFullyResolvedImpl()Duncan P. N. Exon Smith2015-05-161-2/+1
| | | | | | | | Transition one API from `MCSymbolData` to `MCSymbol`. The function needs both, and the backpointer from `MCSymbolData` to `MCSymbol` is going away. llvm-svn: 237498
* MC: Change MCFragment::Atom to an MCSymbol, NFCDuncan P. N. Exon Smith2015-05-161-2/+2
| | | | | | | Change `MCFragment::Atom` from an `MCSymbolData` to an `MCSymbol`, moving in the direction of removing the back-pointer. llvm-svn: 237497
* MC: Merge MCSymbol and MCSymbolDataDuncan P. N. Exon Smith2015-05-161-5/+12
| | | | | | | | | | | | | | | | Turn `MCSymbolData` into a field inside of `MCSymbol`. Keep all the old API alive for now, so that consumers can be updated in a later commit. This means we still temporarily need the back pointer from `MCSymbolData` to `MCSymbol`, but I'll remove it in a follow-up. This optimizes for object emission over assembly emission. By removing the `DenseMap` in `MCAssembler`, llc memory usage drops from around 1040 MB to 1001 MB (3.8%). (I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`; see r236629 for details.) llvm-svn: 237490
* MC: Reduce MCAssembler::Symbols API exposure, NFCDuncan P. N. Exon Smith2015-05-151-5/+2
| | | | | | | | | Stop exposing the storage for `MCAssembler::Symbols`, and have `MCAssembler` add symbols directly to its list instead of using a hook in `MCSymbolData`. This opens up room for a follow-up commit to switch from a linked list to a vector. llvm-svn: 237486
* MC: Update MCCodeEmitter naming. NFC.Jim Grosbach2015-05-151-1/+1
| | | | | | s/EncodeInstruction/encodeInstruction/ llvm-svn: 237469
* Compute A-B when A or B is weak.Rafael Espindola2015-04-171-1/+1
| | | | | | | | | | | | | | | | | | | | 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
* [MC] Write padding into fragments when -mc-relax-all flag is usedPetr Hosek2015-04-121-18/+31
| | | | | | | | | | | | | | | | | | 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
* Remove unnecessary uses of AliasedSymbol.Rafael Espindola2015-04-061-4/+3
| | | | | | | | | As pr19627 points out, every use of AliasedSymbol is likely a bug. The main use was to avoid the oddity of a variable showing up as undefined. That was fixed in r233995, which made these calls nops. llvm-svn: 234169
* Be consistent when deciding if a relocation is needed.Rafael Espindola2015-04-061-3/+2
| | | | | | | | | | | | | | Before when deciding if we needed a relocation in A-B, we wore only checking if A was weak. This fixes the asymmetry. The "InSet" argument should probably be renamed to "ForValue", since InSet is very MachO specific, but doing so in this patch would make it hard to read. This fixes PR22815. llvm-svn: 234165
* Fix PR23025.Rafael Espindola2015-03-261-1/+1
| | | | | | | | | | | | | | | There is something in link.exe that requires a relocation to use a global symbol. Not doing so breaks the chrome build on windows. This patch sets isWeak for that to work. To compensate, we then need to look past those symbols when not creating relocations. This patch includes an ELF test that matches GNU as behaviour. I am still reducing the chrome build issue and will add a test once that is done. llvm-svn: 233318
OpenPOWER on IntegriCloud