summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCObjectStreamer.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [CodeView] Implement .cv_inline_linetableDavid Majnemer2016-01-291-0/+10
| | | | | | | | | | | This support is _very_ rudimentary, just enough to get some basic data into the CodeView debug section. Left to do is: - Use the combined opcodes to save space. - Do something about code offsets. llvm-svn: 259230
* Reland "[CodeView] Use assembler directives for line tables"Reid Kleckner2016-01-291-0/+31
| | | | | | | | 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-31/+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/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Rename MCLineEntry to MCDwarfLineEntryDavid Majnemer2016-01-211-4/+4
| | | | | | | MCLineEntry gives the impression that it is generic MC machinery. However, it is specific to DWARF. llvm-svn: 258381
* [MC, COFF] Add .reloc support for WinCOFFDavid Majnemer2016-01-191-2/+7
| | | | | | | This adds rudimentary support for a few relocations that we will use for the CodeView debug format. llvm-svn: 258216
* Simplify MCFillFragment.Rafael Espindola2016-01-191-2/+2
| | | | | | | | | The value size was always 1 or 0, so we don't need to store it. In a no asserts build this takes the testcase of pr26208 from 11 to 10 seconds. llvm-svn: 258141
* Remove a bugs assert.Rafael Espindola2016-01-111-2/+0
| | | | | | | There is no reason the value being printed has to be positive. Fixes pr25802. llvm-svn: 257412
* Implement .reloc (constant offset only) with support for R_MIPS_NONE and ↵Daniel Sanders2015-11-121-0/+20
| | | | | | | | | | | | | | | | 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
* 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-041-2/+1
| | | | llvm-svn: 252102
* Simplify .org processing and make it a bit more powerful.Rafael Espindola2015-11-041-17/+1
| | | | | | | We now always create the fragment, which lets us handle things like .org after a .align. llvm-svn: 252101
* MC: Remove implicit ilist iterator conversions, NFCDuncan P. N. Exon Smith2015-10-101-1/+1
| | | | llvm-svn: 249922
* Fix pr24486.Rafael Espindola2015-10-051-2/+2
| | | | | | | | | | | | | | | | | | This extends the work done in r233995 so that now getFragment (in addition to getSection) also works for variable symbols. With that the existing logic to decide if a-b can be computed works even if a or b are variables. Given that, the expression evaluation can avoid expanding variables as aggressively and that in turn lets the relocation code see the original variable. In order for this to work with the asm streamer, there is now a dummy fragment per section. It is used to assign a section to a symbol when no other fragment exists. This patch is a joint work by Maxim Ostapenko andy myself. llvm-svn: 249303
* Use early return. NFC.Rafael Espindola2015-10-031-12/+12
| | | | llvm-svn: 249224
* Cleanup places that passed SMLoc by const reference to pass it by value ↵Craig Topper2015-09-201-1/+1
| | | | | | instead. NFC llvm-svn: 248135
* [MC] Remove MCAssembler's copy of OSDavid Majnemer2015-09-011-1/+1
| | | | | | | We can just ask the ObjectWriter for it's stream instead of caching around our own reference to it. No functionality change is intended. llvm-svn: 246604
* Remove and forbid raw_svector_ostream::flush() calls.Yaron Keren2015-08-131-1/+0
| | | | | | | | | | After r244870 flush() will only compare two null pointers and return, doing nothing but wasting run time. The call is not required any more as the stream and its SmallString are always in sync. Thanks to David Blaikie for reviewing. llvm-svn: 244928
* [MC/Dwarf] Allow to specify custom parameters for linetable emission.Frederic Riss2015-08-071-6/+10
| | | | | | | | | NFC patch for current users, but llvm-dsymutil will use the new functionality to adapt to the input linetable. Based on a patch by Adrian Prantl. llvm-svn: 244318
* [MC] Ensure that pending labels are flushed when -mc-relax-all flag is usedPetr Hosek2015-06-271-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | Summary: The current implementation doesn't always flush all pending labels beforeemitting data which can result in an incorrectly placed labels in case when when instruction bundling is enabled and -mc-relax-all flag is being used. To address this issue, we always flush pending labels before emitting data. 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/D10325 llvm-svn: 240870
* Generalize emitAbsoluteSymbolDiff.Rafael Espindola2015-06-111-9/+6
| | | | | | | | | | This makes emitAbsoluteSymbolDiff always succeed and moves logic from the asm printer to it. The object one now also works on ELF. If two symbols are in the same fragment, we will never move them apart. llvm-svn: 239552
* Rename HasData to IsRegistered.Rafael Espindola2015-06-011-4/+0
| | | | | | | | | There is no MCSectionData, so the old name is now meaningless. Also remove some asserts/checks that were there just because the information they used was in MCSectionData. llvm-svn: 238708
* Remove trivial forwarding function.Rafael Espindola2015-06-011-1/+1
| | | | llvm-svn: 238707
* MC: Clean up MCExpr naming. NFC.Jim Grosbach2015-05-301-13/+13
| | | | llvm-svn: 238634
* Remove getData.Rafael Espindola2015-05-291-9/+5
| | | | | | This completes the mechanical part of merging MCSymbol and MCSymbolData. llvm-svn: 238617
* Remove the MCSymbolData typedef.Rafael Espindola2015-05-291-2/+2
| | | | | | The getData member function is next. llvm-svn: 238611
* Rename getOrCreateSymbolData to registerSymbol and return void.Rafael Espindola2015-05-291-3/+4
| | | | | | Another step in merging MCSymbol and MCSymbolData. llvm-svn: 238607
* Move common symbol related information from MCSectionData to MCSymbol.Rafael Espindola2015-05-291-4/+4
| | | | llvm-svn: 238583
* Store MCSymbols in PendingLabels.Rafael Espindola2015-05-291-2/+3
| | | | llvm-svn: 238582
* Remove a trivial forwarding function. NFC.Rafael Espindola2015-05-281-2/+2
| | | | llvm-svn: 238506
* Rename and move getCurrentSectionData.Rafael Espindola2015-05-271-4/+4
| | | | | | I think this concludes the merge of MCSectionData and MCSection. llvm-svn: 238358
* There is only one current section.Rafael Espindola2015-05-271-6/+5
| | | | | | | | | | | | | | | | | Both MCStreamer and MCObjectStreamer were maintaining a current section variable and they were slightly out of sync. I don't think this was observable, but was inefficient and error prone. Changing this requires a few cascading changes: * SwitchSection has to call ChangeSection earlier for ChangeSection to see the old section. * With that change, ChangeSection cannot call EmitLabel, since during ChangeSection we are still in the old section. * When the object streamer requires a begin label, just reused the existing generic support for begin labels instead of calling EmitLabel directly. llvm-svn: 238357
* Delete MCSectionData.Rafael Espindola2015-05-271-1/+1
| | | | llvm-svn: 238331
* Move getSubsectionInsertionPoint to MCSection.Rafael Espindola2015-05-271-2/+1
| | | | llvm-svn: 238320
* Replace getOrCreateSectionData with registerSection.Rafael Espindola2015-05-261-2/+1
| | | | | | There is now no SectionData to be created. llvm-svn: 238208
* Have getCurrentSectionData return a MCSection.Rafael Espindola2015-05-261-6/+8
| | | | | | I will fix the name shortly. llvm-svn: 238204
* Store a MCSection in MCFragment.Rafael Espindola2015-05-251-1/+1
| | | | | | Part of the work to merge MCSectionData into MCSection. llvm-svn: 238160
* Move HasInstructions to MCSection.Rafael Espindola2015-05-251-1/+5
| | | | llvm-svn: 238150
* Move bundle info from MCSectionData to MCSection.Rafael Espindola2015-05-251-1/+1
| | | | llvm-svn: 238143
* Stop forwarding (get|set)Aligment from MCSectionData to MCSection.Rafael Espindola2015-05-211-2/+3
| | | | llvm-svn: 237956
* Move alignment from MCSectionData to MCSection.Rafael Espindola2015-05-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | 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
* AsmPrinter: Compute absolute label difference directlyDuncan P. N. Exon Smith2015-05-211-0/+23
| | | | | | | | | | | | | | | | | | Create a low-overhead path for `EmitLabelDifference()` that emits a emits an absolute number when (1) the output is an object stream and (2) the two symbols are in the same data fragment. This drops memory usage on Mach-O from 975 MB down to 919 MB (5.8%). The only call is when `!doesDwarfUseRelocationsAcrossSections()` -- i.e., on Mach-O -- since otherwise an absolute offset from the start of the section needs a relocation. (`EmitLabelDifference()` is cheaper on ELF anyway, since it creates 1 fewer temp symbol, and it gets called far less often. It's not clear to me if this is even a bottleneck there.) (I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`; see r236629 for details.) llvm-svn: 237876
* 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: Update MCCodeEmitter naming. NFC.Jim Grosbach2015-05-151-1/+1
| | | | | | s/EncodeInstruction/encodeInstruction/ llvm-svn: 237469
* MC: Update MCFixup naming. NFC.Jim Grosbach2015-05-151-3/+3
| | | | | | s/MCFixup::Create/MCFixup::create/ llvm-svn: 237468
* Use raw_pwrite_stream in the object writer/streamer.Rafael Espindola2015-04-141-1/+2
| | | | | | The ELF object writer will take advantage of that in the next commit. llvm-svn: 234950
* [MC] Write padding into fragments when -mc-relax-all flag is usedPetr Hosek2015-04-121-4/+10
| | | | | | | | | | | | | | | | | | 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 dead code. NFC.Rafael Espindola2015-04-071-6/+0
| | | | llvm-svn: 234352
* Don't declare all text sections at the start of the .sRafael Espindola2015-03-201-1/+8
| | | | | | | | | | | | | | | | | The code this patch removes was there to make sure the text sections went before the dwarf sections. That is necessary because MachO uses offsets relative to the start of the file, so adding a section can change relaxations. The dwarf sections were being printed at the start just to produce symbols pointing at the start of those sections. The underlying issue was fixed in r231898. The dwarf sections are now printed when they are about to be used, which is after we printed the text sections. To make sure we don't regress, the patch makes the MachO streamer assert if CodeGen puts anything unexpected after the DWARF sections. llvm-svn: 232842
* Split the object streamer callback in one per file format.Rafael Espindola2015-03-191-13/+0
| | | | | | | | | | | | | There are two main advantages to doing this * Targets that only need to handle one of the formats specially don't have to worry about the others. For example, x86 now only registers a constructor for the COFF streamer. * Changes to the arguments passed to one format constructor will not impact the other formats. llvm-svn: 232699
OpenPOWER on IntegriCloud