summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC
Commit message (Collapse)AuthorAgeFilesLines
* Remove a variable from r206192 that is only used in an assert.Kaelyn Takata2014-04-141-2/+2
| | | | llvm-svn: 206195
* Fix up MCFixup::getAccessVariant to handle unary expressions.Kaelyn Takata2014-04-141-1/+6
| | | | | | | | | | | | This allows correct relocations to be generated for a symbolic address that is being adjusted by a negative constant. Since r204294, such expressions have triggered undefined behavior when LLVM was built without assertions. Credit goes to Rafael for this patch; I'm submitting it on his behalf as he is on vacation this week. llvm-svn: 206192
* MC: check machine magic when applying offset adjustmentsSaleem Abdulrasool2014-04-131-2/+4
| | | | | | | | | | | | | | | The values for the relocation type can (and do) overlap across various architectures. When performing an adjustment of the emitted relocation in the final object file, check that the file magic matches the target for which the relocation type is valid (e.g. a I386 relocation is only applied to an X86 object file, and an AMD64 relocation is only applied to an X86_64 object file). This was noticed while adding support for ARM WinCOFF object file emission. A test case for this is not really possible as the values for REL32 do not overlap on I386 and AMD64, which is why this was never noticed in practice. The ARM WinCOFF emission is not yet ready to merge into the tree. llvm-svn: 206138
* [C++11] More 'nullptr' conversion or in some cases just using a boolean ↵Craig Topper2014-04-1327-131/+135
| | | | | | check instead of comparing to nullptr. llvm-svn: 206129
* Retire llvm::array_endof in favor of non-member std::end.Benjamin Kramer2014-04-121-0/+1
| | | | | | While there make array_lengthof constexpr if we have support for it. llvm-svn: 206112
* Pull out a named variable for the cached section names to aid readability.David Blaikie2014-04-111-6/+8
| | | | | | Based on a code review suggestion from Eric Christopher in r205990 llvm-svn: 206080
* Format fixes for r205990David Blaikie2014-04-111-5/+12
| | | | llvm-svn: 206078
* Remove redundant symbolization support from MCDisassembler interface.Lang Hames2014-04-112-16/+1
| | | | | | | | | | | | | | | | | MCDisassembler has an MCSymbolizer member that is meant to take care of symbolizing during disassembly, but it also has several methods that enable the disassembler to do symbolization internally (i.e. without an attached symbolizer object). There is no need for this duplication, but ARM64 had been making use of it. This patch moves the ARM64 symbolization logic out of ARM64Disassembler and into an ARM64ExternalSymbolizer class, and removes the duplicated MCSymbolizer functionality from the MCDisassembler interface. Symbolization will now be done exclusively through MCSymbolizers. There should be no impact on disassembly for any platform, but this allows us to tidy up the MCDisassembler interface and simplify the process of (and invariants related to) disassembler setup. llvm-svn: 206063
* Don't lose the thumb bit by using relocations with sections.Rafael Espindola2014-04-111-0/+7
| | | | | | This fixes a regression from r205076. llvm-svn: 206047
* Use value types instead of 'new'd objects to store dwarf labels for asm filesDavid Blaikie2014-04-111-22/+9
| | | | llvm-svn: 206009
* Remove lazy-initialization of section caches in MCContextDavid Blaikie2014-04-101-52/+18
| | | | | | | | This seems to have been a cargo-culted habit from the very first such cache which didn't have any specific justification (but might've been a layering constraint at the time). llvm-svn: 206003
* Reimplement debug info compression by compressing the whole section, rather ↵David Blaikie2014-04-102-0/+129
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | than a fragment. To support compressing the debug_line section that contains multiple fragments (due, I believe, to variation in choices of line table encoding depending on the size of instruction ranges in the actual program code) we needed to support compressing multiple MCFragments in a single pass. This patch implements that behavior by mutating the post-relaxed and relocated section to be the compressed form of its former self, including renaming the section. This is a more flexible (and less invasive, to a degree) implementation that will allow for other features such as "use compression only if it's smaller than the uncompressed data". Compressing debug_frame would be a possible further extension to this work, but I've left it for now. The hurdle there is alignment sections - which might require going as far as to refactor MCAssembler.cpp:writeFragment to handle writing to a byte buffer or an MCObjectWriter (there's already a virtual call there, so it shouldn't add substantial compile-time cost) which could in turn involve refactoring MCAsmBackend::writeNopData to use that same abstraction... which involves touching all the backends. This would remove the limited handling of fragment writing seen in ELFObjectWriter.cpp:getUncompressedData which would be nice - but it's more invasive. I did discover that I (perhaps obviously) don't need to handle relocations when I rewrite the fragments - since the relocations have already been applied and computed (and stored into ELFObjectWriter::Relocations) by this stage (necessarily, because we need to have written any immediate values or assembly-time relocations into the data already before we compress it, which we have). The test case doesn't necessarily cover that in detail - I can add more test coverage if that's preferred. llvm-svn: 205990
* Revert debug info compression support.David Blaikie2014-04-103-58/+1
| | | | | | | | | | To support compression for debug_line and debug_frame a different approach is required. To simplify review, revert the old implementation and XFAIL the test case. New implementation to follow shortly. Reverts r205059 and r204958. llvm-svn: 205989
* YAMLIO: Allow scalars to dictate quotation rulesDavid Majnemer2014-04-101-0/+2
| | | | | | | Introduce ScalarTraits::mustQuote which determines whether or not a StringRef needs quoting before it is acceptable to output. llvm-svn: 205955
* WinCOFF: Emit common symbols as specified in the COFF specDavid Majnemer2014-04-083-29/+35
| | | | | | | | | | | | | | | | | | Summary: Local common symbols were properly inserted into the .bss section. However, putting external common symbols in the .bss section would give them a strong definition. Instead, encode them as undefined, external symbols who's symbol value is equivalent to their size. Reviewers: Bigcheese, rafael, rnk CC: llvm-commits Differential Revision: http://reviews.llvm.org/D3324 llvm-svn: 205811
* Simplify compression API by compressing into a SmallVector rather than a ↵David Blaikie2014-04-051-10/+10
| | | | | | | | MemoryBuffer This is the other half of r205676. llvm-svn: 205677
* Implement getRelocationAddress for MachO and ET_REL elf files.Rafael Espindola2014-04-031-32/+4
| | | | | | With that, fix the symbolizer to work with any ELF file. llvm-svn: 205588
* Work around gold bug http://sourceware.org/PR16794.Rafael Espindola2014-04-021-0/+5
| | | | llvm-svn: 205416
* [ARM64][CollectLOH] Add some comments to explain how the LOHsQuentin Colombet2014-04-021-0/+8
| | | | | | | framework works (for the compiler part), since the design document is not available. llvm-svn: 205379
* DebugInfo: Avoid creating unnecessary/empty line tables and remove the ↵David Blaikie2014-04-013-6/+20
| | | | | | | | | | | | special case of '0' in DwarfCompileUnit::initStmtList by just always using a label difference This moves one case of raw text checking down into the MCStreamer interfaces in the form of a virtual function, even if we ultimately end up consolidating on the one-or-many line tables issue one day, this is nicer in the interim. This just generally streamlines a bunch of use cases into a common code path. llvm-svn: 205287
* DebugInfo: Emit relocation to debug_line section when emitting asm for asmDavid Blaikie2014-04-014-32/+44
| | | | | | | | | | | | | | I don't think this is reachable by any frontend (why would you transform asm to asm+debug info?) but it helps tidy up some of this code, avoid the weird special case of "emit the first CU, store the label, then emit the rest" in MCDwarfLineTable::Emit by instead having the DWARF-for-assembly case use the same codepath as DwarfDebug.cpp, by registering the label of the debug_line section, thus causing it to be emitted. (with a special case in asm output to just emit the label since asm output uses the .loc directives, etc, rather than the debug_loc directly) llvm-svn: 205286
* [MC] Remove an unused (and broken) variant of the setupForSymbolicDisassemblyLang Hames2014-03-301-8/+0
| | | | | | method in MCDisassembler. llvm-svn: 205123
* Detemplatize LOHDirective.Benjamin Kramer2014-03-291-3/+0
| | | | | | | | | | | The ARM64 backend uses it only as a container to keep an MCLOHType and Arguments around so give it its own little copy. The other functionality isn't used and we had a crazy method specialization hack in place to keep it working. Unfortunately that was incompatible with MSVC. Also range-ify a couple of loops while at it. llvm-svn: 205114
* ARM64: initial backend importTim Northover2014-03-292-1/+26
| | | | | | | | | | | | This adds a second implementation of the AArch64 architecture to LLVM, accessible in parallel via the "arm64" triple. The plan over the coming weeks & months is to merge the two into a single backend, during which time thorough code review should naturally occur. Everything will be easier with the target in-tree though, hence this commit. llvm-svn: 205090
* MC-exceptions: add support for compact-unwind without .eh_frameTim Northover2014-03-292-3/+22
| | | | | | | | | | | | ARM64 has compact-unwind information, but doesn't necessarily want to emit .eh_frame directives as well. This teaches MC about such a situation so that it will skip .eh_frame info when compact unwind has been successfully produced. For functions incompatible with compact unwind, the normal information is still written. llvm-svn: 205087
* MC: add a RefKind field to MCValueTim Northover2014-03-291-0/+5
| | | | | | | | This is principally to allow neater mapping of fixups to relocations in ARM64 ELF. Without this, there isn't enough information available to GetRelocType, leading to many more fixup_arm64_... enumerators. llvm-svn: 205085
* MachO: Add linker-optimisation hint framework to MC.Tim Northover2014-03-296-2/+86
| | | | | | | | Another part of the ARM64 backend (so tests will be following soon). This is currently used by the linker to relax adrp/ldr pairs into nops where possible, though could well be more broadly applicable. llvm-svn: 205084
* MachO: actually set linker-private prefix at MC level.Tim Northover2014-03-291-0/+1
| | | | | | This was accidentally omitted from r205081. llvm-svn: 205083
* MachO: allow each section to have a linker-private symbolTim Northover2014-03-293-4/+41
| | | | | | | | | The upcoming ARM64 backend doesn't have section-relative relocations, so we give each section its own symbol to provide this functionality. Of course, it doesn't need to appear in the final executable, so linker-private is the best kind for this purpose. llvm-svn: 205081
* Completely rewrite ELFObjectWriter::RecordRelocation.Rafael Espindola2014-03-295-203/+244
| | | | | | | | | | | | | | | | | | | I started trying to fix a small issue, but this code has seen a small fix too many. The old code was fairly convoluted. Some of the issues it had: * It failed to check if a symbol difference was in the some section when converting a relocation to pcrel. * It failed to check if the relocation was already pcrel. * The pcrel value computation was wrong in some cases (relocation-pc.s) * It was missing quiet a few cases where it should not convert symbol relocations to section relocations, leaving the backends to patch it up. * It would not propagate the fact that it had changed a relocation to pcrel, requiring a quiet nasty work around in ARM. * It was missing comments. llvm-svn: 205076
* Debug Compression: Avoid compression debug_frame for nowDavid Blaikie2014-03-281-1/+1
| | | | | | | | Turns out debug_frame does use multiple fragments, so it doesn't compress correctly with the current approach. Disable compressing it for now while I figure out what's the best solution for it. llvm-svn: 205059
* Map ELf flags back to more specific section kinds.Rafael Espindola2014-03-281-2/+28
| | | | | | With that, convert another llc -filetype=obj test. llvm-svn: 205031
* Canonicalise Windows target triple spellingsSaleem Abdulrasool2014-03-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Construct a uniform Windows target triple nomenclature which is congruent to the Linux counterpart. The old triples are normalised to the new canonical form. This cleans up the long-standing issue of odd naming for various Windows environments. There are four different environments on Windows: MSVC: The MS ABI, MSVCRT environment as defined by Microsoft GNU: The MinGW32/MinGW32-W64 environment which uses MSVCRT and auxiliary libraries Itanium: The MSVCRT environment + libc++ built with Itanium ABI Cygnus: The Cygwin environment which uses custom libraries for everything The following spellings are now written as: i686-pc-win32 => i686-pc-windows-msvc i686-pc-mingw32 => i686-pc-windows-gnu i686-pc-cygwin => i686-pc-windows-cygnus This should be sufficiently flexible to allow us to target other windows environments in the future as necessary. llvm-svn: 204977
* Remove another unused argument.Rafael Espindola2014-03-271-6/+3
| | | | llvm-svn: 204961
* DebugInfo: Support for compressed debug info sectionsDavid Blaikie2014-03-274-8/+67
| | | | | | | | | | | | | | | | | | | 1) When creating a .debug_* section and instead create a .zdebug_ section. 2) When creating a fragment in a .zdebug_* section, make it a compressed fragment. 3) When computing the size of a compressed section, compress the data and use the size of the compressed data. 4) Emit the compressed bytes. Also, check that only if a section has a compressed fragment, then that is the only fragment in the section. Assert-fail if the fragment's data is modified after it is compressed. Initial review on llvm-commits by Eric Christopher and Rafael Espindola. llvm-svn: 204958
* Remove unused argument.Rafael Espindola2014-03-271-1/+1
| | | | llvm-svn: 204956
* Move MCSymbolizer's constructor into header. It's trivial - there's no need forLang Hames2014-03-271-5/+0
| | | | | | it to be out-of-line. llvm-svn: 204892
* Update MCSymbolizer and its subclasses' constructors to reflect the fact thatLang Hames2014-03-274-17/+19
| | | | | | they take ownership of the RelocationInfo they're constructed with. llvm-svn: 204891
* Remove forward declaration for Target class - Target is already defined here.Lang Hames2014-03-271-3/+0
| | | | | | No functional change. llvm-svn: 204885
* Correctly propagates st_size.Rafael Espindola2014-03-271-7/+6
| | | | | | This also finally removes a bogus call to AliasedSymbol. llvm-svn: 204883
* AArch64_BE Elf support for MC-JIT runtime dynamic linkerChristian Pirker2014-03-261-1/+2
| | | | llvm-svn: 204816
* DebugInfo: Add fission-related sections to COFFDavid Blaikie2014-03-261-0/+27
| | | | | | | Allows this test to pass on COFF platforms so we don't need to restrict this test to a single target anymore. llvm-svn: 204780
* Correctly detect if a symbol uses a reserved section index or not.Rafael Espindola2014-03-261-3/+5
| | | | | | | The logic was incorrect for variables, causing them to end up in the wrong section if the section had an index >= 0xff00. llvm-svn: 204771
* Create .symtab_shndxr only when needed.Rafael Espindola2014-03-251-86/+120
| | | | | | | | | | | | | | | | | | | | | | | We need .symtab_shndxr if and only if a symbol references a section with an index >= 0xff00. The old code was trying to figure out if the section was needed ahead of time, making it a fairly dependent on the code actually writing the table. It was also somewhat conservative and would create the section in cases where it was not needed. If I remember correctly, the old structure was there so that the sections were created in the same order gas creates them. That was valuable when MC's support for ELF was new and we tested with elf-dump.py. This patch refactors the symbol table creation to another class and makes it obvious that .symtab_shndxr is really only created when we are about to output a reference to a section index >= 0xff00. While here, also improve the tests to use macros. One file is one section short of needing .symtab_shndxr, the second one has just the right number. llvm-svn: 204769
* Use Endian.h to simplify this code a bit.Rafael Espindola2014-03-251-104/+64
| | | | | | | While at it, factor some logic into FragmentWriter. This will allow more code to be factored out of the fairly large ELFObjectWriter. llvm-svn: 204765
* Propagate section from base to derived symbol.Rafael Espindola2014-03-241-18/+19
| | | | | | | | | | | | We were already propagating the section in a = b With this patch we also propagate it for a = b + 1 llvm-svn: 204581
* remove a bunch of unused private methodsNuno Lopes2014-03-231-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | found with a smarter version of -Wunused-member-function that I'm playwing with. Appologies in advance if I removed someone's WIP code. include/llvm/CodeGen/MachineSSAUpdater.h | 1 include/llvm/IR/DebugInfo.h | 3 lib/CodeGen/MachineSSAUpdater.cpp | 10 -- lib/CodeGen/PostRASchedulerList.cpp | 1 lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 10 -- lib/IR/DebugInfo.cpp | 12 -- lib/MC/MCAsmStreamer.cpp | 2 lib/Support/YAMLParser.cpp | 39 --------- lib/TableGen/TGParser.cpp | 16 --- lib/TableGen/TGParser.h | 1 lib/Target/AArch64/AArch64TargetTransformInfo.cpp | 9 -- lib/Target/ARM/ARMCodeEmitter.cpp | 12 -- lib/Target/ARM/ARMFastISel.cpp | 84 -------------------- lib/Target/Mips/MipsCodeEmitter.cpp | 11 -- lib/Target/Mips/MipsConstantIslandPass.cpp | 12 -- lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp | 21 ----- lib/Target/NVPTX/NVPTXISelDAGToDAG.h | 2 lib/Target/PowerPC/PPCFastISel.cpp | 1 lib/Transforms/Instrumentation/AddressSanitizer.cpp | 2 lib/Transforms/Instrumentation/BoundsChecking.cpp | 2 lib/Transforms/Instrumentation/MemorySanitizer.cpp | 1 lib/Transforms/Scalar/LoopIdiomRecognize.cpp | 8 - lib/Transforms/Scalar/SCCP.cpp | 1 utils/TableGen/CodeEmitterGen.cpp | 2 24 files changed, 2 insertions(+), 261 deletions(-) llvm-svn: 204560
* Propagate types from symbol to aliases.Rafael Espindola2014-03-231-1/+22
| | | | | | | | | | | | | | | | | | | | | | | This is similar, but not identical to what gas does. The logic in MC is to just compute the symbol table after parsing the entire file. GAS is mixed, given .type b, @object a = b b: .type b, @function It will propagate the change and make 'a' a function. Given .type b, @object b: a = b .type b, @function the type of 'a' is still object. Since we do the computation in the end, we produce a function in both cases. llvm-svn: 204555
* ARM IAS: properly handle function entries in .thumbSaleem Abdulrasool2014-03-221-0/+13
| | | | | | | | | | | | | | | | | | | | When a label is parsed, check if there is type information available for the label. If so, check if the symbol is a function. If the symbol is a function and we are in thumb mode and no explicit thumb_func has been emitted, adjust the symbol data to indicate that the function definition is a thumb function. The application of this inferencing is improved value handling in the object file (the required thumb bit is set on symbols which are thumb functions). It also helps improve compatibility with binutils. The one complication that arises from this handling is the MCAsmStreamer. The default implementation of getOrCreateSymbolData in MCStreamer does not support tracking the symbol data. In order to support the semantics of thumb functions, track symbol data in assembly streamer. Although O(n) in number of labels in the TU, this is already done in various other streamers and as such the memory overhead is not a practical concern in this scenario. llvm-svn: 204544
* Fix the value computation inRafael Espindola2014-03-211-23/+31
| | | | | | | | | | sym_a: sym_d = sym_a + 1 This is the smallest fix I was able to extract from what got reverted in r204203. llvm-svn: 204527
OpenPOWER on IntegriCloud