summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCELFStreamer.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Remove and forbid raw_svector_ostream::flush() calls.Yaron Keren2015-08-131-2/+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
* Fix some comment typos.Benjamin Kramer2015-08-081-2/+2
| | | | llvm-svn: 244402
* Devirtualize and pack MCFragment to reduce memory usage.Pete Cooper2015-06-171-1/+1
| | | | | | | | | | | | | 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
* [MC] Common symbols weren't being checked for redeclaration which allowed an ↵Colin LeMahieu2015-06-061-1/+3
| | | | | | assembly file to generate an assertion in setCommon(): !isCommon(). This change allows redeclaration as long as the size and alignment match exactly, otherwise report a fatal error. llvm-svn: 239227
* Test commit access.Gabor Ballabas2015-06-041-1/+1
| | | | | | Fix trailing whitespace. llvm-svn: 239058
* Remove MCELFSymbolFlags.h. It is now internal to MCSymbolELF.Rafael Espindola2015-06-041-2/+1
| | | | llvm-svn: 238996
* Convert BindingExplicitlySet into a MCSymbolELF field.Rafael Espindola2015-06-031-6/+1
| | | | | | I will pack it better in a followup patch. llvm-svn: 238975
* Merge MCELF.h into MCSymbolELF.h.Rafael Espindola2015-06-021-35/+30
| | | | | | | Now that we have a dedicated type for ELF symbol, these helper functions can become member function of MCSymbolELF. llvm-svn: 238864
* Create a MCSymbolELF.Rafael Espindola2015-06-021-2/+4
| | | | | | | | | This create a MCSymbolELF class and moves SymbolSize since only ELF needs a size expression. This reduces the size of MCSymbol from 56 to 48 bytes. llvm-svn: 238801
* MC: Clean up MCExpr naming. NFC.Jim Grosbach2015-05-301-2/+2
| | | | llvm-svn: 238634
* Remove getData.Rafael Espindola2015-05-291-10/+7
| | | | | | This completes the mechanical part of merging MCSymbol and MCSymbolData. llvm-svn: 238617
* Remove the MCSymbolData typedef.Rafael Espindola2015-05-291-3/+3
| | | | | | The getData member function is next. llvm-svn: 238611
* Rename getOrCreateSymbolData to registerSymbol and return void.Rafael Espindola2015-05-291-9/+12
| | | | | | Another step in merging MCSymbol and MCSymbolData. llvm-svn: 238607
* Pass MCSymbols to the helper functions in MCELF.h.Rafael Espindola2015-05-291-30/+32
| | | | llvm-svn: 238596
* Move common symbol related information from MCSectionData to MCSymbol.Rafael Espindola2015-05-291-1/+1
| | | | llvm-svn: 238583
* Move SymbolSize from MCSymbolData to MCSymbol.Rafael Espindola2015-05-291-3/+2
| | | | llvm-svn: 238580
* Remove a trivial forwarding function. NFC.Rafael Espindola2015-05-281-1/+1
| | | | llvm-svn: 238506
* Rename and move getCurrentSectionData.Rafael Espindola2015-05-271-7/+7
| | | | | | I think this concludes the merge of MCSectionData and MCSection. llvm-svn: 238358
* There is only one current section.Rafael Espindola2015-05-271-4/+7
| | | | | | | | | | | | | | | | | 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
* Replace getOrCreateSectionData with registerSection.Rafael Espindola2015-05-261-4/+3
| | | | | | There is now no SectionData to be created. llvm-svn: 238208
* Have getCurrentSectionData return a MCSection.Rafael Espindola2015-05-261-14/+7
| | | | | | I will fix the name shortly. llvm-svn: 238204
* Pass a MCSection to getCurrentSectionData.Rafael Espindola2015-05-261-9/+11
| | | | | | A step towards merging MCSection and MCSectionData. llvm-svn: 238203
* Remove most uses of MCSectionData from MCAssembler.Rafael Espindola2015-05-261-1/+1
| | | | llvm-svn: 238172
* Store a MCSection in MCFragment.Rafael Espindola2015-05-251-2/+3
| | | | | | Part of the work to merge MCSectionData into MCSection. llvm-svn: 238160
* Move HasInstructions to MCSection.Rafael Espindola2015-05-251-5/+8
| | | | llvm-svn: 238150
* Move bundle info from MCSectionData to MCSection.Rafael Espindola2015-05-251-11/+14
| | | | llvm-svn: 238143
* Add a isBundleLocked helper to MCELFStreamer.Rafael Espindola2015-05-251-14/+17
| | | | llvm-svn: 238142
* Stop forwarding (get|set)Aligment from MCSectionData to MCSection.Rafael Espindola2015-05-211-6/+5
| | | | llvm-svn: 237956
* Move alignment from MCSectionData to MCSection.Rafael Espindola2015-05-211-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | 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: Use MCSymbol in LocalCommon, NFCDuncan P. N. Exon Smith2015-05-201-4/+3
| | | | | | Switch from MCSymbolData to MCSymbol in LocalCommon. llvm-svn: 237816
* MC: Update MCCodeEmitter naming. NFC.Jim Grosbach2015-05-151-1/+1
| | | | | | s/EncodeInstruction/encodeInstruction/ llvm-svn: 237469
* [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
* Use raw_pwrite_stream in the object writer/streamer.Rafael Espindola2015-04-141-1/+1
| | | | | | 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-2/+88
| | | | | | | | | | | | | | | | | | 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
* Split the object streamer callback in one per file format.Rafael Espindola2015-03-191-0/+1
| | | | | | | | | | | | | 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
* Make constant arrays that are passed to functions as const.Benjamin Kramer2015-03-071-5/+4
| | | | | | | | In theory this allows the compiler to skip materializing the array on the stack. In practice clang often fails to do that, but that's a different story. NFC. llvm-svn: 231571
* Compute the ELF SectionKind from the flags.Rafael Espindola2015-01-291-7/+3
| | | | | | | | | | | | Any code creating an MCSectionELF knows ELF and already provides the flags. SectionKind is an abstraction used by common code that uses a plain MCSection. Use the flags to compute the SectionKind. This removes a lot of guessing and boilerplate from the MCSectionELF construction. llvm-svn: 227476
* Add STB_GNU_UNIQUE to the ELF writer.Rafael Espindola2015-01-231-1/+7
| | | | | | This lets llvm-mc assemble files produced by gcc. llvm-svn: 226895
* Add back commits r219835 and a fixed version of r219829.Rafael Espindola2014-10-171-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The only difference from r219829 is using getOrCreateSectionSymbol(*ELFSec) instead of GetOrCreateSymbol(ELFSec->getSectionName()) in ELFObjectWriter which causes us to use the correct section symbol even if we have multiple sections with the same name. Original messages: r219829: Correctly handle references to section symbols. When processing assembly like .long .text we were creating a new undefined symbol .text. GAS on the other hand would handle that as a reference to the .text section. This patch implements that by creating the section symbols earlier so that they are visible during asm parsing. The patch also updates llvm-readobj to print the symbol number in the relocation dump so that the test can differentiate between two sections with the same name. r219835: Allow forward references to section symbols. llvm-svn: 220021
* Revert commit r219835 and r219829.Rafael Espindola2014-10-171-11/+2
| | | | | | | | | Revert "Correctly handle references to section symbols." Revert "Allow forward references to section symbols." Rui found a regression I am debugging. llvm-svn: 220010
* Correctly handle references to section symbols.Rafael Espindola2014-10-151-2/+11
| | | | | | | | | | | | | | | | | When processing assembly like .long .text we were creating a new undefined symbol .text. GAS on the other hand would handle that as a reference to the .text section. This patch implements that by creating the section symbols earlier so that they are visible during asm parsing. The patch also updates llvm-readobj to print the symbol number in the relocation dump so that the test can differentiate between two sections with the same name. llvm-svn: 219829
* [MC] Make bundle alignment mode setting idempotent and support nested bundlesDerek Schuff2014-10-151-11/+14
| | | | | | | | | | | | | | | | | | | | | | Summary: Currently an error is thrown if bundle alignment mode is set more than once per module (either via the API or the .bundle_align_mode directive). This change allows setting it multiple times as long as the alignment doesn't change. Also nested bundle_lock groups are currently not allowed. This change allows them, with the effect that the group stays open until all nests are exited, and if any of the bundle_lock directives has the align_to_end flag, the group becomes align_to_end. These changes make the bundle aligment simpler to use in the compiler, and also better match the corresponding support in GNU as. Reviewers: jvoung, eliben Differential Revision: http://reviews.llvm.org/D5801 llvm-svn: 219811
* Simplify handling of --noexecstack by using getNonexecutableStackSection.Rafael Espindola2014-10-151-8/+11
| | | | llvm-svn: 219799
* Print a=b as an assignment.Rafael Espindola2014-06-241-4/+0
| | | | | | | | | | | In assembly the expression a=b is parsed as an assignment, so it should be printed as one. This remove a truly horrible hack for producing a label with "a=.". It would be used by codegen but would never be reached by the asm parser. Sorry I missed this when it was first committed. llvm-svn: 211639
* Remove an always true argument.Rafael Espindola2014-05-121-1/+1
| | | | llvm-svn: 208557
* Make getOrCreateSymbolData non virtual.Rafael Espindola2014-04-271-4/+0
| | | | llvm-svn: 207367
* Fix the assembler to print a better relocatable expression errorKevin Enderby2014-04-221-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | diagnostic that includes location information. Currently if one has this assembly: .quad (0x1234 + (4 * SOME_VALUE)) where SOME_VALUE is undefined ones gets the less than useful error message with no location information: % clang -c x.s clang -cc1as: fatal error: error in backend: expected relocatable expression With this fix one now gets a more useful error message with location information: % clang -c x.s x.s:5:8: error: expected relocatable expression .quad (0x1234 + (4 * SOME_VALUE)) ^ To do this I plumbed the SMLoc through the MCObjectStreamer EmitValue() and EmitValueImpl() interfaces so it could be used when creating the MCFixup. rdar://12391022 llvm-svn: 206906
* [C++11] More 'nullptr' conversion or in some cases just using a boolean ↵Craig Topper2014-04-131-1/+1
| | | | | | check instead of comparing to nullptr. llvm-svn: 206129
* Mark alias symbols as microMIPS if necessary. Differential Revision: ↵Zoran Jovanovic2014-03-201-1/+1
| | | | | | http://llvm-reviews.chandlerc.com/D3080 llvm-svn: 204323
* Look through variables when computing relocations.Rafael Espindola2014-03-201-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Given bar = foo + 4 .long bar MC would eat the 4. GNU as includes it in the relocation. The rule seems to be that a variable that defines a symbol is used in the relocation and one that does not define a symbol is evaluated and the result included in the relocation. Fixing this unfortunately required some other changes: * Since the variable is now evaluated, it would prevent the ELF writer from noticing the weakref marker the elf streamer uses. This patch then replaces that with a VariantKind in MCSymbolRefExpr. * Using VariantKind then requires us to look past other VariantKind to see .weakref bar,foo call bar@PLT doing this also fixes zed = foo +2 call zed@PLT so that is a good thing. * Looking past VariantKind means that the relocation selection has to use the fixup instead of the target. This is a reboot of the previous fixes for MC. I will watch the sanitizer buildbot and wait for a build before adding back the previous fixes. llvm-svn: 204294
OpenPOWER on IntegriCloud