summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCAssembler.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Move assert above first use of variable that we'd be asserting on.Eric Christopher2013-08-071-2/+2
| | | | llvm-svn: 187899
* Use MCFillFragment for zero-initialized data.Serge Pavlov2013-06-271-3/+4
| | | | | | | | It fixes PR16338 (ICE when compiling very large two-dimensional array). Differential Revision: http://llvm-reviews.chandlerc.com/D1043 llvm-svn: 185080
* [MC/DWARF] Support .debug_frame / .debug_line code alignment factorsUlrich Weigand2013-06-121-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | I've been comparing the object file output of LLVM's integrated assembler against the external assembler on PowerPC, and one area where differences still remain are in DWARF sections. In particular, the GNU assembler generates .debug_frame and .debug_line sections using a code alignment factor of 4, since all PowerPC instructions have size 4 and must be aligned to a multiple of 4. However, current MC code hard-codes a code alignment factor of 1. This patch changes this by adding a "minimum instruction alignment" data element to MCAsmInfo and using this as code alignment factor. This requires passing a MCContext into MCDwarfLineAddr::Encode and MCDwarfLineAddr::EncodeAdvanceLoc. Note that one caller, MCDwarfLineAddr::Write, didn't actually have that information available. However, it turns out that this routine is in fact never used in the whole code base, so the patch simply removes it. If it turns out to be needed again at a later time, it could be re-added with an updated interface. llvm-svn: 183834
* Add support for subsections to the ELF assembler. Fixes PR8717.Peter Collingbourne2013-04-171-1/+32
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D598 llvm-svn: 179725
* Remove unused method and default values.Rafael Espindola2013-04-091-2/+1
| | | | llvm-svn: 179124
* Fix unnecessary removal of const through cast machineryDavid Blaikie2013-02-111-7/+7
| | | | | | | | I have some uncommitted changes to the cast code that catch this sort of thing at compile-time but I still need to do some other cleanup before I can enable it. llvm-svn: 174853
* [MC] Bundle alignment: Invalidate relaxed fragmentsDerek Schuff2013-02-051-7/+8
| | | | | | | | | | | | | | | | Currently, when a fragment is relaxed, its size is modified, but its offset is not (it gets laid out as a side effect of checking whether it needs relaxation), then all subsequent fragments are invalidated because their offsets need to change. When bundling is enabled, relaxed fragments need to get laid out again, because the increase in size may push it over a bundle boundary. So instead of only invalidating subsequent fragments, also invalidate the fragment that gets relaxed, which causes it to get laid out again. This patch also fixes some trailing whitespace and fixes the bundling-related debug output of MCFragments. llvm-svn: 174401
* [MC] bundle alignment: prevent padding instructions from crossing bundle ↵Derek Schuff2013-01-311-4/+20
| | | | | | boundaries llvm-svn: 174067
* This patch reworks how llvm targets set Jack Carter2013-01-301-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | and update ELF header e_flags. Currently gathering information such as symbol, section and data is done by collecting it in an MCAssembler object. From MCAssembler and MCAsmLayout objects ELFObjectWriter::WriteObject() forms and streams out the ELF object file. This patch just adds a few members to the MCAssember class to store and access the e_flag settings. It allows for runtime additions to the e_flag by assembler directives. The standalone assembler can get to MCAssembler from getParser().getStreamer().getAssembler(). This patch is the generic infrastructure and will be followed by patches for ARM and Mips for their target specific use. Contributer: Jack Carter llvm-svn: 173882
* Optimize the memory usage of MC bundling, by creating a new type of fragmentEli Bendersky2013-01-151-2/+34
| | | | | | | | | | | | | | | | | into which we can emit single instructions without fixups (which is most instructions). This is an optimization required because MCDataFragment is prety large (240 bytes on x64), with no change in functionality. For large programs, this reduces memory usage overhead required for bundling by 40%. To make the code as palatable as possible, the MCEncodedFragment interface was further fragmented (no pun intended) and MCEncodedFragmentWithFixups is used as the interface to work against when the user expects fixups. MCDataFragment and MCRelaxableFragment implement this interface, while the new MCCompactEncodedInstFragment implements MCEncodeFragment. llvm-svn: 172572
* Simplify the code a bit: MCRelaxableFragment doesn't need a separate getInstSizeEli Bendersky2013-01-081-3/+2
| | | | | | | | | | method because getContents().size() already covers it. So computeFragmentSize can use the generic MCEncodedFragment interface when querying both Data and Relaxable fragments for contents sizes. No change in functionality llvm-svn: 171903
* Rename statistic for instruction fragments -> relaxableEli Bendersky2013-01-081-3/+3
| | | | llvm-svn: 171872
* Renamed MCInstFragment to MCRelaxableFragment and added some comments.Eli Bendersky2013-01-081-24/+24
| | | | | | No change in functionality. llvm-svn: 171822
* Add the align_to_end option to .bundle_lock in the MC implementation of alignedEli Bendersky2013-01-071-5/+29
| | | | | | | | | bundling. The document describing this feature and the implementation has also been updated: https://sites.google.com/a/chromium.org/dev/nativeclient/pnacl/aligned-bundling-support-in-llvm llvm-svn: 171797
* Fix an unitialized member variable that may have caused sporadic failuresEli Bendersky2012-12-201-1/+2
| | | | | | for code that wasn't even in bundling mode. llvm-svn: 170793
* Aligned bundling support. Following the discussion here:Eli Bendersky2012-12-201-7/+74
| | | | | | | | | | | http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-December/056754.html The proposal and implementation are fully documented here: https://sites.google.com/a/chromium.org/dev/nativeclient/pnacl/aligned-bundling-support-in-llvm Tests will follow shortly. llvm-svn: 170718
* Add more reset methods to make all objects that the backend may use for ↵Pedro Artigas2012-12-141-0/+5
| | | | | | outputting code have a reset, some are not used but were declared for completeness llvm-svn: 170227
* Make the MCStreamer have a reset method and call that after finalization of ↵Pedro Artigas2012-12-121-0/+13
| | | | | | | | the asm printer, also changed MCContext to a single reset only method for simplicity as requested on the list llvm-svn: 170041
* Make naming consistent, add comments and sanity assertsEli Bendersky2012-12-121-24/+27
| | | | llvm-svn: 170007
* Remove the RelaxAll overrule in MCAssembler::fixupNeedsRelaxation,Eli Bendersky2012-12-111-3/+2
| | | | | | | | | | | | because that method is only getting called for MCInstFragment. These fragments aren't even generated when RelaxAll is set, which is why the flag reference here is superfluous. Removing it simplifies the code with no harmful effects. An assertion is added higher up to make sure this path is never reached. llvm-svn: 169886
* Cleanup formatting, comments and naming.Eli Bendersky2012-12-101-21/+21
| | | | llvm-svn: 169762
* This patch adds statistics for other non-DWARF fragments emitted byEli Bendersky2012-12-101-2/+13
| | | | | | | | | the assembler. This is useful in order to know how the numbers add up, since in particular the Align fragments account for a non-trivial portion of the emitted fragments (especially on -O0 which sets relax-all). llvm-svn: 169747
* Make the contents of encoded sections SmallVector<char, N> instead ofEli Bendersky2012-12-071-1/+1
| | | | | | | | | | | SmallString. This makes it possible to use the length-erased SmallVectorImpl in the interface without imposing buffer size. Thus, the size of MCInstFragment is back down since a preallocated 8-byte contents buffer is enough. It would be generally a good idea to rid all the fragments of SmallString as contents, because a vector just makes more sense. llvm-svn: 169644
* Refactor MCInstFragment and MCDataFragment to adhere to a common interface,Eli Bendersky2012-12-071-40/+35
| | | | | | | | | which removes code duplication and prepares the ground for future additions. Full discussion: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20121203/158233.html llvm-svn: 169626
* Add separate statistics for Data and Inst fragments emitted during relaxation.Eli Bendersky2012-12-071-1/+5
| | | | | | | Also fixes a test that was overly-sensitive to the exact order of statistics emitted. llvm-svn: 169619
* Change std::vector to SmallVector<4> and remove some unused methods.Eli Bendersky2012-12-051-1/+1
| | | | | | | | This is more consistent with other vectors in this code. In addition, I ran some tests compiling a large program and >96% of fragments have 4 or less fixups, so SmallVector<4> is a good optimization. llvm-svn: 169433
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-031-7/+7
| | | | | | | | | | | | | | | | | Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] llvm-svn: 169131
* Tidy up. Minor formatting.Jim Grosbach2012-09-181-3/+2
| | | | llvm-svn: 164182
* Fix Doxygen issues:Dmitri Gribenko2012-09-141-1/+1
| | | | | | | | | | * wrap code blocks in \code ... \endcode; * refer to parameter names in paragraphs correctly (\arg is not what most people want -- it starts a new paragraph); * use \param instead of \arg to document parameters in order to be consistent with the rest of the codebase. llvm-svn: 163902
* Release build: guard dump functions withManman Ren2012-09-121-1/+1
| | | | | | | | "#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)" No functional change. Update r163344. llvm-svn: 163679
* Release build: guard dump functions with "ifndef NDEBUG"Manman Ren2012-09-061-0/+2
| | | | | | No functional change. llvm-svn: 163344
* Allow targets to specify a minimum supported NOP size when performing NOP ↵Owen Anderson2012-08-291-0/+6
| | | | | | | | padding. If the desired padding is smaller than the supported NOP size, we will enlarge the padding to make it work. llvm-svn: 162870
* Move [SU]LEB128 encoding to a utility header.Jim Grosbach2012-08-081-2/+3
| | | | | | | These functions are very generic. There's no reason for them to be tied to MCObjectWriter. llvm-svn: 161545
* Fix a typo (the the => the)Sylvestre Ledru2012-07-231-1/+1
| | | | llvm-svn: 160621
* Prune some includes and forward declarations.Craig Topper2012-03-261-1/+1
| | | | llvm-svn: 153429
* ARM BL/BLX instruction fixups should use relocations.Jim Grosbach2012-02-271-2/+4
| | | | | | | | | | | | | We on the linker to resolve calls to the appropriate BL/BLX instruction to make interworking function correctly. It uses the symbol in the relocation to do that, so we need to be careful about being too clever. To enable this for ARM mode, split the BL/BLX fixup kind off from the unconditional-branch fixups. rdar://10927209 llvm-svn: 151571
* Convert assert(0) to llvm_unreachableCraig Topper2012-02-071-8/+4
| | | | llvm-svn: 149967
* Source information in 'expected relocatable expression' diagnostic.Jim Grosbach2012-01-271-1/+1
| | | | llvm-svn: 149105
* Tidy up. MCAsmBackend naming conventions.Jim Grosbach2012-01-181-5/+5
| | | | llvm-svn: 148400
* Move some ARM specific MCAssmebler bits into the ARMAsmBackend.Jim Grosbach2012-01-181-9/+2
| | | | llvm-svn: 148364
* Unweaken vtables as per ↵David Blaikie2011-12-201-0/+10
| | | | | | http://llvm.org/docs/CodingStandards.html#ll_virtual_anch llvm-svn: 146960
* Move target-specific logic out of generic MCAssembler.Jim Grosbach2011-12-061-5/+2
| | | | | | | | Whether a fixup needs relaxation for the associated instruction is a target-specific function, as the FIXME indicated. Create a hook for that and use it. llvm-svn: 145881
* Tidy up. Hard tabs.Jim Grosbach2011-12-061-1/+1
| | | | llvm-svn: 145878
* Switch MCAssembler to method names starting w/ lower-case.Jim Grosbach2011-12-061-31/+31
| | | | | | per http://llvm.org/docs/CodingStandards.html#ll_naming llvm-svn: 145873
* Better fix for ARM MOVT relocation encoding of thumb bit.Jim Grosbach2011-11-291-8/+8
| | | | | | Replaces r145318 with a more targetted fix for the relocation handling. llvm-svn: 145346
* Thumb2 only force the fixup thumb bit for data relocations.Jim Grosbach2011-11-281-8/+8
| | | | | | rdar://10493453 llvm-svn: 145318
* Trailing whitespace.Jim Grosbach2011-10-261-2/+2
| | | | llvm-svn: 143071
* Move TargetRegistry and TargetSelect from Target to Support where they belong.Evan Cheng2011-08-241-1/+1
| | | | | | These are strictly utilities for registering targets and components. llvm-svn: 138450
* Rename TargetAsmBackend to MCAsmBackend; rename createAsmBackend to ↵Evan Cheng2011-07-251-2/+2
| | | | | | createMCAsmBackend. llvm-svn: 136010
* Move TargetAsmParser.h TargetAsmBackend.h and TargetAsmLexer.h to MC where ↵Evan Cheng2011-07-231-1/+1
| | | | | | they belong. llvm-svn: 135833
OpenPOWER on IntegriCloud