summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCStreamer.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [MC] Support symbolic expressions in assembly directivesPetr Hosek2016-05-271-2/+14
| | | | | | | | | This matches the behavior of GNU assembler which supports symbolic expressions in absolute expressions used in assembly directives. Differential Revision: http://reviews.llvm.org/D20656 llvm-svn: 271028
* Revert "[MC] Support symbolic expressions in assembly directives"Reid Kleckner2016-05-251-14/+2
| | | | | | This reverts commit r270786, it causes the directive_fill.s to fail. llvm-svn: 270795
* [MC] Support symbolic expressions in assembly directivesPetr Hosek2016-05-251-2/+14
| | | | | | | | | This matches the behavior of GNU assembler which supports symbolic expressions in absolute expressions used in assembly directives. Differential Revision: http://reviews.llvm.org/D20337 llvm-svn: 270786
* [MC] Create unique .pdata sections for every .text sectionReid Kleckner2016-05-021-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This adds a unique ID to the COFF section uniquing map, similar to the one we have for ELF. The unique id is not currently exposed via the assembler because we don't have a use case for it yet. Users generally create .pdata with the .seh_* family of directives, and the assembler internally needs to produce .pdata and .xdata sections corresponding to the code section. The association between .text sections and the assembler-created .xdata and .pdata sections is maintained as an ID field of MCSectionCOFF. The CFI-related sections are created with the given unique ID, so if more code is added to the same text section, we can find and reuse the CFI sections that were already created. Reviewers: majnemer, rafael Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D19376 llvm-svn: 268331
* Add capability to push/pop DFI in MCStreamer. NFCAmaury Sechet2016-02-241-2/+6
| | | | | | | | | | | | Summary: This is extracted from D17555 Reviewers: davidxl, reames, sanjoy, MatzeB, pete Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D17579 llvm-svn: 261796
* [MC] Add support for encoding CodeView variable definition rangesDavid Majnemer2016-02-051-0/+4
| | | | | | | | | | | | | | | | | | | CodeView, like most other debug formats, represents the live range of a variable so that debuggers might print them out. They use a variety of records to represent how a particular variable might be available (in a register, in a frame pointer, etc.) along with a set of ranges where this debug information is relevant. However, the format only allows us to use ranges which are limited to a maximum of 0xF000 in size. This means that we need to split our debug information into chunks of 0xF000. Because the layout of code is not known until *very* late, we must use a new fragment to record the information we need until we can know *exactly* what the range is. llvm-svn: 259868
* [codeview] Correctly handle inlining functions post-dominated by unreachableDavid Majnemer2016-02-021-1/+2
| | | | | | | | | | | | | | CodeView requires us to accurately describe the extent of the inlined code. We did this by grabbing the next debug location in source order and using *that* to denote where we stopped inlining. However, this is not sufficient or correct in instances where there is no next debug location or the next debug location belongs to the start of another function. To get this correct, use the end symbol of the function to denote the last possible place the inlining could have stopped at. llvm-svn: 259548
* [codeview] Wire up the .cv_inline_linetable directiveReid Kleckner2016-02-021-1/+1
| | | | | | | | This directive emits the binary annotations that describe line and code deltas in inlined call sites. Single-stepping through inlined frames in windbg now works. llvm-svn: 259535
* [CodeView] Implement .cv_inline_linetableDavid Majnemer2016-01-291-0/+4
| | | | | | | | | | | This support is _very_ rudimentary, just enough to get some basic data into the CodeView debug section. Left to do is: - Use the combined opcodes to save space. - Do something about code offsets. llvm-svn: 259230
* Reland "[CodeView] Use assembler directives for line tables"Reid Kleckner2016-01-291-0/+16
| | | | | | | | This reverts commit r259126 and relands r259117. This time with updated library dependencies. llvm-svn: 259130
* Revert "[CodeView] Use assembler directives for line tables"Reid Kleckner2016-01-291-16/+0
| | | | | | | | | This reverts commit r259117. The LineInfo constructor is defined in the codeview library and we have to link against it now. Doing that isn't trivial, so reverting for now. llvm-svn: 259126
* [CodeView] Use assembler directives for line tablesReid Kleckner2016-01-281-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds a new family of .cv_* directives to LLVM's variant of GAS syntax: - .cv_file: Similar to DWARF .file directives - .cv_loc: Similar to the DWARF .loc directive, but starts with a function id. CodeView line tables are emitted by function instead of by compilation unit, so we needed an extra field to communicate this. Rather than overloading the .loc direction further, we decided it was better to have our own directive. - .cv_stringtable: Emits the codeview string table at the current position. Currently this just contains the filenames as null-terminated strings. - .cv_filechecksums: Emits the file checksum table for all files used with .cv_file so far. There is currently no support for emitting actual checksums, just filenames. This moves the line table emission code down into the assembler. This is in preparation for implementing the inlined call site line table format. The inline line table format encoding algorithm requires knowing the absolute code offsets, so it must run after the assembler has laid out the code. David Majnemer collaborated on this patch. llvm-svn: 259117
* Simplify now that emitValueToOffset always returns false.Rafael Espindola2015-11-041-3/+1
| | | | llvm-svn: 252102
* [X86] Emit .cfi_escape GNU_ARGS_SIZE when adjusting the stack before callsMichael Kuperstein2015-10-071-0/+8
| | | | | | | | | | | | 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 pr24486.Rafael Espindola2015-10-051-4/+5
| | | | | | | | | | | | | | | | | | 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
* Disallow assigning symbol a null section.Rafael Espindola2015-10-031-4/+2
| | | | | | | They are constructed without one and they can't go back, so this was effectively dead code. llvm-svn: 249220
* Cleanup places that passed SMLoc by const reference to pass it by value ↵Craig Topper2015-09-201-4/+2
| | | | | | instead. NFC llvm-svn: 248135
* [X86] Add .intel_syntax noprefix directive to intel-syntax x86 asm outputMichael Kuperstein2015-07-221-0/+2
| | | | | | | Patch by: michael.zuckerman@intel.com Differential Revision: http://reviews.llvm.org/D11223 llvm-svn: 242886
* [MC] Adding prettyPrintAsm to MCTargetStreamer to allow targets to ↵Colin LeMahieu2015-06-181-0/+6
| | | | | | specialize how instructions are printed to asm. llvm-svn: 240050
* Generalize emitAbsoluteSymbolDiff.Rafael Espindola2015-06-111-0/+19
| | | | | | | | | | This makes emitAbsoluteSymbolDiff always succeed and moves logic from the asm printer to it. The object one now also works on ELF. If two symbols are in the same fragment, we will never move them apart. llvm-svn: 239552
* Create a MCSymbolELF.Rafael Espindola2015-06-021-1/+1
| | | | | | | | | This create a MCSymbolELF class and moves SymbolSize since only ELF needs a size expression. This reduces the size of MCSymbol from 56 to 48 bytes. llvm-svn: 238801
* [WinCOFF] Add support for the .safeseh directiveDavid Majnemer2015-05-301-0/+3
| | | | | | | | | .safeseh adds an entry to the .sxdata section to register all the appropriate functions which may handle an exception. This entry is not a relocation to the symbol but instead the symbol table index of the function. llvm-svn: 238641
* MC: Clean up MCExpr naming. NFC.Jim Grosbach2015-05-301-2/+2
| | | | llvm-svn: 238634
* [WinEH] Emit EH tables for __CxxFrameHandler3 on 32-bit x86Reid Kleckner2015-05-291-0/+6
| | | | | | | | | | | | | Small (really small!) C++ exception handling examples work on 32-bit x86 now. This change disables the use of .seh_* directives in WinException when CFI is not in use. It also uses absolute symbol references in the tables instead of imagerel32 relocations. Also fixes a cache invalidation bug in MMI personality classification. llvm-svn: 238575
* There is only one current section.Rafael Espindola2015-05-271-1/+1
| | | | | | | | | | | | | | | | | Both MCStreamer and MCObjectStreamer were maintaining a current section variable and they were slightly out of sync. I don't think this was observable, but was inefficient and error prone. Changing this requires a few cascading changes: * SwitchSection has to call ChangeSection earlier for ChangeSection to see the old section. * With that change, ChangeSection cannot call EmitLabel, since during ChangeSection we are still in the old section. * When the object streamer requires a begin label, just reused the existing generic support for begin labels instead of calling EmitLabel directly. llvm-svn: 238357
* Move alignment from MCSectionData to MCSection.Rafael Espindola2015-05-211-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | 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: Clean up method names in MCContext.Jim Grosbach2015-05-181-14/+14
| | | | | | | The naming was a mish-mash of old and new style. Update to be consistent with the new. NFC. llvm-svn: 237594
* Remove MCAssembler.h include from MCStreamer.h and fix users of MCStreamer.hPete Cooper2015-05-151-0/+1
| | | | llvm-svn: 237483
* Implement unique sections with an unique ID.Rafael Espindola2015-04-041-6/+0
| | | | | | | | | | | This allows the compiler/assembly programmer to switch back to a section. This in turn fixes the bootstrap failure on powerpc (tested on gcc110) without changing the ppc codegen at all. I will try to cleanup the various getELFSection overloads in a followup patch. Just using a default argument now would lead to ambiguities. llvm-svn: 234099
* Close unique sections when switching away from them.Rafael Espindola2015-03-271-0/+6
| | | | | | | It is not possible to switch back to unique secitons, so close them automatically when switching away. llvm-svn: 233380
* Refactor how passes get a symbol at the end of a section.Rafael Espindola2015-03-231-0/+13
| | | | | | | | | | There is now a canonical symbol at the end of a section that different passes can request. This also allows us to assert that we don't switch back to a section whose end symbol has already been printed. llvm-svn: 233026
* Print section start labels when first switching to the section.Rafael Espindola2015-03-111-0/+4
| | | | | | | This is less brittle and avoids polluting the start of the file with every debug section. llvm-svn: 231898
* Move a non-trivial virtual function out of line.Rafael Espindola2015-03-101-0/+11
| | | | llvm-svn: 231853
* Revert r221150, as it broke sanitizer testsOliver Stannard2014-11-031-4/+4
| | | | llvm-svn: 221151
* Emit .eh_frame with relocations to functions, rather than sectionsOliver Stannard2014-11-031-4/+4
| | | | | | | | | | | | | | | | | | | | | | | When LLVM emits DWARF call frame information, it currently creates a local, section-relative symbol in the code section, which is pointed to by a relocation on the .eh_frame section. However, for C++ we emit some functions in section groups, and the SysV ABI has some rules to make it easier to remove these sections (http://www.sco.com/developers/gabi/latest/ch4.sheader.html#section_group_rules): A symbol table entry with STB_LOCAL binding that is defined relative to one of a group's sections, and that is contained in a symbol table section that is not part of the group, must be discarded if the group members are discarded. References to this symbol table entry from outside the group are not allowed. This means that we need to use the function symbol for the relocation, not a temporary symbol. There was a comment in the code claiming that the local symbol was used to avoid creating a relocation, but a relocation must be created anyway as the code and CFI are in different sections. llvm-svn: 221150
* Simplify handling of --noexecstack by using getNonexecutableStackSection.Rafael Espindola2014-10-151-1/+1
| | | | llvm-svn: 219799
* [asan-asm-instrumentation] CFI directives are generated for .S files.Yuri Gorshenin2014-10-071-0/+12
| | | | | | | | | | | | Summary: CFI directives are generated for .S files. Reviewers: eugenis Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D5520 llvm-svn: 219199
* Another required re-setting for MCStreamer::reset().Yaron Keren2014-09-171-0/+1
| | | | llvm-svn: 217970
* Add and update reset() and doInitialization() methods to MC* and passes.Yaron Keren2014-09-171-0/+1
| | | | | | This enables reusing a PassManager instead of re-constructing it every time. llvm-svn: 217948
* Don't allow MCStreamer::EmitIntValue to output 0-byte integers.Alexey Samsonov2014-08-201-1/+1
| | | | | | | | It makes no sense and can hide bugs. In particular, it lead to left shift by 64 bits, which is an undefined behavior, properly reported by UBSan. llvm-svn: 216134
* Make EmitAbsValue an static helper.Rafael Espindola2014-08-151-17/+0
| | | | llvm-svn: 215721
* Delete dead code. NFC.Rafael Espindola2014-08-151-6/+0
| | | | llvm-svn: 215720
* Make EmitDwarfSetLineAddr an static helper. NFC.Rafael Espindola2014-08-151-12/+0
| | | | llvm-svn: 215718
* Make BuildSymbolDiff an static helper.Rafael Espindola2014-08-151-13/+0
| | | | llvm-svn: 215717
* Make ForceExpAbs an static helper.Rafael Espindola2014-08-151-3/+4
| | | | llvm-svn: 215715
* MC: virtualise EmitWindowsUnwindTablesSaleem Abdulrasool2014-08-031-4/+0
| | | | | | | | | This makes EmitWindowsUnwindTables a virtual function and lowers the implementation of the function to the X86WinCOFFStreamer. This method is a target specific operation. This enables making the behaviour target dependent by isolating it entirely to the target specific streamer. llvm-svn: 214664
* MC: rename Win64EHFrameInfo to WinEH::FrameInfoSaleem Abdulrasool2014-08-031-18/+27
| | | | | | | | | | | | | | The frame information stored in this structure is driven by the requirements for Windows NT unwinding rather than Windows 64 specifically. As a result, this type can be shared across multiple architectures (ARM, AXP, MIPS, PPC, SH). Rename this class in preparation for adding support for supporting unwinding information for Windows on ARM. Take the opportunity to constify the members as everything except the ChainedParent is read-only. This required some adjustment to the label handling. llvm-svn: 214663
* MC: permit emitting a symbol value as section relativeSaleem Abdulrasool2014-07-191-2/+9
| | | | | | | | | | | This adds an optional parameter to the EmitSymbolValue method in MCStreamer to permit emitting a symbol value as a section relative value. This is to cover the use in MCDwarf which should not really know about how to emit a section relative value for a given target. This addresses post-review comments from Eric Christopher in SVN r213275. llvm-svn: 213463
* MC: make WinEH opcode an opaque valueSaleem Abdulrasool2014-07-171-10/+22
| | | | | | | | | | | This makes the opcode an opaque value (unsigned int) rather than the enumeration. This permits the use of target specific operands. Split out the generic type into a MCWinEH header and add a supporting MCWin64EH::Instruction to abstract out the selection of the opcode and construction of the actual instruction. llvm-svn: 213221
* MC: make DWARF and Windows unwinding handling more similarSaleem Abdulrasool2014-07-131-93/+89
| | | | | | | | Rename member variables and functions for the MCStreamer for DWARF-like unwinding management. Rename the Windows ones as well and make the naming and handling similar across the two. No functional change intended. llvm-svn: 212912
OpenPOWER on IntegriCloud