summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCAssembler.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Fix fixup evaluation when deciding what to relocate with.Rafael Espindola2015-03-251-15/+3
| | | | | | | | | | | | | | The previous logic was to first try without relocations at all and failing that stop on the first defined symbol. That was inefficient and incorrect in the case part of the expression could be simplified and another part could not (see included test). We now stop the evaluation when we get to a variable whose value can change (i.e. is weak). llvm-svn: 233187
* Fix warning on non-assert build.Rafael Espindola2015-03-251-0/+2
| | | | llvm-svn: 233158
* Produce an error instead of asserting on invalid .sleb128/.uleb128.Rafael Espindola2015-03-251-3/+10
| | | | llvm-svn: 233155
* Remove many superfluous SmallString::str() calls.Yaron Keren2015-03-181-3/+3
| | | | | | | | | | | | | | | Now that SmallString is a first-class citizen, most SmallString::str() calls are not required. This patch removes a whole bunch of them, yet there are lots more. There are two use cases where str() is really needed: 1) To use one of StringRef member functions which is not available in SmallString. 2) To convert to std::string, as StringRef implicitly converts while SmallString do not. We may wish to change this, but it may introduce ambiguity. llvm-svn: 232622
* Fix uses of reserved identifiers starting with an underscore followed by an ↵David Blaikie2015-03-161-16/+10
| | | | | | | | | uppercase letter This covers essentially all of llvm's headers and libs. One or two weird cases I wasn't sure were worth/appropriate to fix. llvm-svn: 232394
* Add r224985 back with fixes.Rafael Espindola2015-01-191-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fixes are to note that AArch64 has additional restrictions on when local relocations can be used. In particular, ld64 requires that relocations to cstring/cfstrings use linker visible symbols. Original message: In an assembly expression like bar: .long L0 + 1 the intended semantics is that bar will contain a pointer one byte past L0. In sections that are merged by content (strings, 4 byte constants, etc), a single position in the section doesn't give the linker enough information. For example, it would not be able to tell a relocation must point to the end of a string, since that would look just like the start of the next. The solution used in ELF to use relocation with symbols if there is a non-zero addend. In MachO before this patch we would just keep all symbols in some sections. This would miss some cases (only cstrings on x86_64 were implemented) and was inefficient since most relocations have an addend of 0 and can be represented without the symbol. This patch implements the non-zero addend logic for MachO too. llvm-svn: 226503
* Produce errors when an assignment expression would use a common symbol.Rafael Espindola2015-01-191-1/+11
| | | | | | | | | | | An assignment will produce a symbol with a given section and offset. There is no way to represent something like "1 byte after a common symbol". This matches the behavior of GNU as. Part of PR22217. llvm-svn: 226470
* Revert "Add r224985 back with two fixes."Rafael Espindola2015-01-141-14/+2
| | | | | | This reverts commit r225644 while I debug a regression. llvm-svn: 226022
* [cleanup] Re-sort all the #include lines in LLVM usingChandler Carruth2015-01-141-1/+1
| | | | | | | | | | | utils/sort_includes.py. I clearly haven't done this in a while, so more changed than usual. This even uncovered a missing include from the InstrProf library that I've added. No functionality changed here, just mechanical cleanup of the include order. llvm-svn: 225974
* Add r224985 back with two fixes.Rafael Espindola2015-01-121-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One is that AArch64 has additional restrictions on when local relocations can be used. We have to take those into consideration when deciding to put a L symbol in the symbol table or not. The other is that ld64 requires the relocations to cstring to use linker visible symbols on AArch64. Thanks to Michael Zolotukhin for testing this! Remove doesSectionRequireSymbols. In an assembly expression like bar: .long L0 + 1 the intended semantics is that bar will contain a pointer one byte past L0. In sections that are merged by content (strings, 4 byte constants, etc), a single position in the section doesn't give the linker enough information. For example, it would not be able to tell a relocation must point to the end of a string, since that would look just like the start of the next. The solution used in ELF to use relocation with symbols if there is a non-zero addend. In MachO before this patch we would just keep all symbols in some sections. This would miss some cases (only cstrings on x86_64 were implemented) and was inefficient since most relocations have an addend of 0 and can be represented without the symbol. This patch implements the non-zero addend logic for MachO too. llvm-svn: 225644
* Recommit r224935 with a fix for the ObjC++/AArch64 bug that that revisionLang Hames2015-01-091-2/+3
| | | | | | | | | | introduced. A test case for the bug was already committed in r225385. Patch by Rafael Espindola. llvm-svn: 225534
* Revert r224935 "Refactor duplicated code. No intended functionality change."Lang Hames2015-01-061-3/+2
| | | | | | | | This is affecting the behavior of some ObjC++ / AArch64 test cases on Darwin. Reverting to get the bots green while I track down the source of the changed behavior. llvm-svn: 225311
* Revert r225048: It broke ObjC on AArch64.Lang Hames2015-01-061-14/+2
| | | | | | I've filed http://llvm.org/PR22100 to track this issue. llvm-svn: 225228
* Add r224985 back with a fix.Rafael Espindola2014-12-311-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The issues was that AArch64 has additional restrictions on when local relocations can be used. We have to take those into consideration when deciding to put a L symbol in the symbol table or not. Original message: Remove doesSectionRequireSymbols. In an assembly expression like bar: .long L0 + 1 the intended semantics is that bar will contain a pointer one byte past L0. In sections that are merged by content (strings, 4 byte constants, etc), a single position in the section doesn't give the linker enough information. For example, it would not be able to tell a relocation must point to the end of a string, since that would look just like the start of the next. The solution used in ELF to use relocation with symbols if there is a non-zero addend. In MachO before this patch we would just keep all symbols in some sections. This would miss some cases (only cstrings on x86_64 were implemented) and was inefficient since most relocations have an addend of 0 and can be represented without the symbol. This patch implements the non-zero addend logic for MachO too. llvm-svn: 225048
* Revert "Remove doesSectionRequireSymbols."Rafael Espindola2014-12-311-14/+2
| | | | | | | | This reverts commit r224985. I am investigating why it made an Apple bot unhappy. llvm-svn: 225044
* Remove doesSectionRequireSymbols.Rafael Espindola2014-12-301-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | In an assembly expression like bar: .long L0 + 1 the intended semantics is that bar will contain a pointer one byte past L0. In sections that are merged by content (strings, 4 byte constants, etc), a single position in the section doesn't give the linker enough information. For example, it would not be able to tell a relocation must point to the end of a string, since that would look just like the start of the next. The solution used in ELF to use relocation with symbols if there is a non-zero addend. In MachO before this patch we would just keep all symbols in some sections. This would miss some cases (only cstrings on x86_64 were implemented) and was inefficient since most relocations have an addend of 0 and can be represented without the symbol. This patch implements the non-zero addend logic for MachO too. llvm-svn: 224985
* Refactor duplicated code.Rafael Espindola2014-12-291-2/+3
| | | | | | No intended functionality change. llvm-svn: 224935
* [MC] Make bundle alignment mode setting idempotent and support nested bundlesDerek Schuff2014-10-151-1/+22
| | | | | | | | | | | | | | | | | | | | | | 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-4/+3
| | | | llvm-svn: 219799
* MC: Bit pack MCSymbolData.Benjamin Kramer2014-10-111-7/+6
| | | | | | | | | On x86_64 this brings it from 80 bytes to 64 bytes. Also make any member variables private and clean up uses to go through the existing accessors. NFC. llvm-svn: 219573
* Add and update reset() and doInitialization() methods to MC* and passes.Yaron Keren2014-09-171-0/+5
| | | | | | This enables reusing a PassManager instead of re-constructing it every time. llvm-svn: 217948
* Add a helper to MCExpr for when an expression is know to be absolute.Rafael Espindola2014-08-151-12/+3
| | | | llvm-svn: 215713
* If available, pass down the Fixup object to EvaluateAsRelocatable.Joerg Sonnenberger2014-08-101-6/+7
| | | | | | | At least on PowerPC, the interpretation of certain modifiers depends on the context they appear in. llvm-svn: 215310
* MC: make MCSymbolData::dump work on const objectsDavid Majnemer2014-07-051-1/+1
| | | | | | | This just lets us dump a const MCSymbolData object, no functionality changed. llvm-svn: 212365
* Avoid revocations when possible.Rafael Espindola2014-07-011-1/+16
| | | | | | | | This is a small targeted fix for pr20119. The code needs quiet a bit of refactoring and I added some FIXMEs about it, but I want to get the testcase passing first. llvm-svn: 212101
* Report error for non-zero data in .bssWeiming Zhao2014-06-221-2/+8
| | | | | | | | | | | | User may initialize a var with non-zero value and specify .bss section. E.g. : int a __attribute__((section(".bss"))) = 2; This patch converts an assertion to error report for better user experience. Differential Revision: http://reviews.llvm.org/D4199 llvm-svn: 211455
* Move getBaseSymbol somewhere the COFF writer can use.Rafael Espindola2014-05-011-0/+22
| | | | | | I will use it there in a second. llvm-svn: 207761
OpenPOWER on IntegriCloud