summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC
Commit message (Collapse)AuthorAgeFilesLines
* llvm/lib/MC/MCParser/AsmParser.cpp: [ms-inline-asm] Fix a couple of ↵NAKAMURA Takumi2013-01-111-2/+4
| | | | | | undefined behaviors. Operand->needAddressOf() is not initialized at !Operand->isReg(). llvm-svn: 172153
* Rename enumerations s/VK/DK/ to conform to naming conventionEli Bendersky2013-01-101-153/+153
| | | | llvm-svn: 172149
* fix comments a bitEli Bendersky2013-01-101-2/+2
| | | | llvm-svn: 172146
* Remove a couple of if-else chains in parsing directives, replacing them by aEli Bendersky2013-01-101-149/+240
| | | | | | switch. Committed with Jim's and Chris's approval. llvm-svn: 172136
* [ms-inline asm] Add support for calling functions from inline assembly.Chad Rosier2013-01-101-12/+13
| | | | | | Part of rdar://12991541 llvm-svn: 172121
* PowerPC: EH adjustmentsAdhemerval Zanella2013-01-091-10/+7
| | | | | | | | | This patch adjust the r171506 to make all DWARF enconding pc-relative for PPC64. It also adds the R_PPC64_REL32 relocation handling in MCJIT (since the eh_frame will not generate PIC-relative relocation) and also adds the emission of stubs created by the TTypeEncoding. llvm-svn: 171979
* Last in the series of removing unnecessary '0' arguments forEric Christopher2013-01-092-3/+3
| | | | | | | address space. Reordered the EmitULEB128IntValue arguments to make this easier. llvm-svn: 171949
* These functions have default arguments of 0 for the last arg. UseEric Christopher2013-01-092-19/+19
| | | | | | them. llvm-svn: 171933
* These functions have default arguments of 0 for the last arg. UseEric Christopher2013-01-091-1/+1
| | | | | | them and add one where it seemed obvious that we wanted one. llvm-svn: 171932
* 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-084-27/+29
| | | | | | No change in functionality. llvm-svn: 171822
* Add the align_to_end option to .bundle_lock in the MC implementation of alignedEli Bendersky2013-01-076-17/+66
| | | | | | | | | 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
* [ms-inline asm] Make sure the NullStreamParser doesn't try to emit labels whenChad Rosier2013-01-071-1/+2
| | | | | | parsing MS-style inline assembly. llvm-svn: 171784
* Change SMRange to be half-open (exclusive end) instead of closed (inclusive)Jordan Rose2013-01-072-11/+12
| | | | | | | | | | This is necessary not only for representing empty ranges, but for handling multibyte characters in the input. (If the end pointer in a range refers to a multibyte character, should it point to the beginning or the end of the character in a char array?) Some of the code in the asm parsers was already assuming this anyway. llvm-svn: 171765
* PowerPC: Fix eh_frame relocation for PIC Adhemerval Zanella2013-01-041-0/+11
| | | | | | | | | This patch fixes the PPC eh_frame definitions for the personality and frame unwinding for PIC objects. It makes PIC build correctly creates relative relocations in the '.rela.eh_frame' segments and thus avoiding a text relocation that generates a DT_TEXTREL segments in link phase. llvm-svn: 171506
* small fixes to enable the reuse of the pass manager across multiple modulesPedro Artigas2013-01-042-1/+1
| | | | llvm-svn: 171475
* Add section information for the DWARF5 split debug proposalEric Christopher2013-01-041-0/+3
| | | | | | string offset section. llvm-svn: 171474
* [MC][COFF] Switch the COFF streamer over to using the MCObjectStreamer ↵Michael J. Spencer2013-01-031-22/+14
| | | | | | version of EmitInstruction. llvm-svn: 171437
* 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-206-15/+276
| | | | | | | | | | | 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
* Remove MCTargetAsmLexer and its derived classes now that edis,Roman Divacky2012-12-202-17/+0
| | | | | | its only user, is gone. llvm-svn: 170699
* Remove edis - the enhanced disassembler. Fixes PR14654.Roman Divacky2012-12-1911-2186/+0
| | | | llvm-svn: 170578
* Add to the disassembler C API an option to print the disassembledKevin Enderby2012-12-182-0/+20
| | | | | | | | | | | | | | | | instructions in the assembly code variant if one exists. The intended use for this is so tools like lldb and darwin's otool(1) can be switched to print Intel-flavored disassembly. I discussed extensively this API with Jim Grosbach and we feel while it may not be fully general, in reality there is only one syntax for each assembly with the exception of X86 which has exactly two for historical reasons. rdar://10989182 llvm-svn: 170477
* Formatting.Eric Christopher2012-12-181-1/+1
| | | | llvm-svn: 170394
* Add support for passing -main-file-name all the way through toEric Christopher2012-12-182-1/+8
| | | | | | | | the assembler. Part of PR14624 llvm-svn: 170390
* Cleanup formatting and whitespace.Eric Christopher2012-12-181-9/+10
| | | | llvm-svn: 170389
* EmitDebugLabel should by default be the same as EmitLabel everywhere.Reed Kotler2012-12-171-0/+5
| | | | | | | It must be explicity set in MCPureStreamer because otherwise it will inherit incorrectly from the parent. llvm-svn: 170383
* fix indentationEli Bendersky2012-12-171-1/+1
| | | | llvm-svn: 170381
* Prepare LLVM to fix PR14625, exposing a hook in MCContext to manage theChandler Carruth2012-12-172-3/+3
| | | | | | | | | | compilation directory. This defaults to the current working directory, just as it always has, but now an assembler can choose to override it with a custom directory. I've taught llvm-mc about this option and added a test case. llvm-svn: 170371
* Teach MachO which sections contain codeTim Northover2012-12-171-1/+1
| | | | llvm-svn: 170349
* MCPureStreamer.cpp: Try to fix build, pruning EmitDebugLabel().NAKAMURA Takumi2012-12-161-1/+0
| | | | llvm-svn: 170280
* This patch is needed to make c++ exceptions work for mips16.Reed Kotler2012-12-169-1/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mips16 is really a processor decoding mode (ala thumb 1) and in the same program, mips16 and mips32 functions can exist and can call each other. If a jal type instruction encounters an address with the lower bit set, then the processor switches to mips16 mode (if it is not already in it). If the lower bit is not set, then it switches to mips32 mode. The linker knows which functions are mips16 and which are mips32. When relocation is performed on code labels, this lower order bit is set if the code label is a mips16 code label. In general this works just fine, however when creating exception handling tables and dwarf, there are cases where you don't want this lower order bit added in. This has been traditionally distinguished in gas assembly source by using a different syntax for the label. lab1: ; this will cause the lower order bit to be added lab2=. ; this will not cause the lower order bit to be added In some cases, it does not matter because in dwarf and debug tables the difference of two labels is used and in that case the lower order bits subtract each other out. To fix this, I have added to mcstreamer the notion of a debuglabel. The default is for label and debug label to be the same. So calling EmitLabel and EmitDebugLabel produce the same result. For various reasons, there is only one set of labels that needs to be modified for the mips exceptions to work. These are the "$eh_func_beginXXX" labels. Mips overrides the debug label suffix from ":" to "=." . This initial patch fixes exceptions. More changes most likely will be needed to DwarfCFException to make all of this work for actual debugging. These changes will be to emit debug labels in some places where a simple label is emitted now. Some historical discussion on this from gcc can be found at: http://gcc.gnu.org/ml/gcc-patches/2008-08/msg00623.html http://gcc.gnu.org/ml/gcc-patches/2008-11/msg01273.html llvm-svn: 170279
* Add more reset methods to make all objects that the backend may use for ↵Pedro Artigas2012-12-143-1/+17
| | | | | | outputting code have a reset, some are not used but were declared for completeness llvm-svn: 170227
* This patch improves the 64-bit PowerPC InitialExec TLS support by providingBill Schmidt2012-12-141-1/+2
| | | | | | | | | | | | | | | | | | | | | | | for a wider range of GOT entries that can hold thread-relative offsets. This matches the behavior of GCC, which was not documented in the PPC64 TLS ABI. The ABI will be updated with the new code sequence. Former sequence: ld 9,x@got@tprel(2) add 9,9,x@tls New sequence: addis 9,2,x@got@tprel@ha ld 9,x@got@tprel@l(9) add 9,9,x@tls Note that a linker optimization exists to transform the new sequence into the shorter sequence when appropriate, by replacing the addis with a nop and modifying the base register and relocation type of the ld. llvm-svn: 170209
* Make the MCStreamer have a reset method and call that after finalization of ↵Pedro Artigas2012-12-124-19/+46
| | | | | | | | the asm printer, also changed MCContext to a single reset only method for simplicity as requested on the list llvm-svn: 170041
* [ms-inline asm] Make sure we fail gracefully on parse errors. Parse errorsChad Rosier2012-12-121-2/+9
| | | | | | | | should only occur on invalid input. Instruction matching errors aren't unexpected, so we can't rely on the AsmParsers HadError variable directly. rdar://12840278 llvm-svn: 170037
* Make naming consistent, add comments and sanity assertsEli Bendersky2012-12-121-24/+27
| | | | llvm-svn: 170007
* This patch implements local-dynamic TLS model support for the 64-bitBill Schmidt2012-12-121-0/+5
| | | | | | | | | | | | | | | | | | | | | | PowerPC target. This is the last of the four models, so we now have full TLS support. This is mostly a straightforward extension of the general dynamic model. I had to use an additional Chain operand to tie ADDIS_DTPREL_HA to the register copy following ADDI_TLSLD_L; otherwise everything above the ADDIS_DTPREL_HA appeared dead and was removed. As before, there are new test cases to test the assembly generation, and the relocations output during integrated assembly. The expected code gen sequence can be read in test/CodeGen/PowerPC/tls-ld.ll. There are a couple of things I think can be done more efficiently in the overall TLS code, so there will likely be a clean-up patch forthcoming; but for now I want to be sure the functionality is in place. Bill llvm-svn: 170003
* Add ARM NONE and PREL31 relocation types.Logan Chien2012-12-121-2/+6
| | | | | | | | Add R_ARM_NONE and R_ARM_PREL31 relocation types to MCExpr. Both of them will be used while generating .ARM.extab and .ARM.exidx sections. llvm-svn: 169965
* This patch implements the general dynamic TLS model for 64-bit PowerPC.Bill Schmidt2012-12-111-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Given a thread-local symbol x with global-dynamic access, the generated code to obtain x's address is: Instruction Relocation Symbol addis ra,r2,x@got@tlsgd@ha R_PPC64_GOT_TLSGD16_HA x addi r3,ra,x@got@tlsgd@l R_PPC64_GOT_TLSGD16_L x bl __tls_get_addr(x@tlsgd) R_PPC64_TLSGD x R_PPC64_REL24 __tls_get_addr nop <use address in r3> The implementation borrows from the medium code model work for introducing special forms of ADDIS and ADDI into the DAG representation. This is made slightly more complicated by having to introduce a call to the external function __tls_get_addr. Using the full call machinery is overkill and, more importantly, makes it difficult to add a special relocation. So I've introduced another opcode GET_TLS_ADDR to represent the function call, and surrounded it with register copies to set up the parameter and return value. Most of the code is pretty straightforward. I ran into one peculiarity when I introduced a new PPC opcode BL8_NOP_ELF_TLSGD, which is just like BL8_NOP_ELF except that it takes another parameter to represent the symbol ("x" above) that requires a relocation on the call. Something in the TblGen machinery causes BL8_NOP_ELF and BL8_NOP_ELF_TLSGD to be treated identically during the emit phase, so this second operand was never visited to generate relocations. This is the reason for the slightly messy workaround in PPCMCCodeEmitter.cpp:getDirectBrEncoding(). Two new tests are included to demonstrate correct external assembly and correct generation of relocations using the integrated assembler. Comments welcome! Thanks, Bill llvm-svn: 169910
* 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
* Defer call to InitSections until after MCContext has been initialized. IfLang Hames2012-12-101-1/+2
| | | | | | | | InitSections is called before the MCContext is initialized it could cause duplicate temporary symbols to be emitted later (after context initialization resets the temporary label counter). llvm-svn: 169785
* 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
* Add C API for specifying CPU to the disassembler.Jim Grosbach2012-12-071-9/+16
| | | | | | | | | It was a nasty oversight that we didn't include this when we added this API in the first place. Blech. rdar://12839439 llvm-svn: 169653
* Make the contents of encoded sections SmallVector<char, N> instead ofEli Bendersky2012-12-072-9/+9
| | | | | | | | | | | 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-076-54/+52
| | | | | | | | | 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
* Some common functionality from WinCOFFStreamer::EmitAssignment can be nowEli Bendersky2012-12-071-3/+1
| | | | | | delegated to MCObjectStreamer. llvm-svn: 169617
OpenPOWER on IntegriCloud