summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert r250349.Akira Hatanaka2015-10-152-53/+13
| | | | | | Test case coal-sections-powerpc.s is still failing on some buildbots. llvm-svn: 250351
* [MachO] Stop generating *coal* sections.Akira Hatanaka2015-10-142-13/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Recommit r250342: add -arch=ppc32 to the RUN lines of powerpc tests. Some background on why we don't have to use *coal* sections anymore: Long ago when C++ was new and "weak" had not been standardized, an attempt was made in cctools to support C++ inlines that can be coalesced by putting them into their own section (TEXT/textcoal_nt instead of TEXT/text). The current macho linker supports the weak-def bit on any symbol to allow it to be coalesced, but the compiler still puts weak-def functions/data into alternate section names, which the linker must map back to the base section name. This patch makes changes that are necessary to prevent the compiler from using the "coal" sections and have it use the non-coal sections instead when the target architecture is not powerpc: TEXT/textcoal_nt instead use TEXT/text TEXT/const_coal instead use TEXT/const DATA/datacoal_nt instead use DATA/data If the target is powerpc, we continue to use the *coal* sections since anyone targeting powerpc is probably using an old linker that doesn't have support for the weak-def bits. Also, have the assembler issue a warning if it encounters a *coal* section in the assembly file and inform the users to use the non-coal sections instead. rdar://problem/14265330 Differential Revision: http://reviews.llvm.org/D13188 llvm-svn: 250349
* Revert r250342.Akira Hatanaka2015-10-142-53/+13
| | | | | | Investigate why coal-sections-powerpc.s is failing on some buildbots. llvm-svn: 250346
* [MachO] Stop generating *coal* sections.Akira Hatanaka2015-10-142-13/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some background on why we don't have to use *coal* sections anymore: Long ago when C++ was new and "weak" had not been standardized, an attempt was made in cctools to support C++ inlines that can be coalesced by putting them into their own section (TEXT/textcoal_nt instead of TEXT/text). The current macho linker supports the weak-def bit on any symbol to allow it to be coalesced, but the compiler still puts weak-def functions/data into alternate section names, which the linker must map back to the base section name. This patch makes changes that are necessary to prevent the compiler from using the "coal" sections and have it use the non-coal sections instead when the target architecture is not powerpc: TEXT/textcoal_nt instead use TEXT/text TEXT/const_coal instead use TEXT/const DATA/datacoal_nt instead use DATA/data If the target is powerpc, we continue to use the *coal* sections since anyone targeting powerpc is probably using an old linker that doesn't have support for the weak-def bits. Also, have the assembler issue a warning if it encounters a *coal* section in the assembly file and inform the users to use the non-coal sections instead. rdar://problem/14265330 Differential Revision: http://reviews.llvm.org/D13188 llvm-svn: 250342
* Use range-based for loops. NFCCraig Topper2015-10-141-9/+7
| | | | llvm-svn: 250266
* Change isUIntN/isIntN calls with constant N to use the template version. NFCCraig Topper2015-10-101-1/+1
| | | | llvm-svn: 249952
* Use range-based for loops. NFCCraig Topper2015-10-101-17/+10
| | | | llvm-svn: 249943
* Use emplace_back instead of a constructor call and push_back. NFCCraig Topper2015-10-101-7/+6
| | | | llvm-svn: 249940
* MC: Remove implicit ilist iterator conversions, NFCDuncan P. N. Exon Smith2015-10-104-4/+4
| | | | llvm-svn: 249922
* Clear SectionSymbols in MCContext::ResetKeno Fischer2015-10-091-0/+1
| | | | | | | | | | | | | This was just forgotten when SectionSymbols was introduced and could cause corruption if the MCContext was reused after Reset. Reviewers: rafael Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D13547 llvm-svn: 249854
* MC: Stop using Fragment::getNextNode()Duncan P. N. Exon Smith2015-10-081-7/+7
| | | | | | | | | | | | | Stop using `getNextNode()` to get an iterator to a fragment (at least, in this one place). Instead, use iterator logic directly. The `getNextNode()` interface isn't actually supposed to work for creating iterators; it's supposed to return `nullptr` (not a real iterator) if this is the last node. It's currently broken and will "happen" to work, but if we ever fix the function, we'll get some strange failures in places like this. llvm-svn: 249763
* Use SpecificBumpPtrAllocator to simplify the MCSeciton destruction.Rafael Espindola2015-10-071-14/+11
| | | | llvm-svn: 249589
* [X86] Emit .cfi_escape GNU_ARGS_SIZE when adjusting the stack before callsMichael Kuperstein2015-10-073-0/+42
| | | | | | | | | | | | When outgoing function arguments are passed using push instructions, and EH is enabled, we may need to indicate to the stack unwinder that the stack pointer was adjusted before the call. This should fix the exception handling issues in PR24792. Differential Revision: http://reviews.llvm.org/D13132 llvm-svn: 249522
* Fix Clang-tidy modernize-use-nullptr warnings in source directories and ↵Hans Wennborg2015-10-062-6/+6
| | | | | | | | | | generated files; other minor cleanups. Patch by Eugene Zelenko! Differential Revision: http://reviews.llvm.org/D13321 llvm-svn: 249482
* Fix pr24486.Rafael Espindola2015-10-0513-57/+72
| | | | | | | | | | | | | | | | | | 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
* Move registerSection out of line and reduce #includes. NFC.Rafael Espindola2015-10-031-0/+8
| | | | llvm-svn: 249241
* Use early return. NFC.Rafael Espindola2015-10-031-12/+12
| | | | llvm-svn: 249224
* Disallow assigning symbol a null section.Rafael Espindola2015-10-034-14/+2
| | | | | | | They are constructed without one and they can't go back, so this was effectively dead code. llvm-svn: 249220
* MCAsmInfo: Allow targets to specify when the .section directive should be ↵Tom Stellard2015-09-252-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | omitted Summary: The default behavior is to omit the .section directive for .text, .data, and sometimes .bss, but some targets may want to omit this directive for other sections too. The AMDGPU backend will uses this to emit a simplified syntax for section switches. For example if the section directive is not omitted (current behavior), section switches to .hsatext will be printed like this: .section .hsatext,#alloc,#execinstr,#write This is actually wrong, because .hsatext has some custom STT_* flags, which MC doesn't know how to print or parse. If the section directive is omitted (made possible by this commit), section switches will be printed like this: .hsatext The motivation for this patch is to make it possible to emit sections with custom STT_* flags without having to teach MC about all the target specific STT_* flags. Reviewers: rafael, grosbach Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D12423 llvm-svn: 248618
* Untabify.NAKAMURA Takumi2015-09-222-5/+5
| | | | llvm-svn: 248264
* Reformat blank lines.NAKAMURA Takumi2015-09-222-3/+1
| | | | llvm-svn: 248263
* Use makeArrayRef or None to avoid unnecessarily mentioning the ArrayRef type ↵Craig Topper2015-09-211-2/+2
| | | | | | extra times. NFC llvm-svn: 248140
* Cleanup places that passed SMLoc by const reference to pass it by value ↵Craig Topper2015-09-205-13/+11
| | | | | | instead. NFC llvm-svn: 248135
* Add assembler fatal error for undefined assembler labels in COFF writerReid Kleckner2015-09-161-0/+5
| | | | llvm-svn: 247814
* Revert r247692: Replace Triple with a new TargetTuple in MCTargetDesc/* and ↵Daniel Sanders2015-09-154-10/+8
| | | | | | | | related. NFC. Eric has replied and has demanded the patch be reverted. llvm-svn: 247702
* Re-commit r247683: Replace Triple with a new TargetTuple in MCTargetDesc/* ↵Daniel Sanders2015-09-154-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | and related. NFC. Summary: This is the first patch in the series to migrate Triple's (which are ambiguous) to TargetTuple's (which aren't). For the moment, TargetTuple simply passes all requests to the Triple object it holds. Once it has replaced Triple, it will start to implement the interface in a more suitable way. This change makes some changes to the public C++ API. In particular, InitMCSubtargetInfo(), createMCRelocationInfo(), and createMCSymbolizer() now take TargetTuples instead of Triples. The other public C++ API's have been left as-is for the moment to reduce patch size. This commit also contains a trivial patch to clang to account for the C++ API change. Thanks go to Pavel Labath for fixing LLDB for me. Reviewers: rengolin Subscribers: jyknight, dschuff, arsenm, rampitec, danalbert, srhines, javed.absar, dsanders, echristo, emaste, jholewinski, tberghammer, ted, jfb, llvm-commits, rengolin Differential Revision: http://reviews.llvm.org/D10969 llvm-svn: 247692
* Revert r247684 - Replace Triple with a new TargetTuple ...Daniel Sanders2015-09-154-10/+8
| | | | | | LLDB needs to be updated in the same commit. llvm-svn: 247686
* Replace Triple with a new TargetTuple in MCTargetDesc/* and related. NFC.Daniel Sanders2015-09-154-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is the first patch in the series to migrate Triple's (which are ambiguous) to TargetTuple's (which aren't). For the moment, TargetTuple simply passes all requests to the Triple object it holds. Once it has replaced Triple, it will start to implement the interface in a more suitable way. This change makes some changes to the public C++ API. In particular, InitMCSubtargetInfo(), createMCRelocationInfo(), and createMCSymbolizer() now take TargetTuples instead of Triples. The other public C++ API's have been left as-is for the moment to reduce patch size. This commit also contains a trivial patch to clang to account for the C++ API change. Reviewers: rengolin Subscribers: jyknight, dschuff, arsenm, rampitec, danalbert, srhines, javed.absar, dsanders, echristo, emaste, jholewinski, tberghammer, ted, jfb, llvm-commits, rengolin Differential Revision: http://reviews.llvm.org/D10969 llvm-svn: 247683
* [MC] Fix style bugs introduced in r247471. Reported by Rafael Espindola.Davide Italiano2015-09-111-3/+3
| | | | llvm-svn: 247483
* [MC] Don't crash on division by zero.Davide Italiano2015-09-111-1/+11
| | | | | | Differential Revision: http://reviews.llvm.org/D12776 llvm-svn: 247471
* [ADT] Switch a bunch of places in LLVM that were doing single-characterChandler Carruth2015-09-102-3/+3
| | | | | | | splits to actually use the single character split routine which does less work, and in a debug build is *substantially* faster. llvm-svn: 247245
* [MC/ELF] Accept zero for .align directiveDavide Italiano2015-09-081-1/+5
| | | | | | | | | | .align directive refuses alignment 0 -- a comment in the code hints this is done for GNU as compatibility, but it seems GNU as accepts .align 0 (and silently rounds up alignment to 1). Differential Revision: http://reviews.llvm.org/D12682 llvm-svn: 247048
* WinCOFFObjectWriter.cpp: Roll back TimeDateStamp along ENABLE_TIMESTAMPS.NAKAMURA Takumi2015-09-051-0/+5
| | | | | | | We want a deterministic output. GNU AS leaves it zero. FIXME: It may be optional by its user, like llc and clang. llvm-svn: 246905
* [MC] Replace comparison with isUInt<32>.David Majnemer2015-09-041-1/+1
| | | | | | | Casting to unsigned long can cause the time to get truncated to 32-bits, making it appear to be a valid timestamp. Just use isUInt<32> instead. llvm-svn: 246840
* WinCOFFObjectWriter.cpp: Appease a warning in checking std::time_t. ↵NAKAMURA Takumi2015-09-041-1/+1
| | | | | | [-Wsign-compare] llvm-svn: 246839
* Sink COFF.h MC include into .cpp filesReid Kleckner2015-09-033-0/+3
| | | | | | | | This prevents MC clients from getting COFF.h, which conflicts with winnt.h macros. Also a minor IWYU cleanup. Now the only public headers including COFF.h are in Object, and they actually need it. llvm-svn: 246784
* [MC] Generate a timestamp for COFF object filesDavid Majnemer2015-09-011-2/+7
| | | | | | | | | | | The MS incremental linker seems to inspect the timestamp written into the object file to determine whether or not it's contents need to be considered. Failing to set the timestamp to a date newer than the executable will result in the object file not participating in subsequent links. To ameliorate this, write the current time into the object file's TimeDateStamp field. llvm-svn: 246607
* [MC] Remove MCAssembler's copy of OSDavid Majnemer2015-09-012-5/+5
| | | | | | | 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
* [MC] Add support for generating COFF CRCsDavid Majnemer2015-09-011-0/+28
| | | | | | | | | | | | | | | | | | COFF sections are accompanied with an auxiliary symbol which includes a checksum. This checksum used to be filled with just zero but this seems to upset LINK.exe when it is processing a /INCREMENTAL link job. Instead, fill the CheckSum field with the JamCRC of the section contents. This matches MSVC's behavior. This fixes PR19666. N.B. A rather simple implementation of JamCRC is given. It implements a byte-wise calculation using the method given by Sarwate. There are implementations with higher throughput like slice-by-eight and making use of PCLMULQDQ. We can switch to one of those techniques if it turns out to be a significant use of time. llvm-svn: 246590
* [MC] Allow MCObjectWriter's output stream to be swapped outDavid Majnemer2015-09-013-79/+58
| | | | | | | | | | | | | | | | | | There are occasions where it is useful to consider the entirety of the contents of a section. For example, compressed debug info needs the entire section available before it can compress it and write it out. The compressed debug info scenario was previously implemented by mirroring the implementation of writeSectionData in the ELFObjectWriter. Instead, allow the output stream to be swapped on demand. This lets callers redirect the output stream to a more convenient location before it hits the object file. No functionality change is intended. Differential Revision: http://reviews.llvm.org/D12509 llvm-svn: 246554
* [MC/AsmParser] Avoid setting MCSymbol.IsUsed in some casesVedant Kumar2015-08-311-9/+8
| | | | | | | | | | | | | | | | | | | | Avoid marking some MCSymbols as used in MC/AsmParser.cpp when no uses exist. This fixes a bug in parseAssignmentExpression() which inadvertently sets IsUsed, thereby triggering: "invalid re-assignment of non-absolute variable" on otherwise valid code. No other functionality change intended. The original version of this patch touched many calls to MCSymbol accessors. On rafael's advice, I have stripped this patch down a bit. As a follow-up, I intend to find the call sites which intentionally set IsUsed and force them to do so explicitly. Differential Revision: http://reviews.llvm.org/D12347 llvm-svn: 246457
* [MC] Split the layout part of MCAssembler::finish() into its own method. NFC.Frederic Riss2015-08-261-6/+9
| | | | | | | | | | Split a MCAssembler::layout() method out of MCAssembler::finish(). This allows running the MCSections layout separately from the streaming of the output file. This way if a client wants to use MC to generate section contents, but emit something different than the standard relocatable object files it is possible (llvm-dsymutil is such a client). llvm-svn: 246008
* [MC/MachO] Make some MachObjectWriter methods more generic. NFC.Frederic Riss2015-08-261-25/+30
| | | | | | | Hardcode less values in some mach-o header writing routines and pass them as argument. Doing so will allow reusing this code in llvm-dsymutil. llvm-svn: 246007
* Fix symbol value computation when part of the expression is weak.Rafael Espindola2015-08-201-1/+1
| | | | | | | This matches the behaviour of the gnu assembler and is part of fixing pr24486. llvm-svn: 245576
* Extend MCAsmLexer so that it can peek forward several tokensBenjamin Kramer2015-08-171-3/+13
| | | | | | | | | | | | | | | This commit adds a virtual `peekTokens()` function to `MCAsmLexer` which can peek forward an arbitrary number of tokens. It also makes the `peekTok()` method call `peekTokens()` method, but only requesting one token. The idea is to better support targets which more more ambiguous assembly syntaxes. Patch by Dylan McKay! llvm-svn: 245221
* Revert "Centralize the information about which object format we are using."Rafael Espindola2015-08-143-33/+27
| | | | | | | | | | | | | | | | | | | | | This reverts commit r245047. It was failing on the darwin bots. The problem was that when running ./bin/llc -march=msp430 llc gets to if (TheTriple.getTriple().empty()) TheTriple.setTriple(sys::getDefaultTargetTriple()); Which means that we go with an arch of msp430 but a triple of x86_64-apple-darwin14.4.0 which fails badly. That code has to be updated to select a triple based on the value of march, but that is not a trivial fix. llvm-svn: 245062
* Centralize the information about which object format we are using.Rafael Espindola2015-08-143-27/+33
| | | | | | | | | | | Other than some places that were handling unknown as ELF, this should have no change. The test updates are because we were detecting arm-coff or x86_64-win64-coff as ELF targets before. It is not clear if the enum should live on the Triple. At least now it lives in a single location and should be easier to move somewhere else. llvm-svn: 245047
* Remove and forbid raw_svector_ostream::flush() calls.Yaron Keren2015-08-137-18/+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
* Remove raw_svector_ostream::resync and users. It's no-op after r244870.Yaron Keren2015-08-132-6/+0
| | | | llvm-svn: 244888
* Silence a sign mismatch warning; NFC.Aaron Ballman2015-08-101-1/+1
| | | | llvm-svn: 244452
OpenPOWER on IntegriCloud