summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC
Commit message (Collapse)AuthorAgeFilesLines
...
* [NVPTX] Initial adaptation of MCAsmStreamer/MCTargetStreamer for debug info ↵Alexey Bataev2017-12-202-14/+55
| | | | | | | | | | | | | | | | | | | | | in Cuda. Summary: Initial changes in interfaces of MCAsmStreamer/MCTargetStreamer for correct debug info emission for Cuda. 1. PTX foramt does not support `.ascii` directives. Added the ability to nullify it. 2. The initial function label must follow the first debug `.loc` directive, not be followed by. 3. DWARF sections must be enclosed in braces. Reviewers: hfinkel, probinson, jlebar, rafael, echristo Subscribers: sdardis, nemanjai, llvm-commits, aprantl Differential Revision: https://reviews.llvm.org/D40033 llvm-svn: 321178
* [WebAssembly] Remove an obsolete comment.Dan Gohman2017-12-201-2/+1
| | | | llvm-svn: 321127
* [WebAssembly] Implement @llvm.global_ctors and @llvm.global_dtorsSam Clegg2017-12-151-4/+75
| | | | | | | | | | | | | | | Summary: - lowers @llvm.global_dtors by adding @llvm.global_ctors functions which register the destructors with `__cxa_atexit`. - impements @llvm.global_ctors with wasm start functions and linker metadata See [here](https://github.com/WebAssembly/tool-conventions/issues/25) for more background. Subscribers: jfb, dschuff, mgorny, jgravelle-google, aheejin, sunfish Differential Revision: https://reviews.llvm.org/D41211 llvm-svn: 320774
* [MC] Allow .file directives to be out-of-orderPaul Robinson2017-12-141-1/+2
| | | | llvm-svn: 320727
* MC/AsmPrinter: Reduce code duplication.Matthias Braun2017-12-142-20/+31
| | | | | | | | | | Factor out duplicated code emitting mach-o version-min specifiers. This should be NFC but happens to fix a bug where the code in MCMachoStreamer didn't take the version skew between darwin and macos versions into account. llvm-svn: 320666
* MC: Add support for mach-o build_versionMatthias Braun2017-12-145-81/+219
| | | | | | | | LC_BUILD_VERSION is a new load command superseding the previously used LC_XXX_MIN_VERSION commands. This adds an assembler directive along with encoding/streaming support. llvm-svn: 320661
* [CodeView] Teach clang to emit the .debug$H COFF section.Zachary Turner2017-12-131-0/+6
| | | | | | | | | | | | | | | Currently this is an LLVM extension to the COFF spec which is experimental and intended to speed up linking. For now it is behind a hidden cl::opt flag, but in the future we can move it to a "real" cc1 flag and have the driver pass it through whenever it is appropriate. The patch to actually make use of this section in lld will come in a followup. Differential Revision: https://reviews.llvm.org/D40917 llvm-svn: 320649
* Remove redundant includes from lib/MC.Michael Zolotukhin2017-12-1310-19/+0
| | | | llvm-svn: 320624
* Reland "[WebAssembly] Import the linear memory and function table."Sam Clegg2017-12-111-40/+42
| | | | | | Original change: https://reviews.llvm.org/D40875 llvm-svn: 320432
* Revert and accidentally committed revert commitDylan McKay2017-12-091-0/+10
| | | | | | This reverts commit r320245. llvm-svn: 320247
* Revert "[AVR] Override ParseDirective"Dylan McKay2017-12-091-10/+0
| | | | | | This reverts commit 57c16f9267969ebb09d6448607999b4a9f40c418. llvm-svn: 320245
* [AVR] Override ParseDirectiveLeslie Zhai2017-12-071-0/+10
| | | | | | | | | | Reviewers: dylanmckay, kparzysz Reviewed By: dylanmckay Differential Revision: https://reviews.llvm.org/D38029 llvm-svn: 320009
* Revert "[WebAssembly] Import the linear memory and function table."Sam Clegg2017-12-071-42/+40
| | | | | | | | | We need to a little time to prepare and lld-side change that supports this. Original change: https://reviews.llvm.org/D40875 llvm-svn: 320003
* [MC/Dwarf] Use the older DWARF linetables format on Darwin.Davide Italiano2017-12-071-0/+3
| | | | | | | | | | dsymutil doesn't yet understand the new format and the change, among others, breaks a large fraction of the debugger tests on mac OS. rdar://problem/35856354 llvm-svn: 319995
* [WebAssembly] Import the linear memory and function table.Dan Gohman2017-12-061-40/+42
| | | | | | | | | | | | Instead of having .o files contain linear-memory and function table definitions, use imports. This is more consistent with the stack pointer being imported, and it's consistent with the linker being the one to decide whether linear memory and function table are imported or defined in the linked output. This implements tool-conventions #23. Differential Revision: https://reviews.llvm.org/D40875 llvm-svn: 319989
* [WebAssembly] Remove WASM_STACK_POINTER.Dan Gohman2017-12-061-35/+4
| | | | | | | WASM_STACK_POINTER and the .stack_pointer directive are no longer needed now that the stack pointer global is an import. llvm-svn: 319956
* [DWARFv5] Emit v5 line table header.Paul Robinson2017-12-051-32/+84
| | | | | | Differential Revision: https://reviews.llvm.org/D40741 llvm-svn: 319827
* [WebAssembly] Make stack-pointer imports mutable.Dan Gohman2017-12-051-40/+47
| | | | | | | | | | | | This is not currently valid by the wasm spec, however: - It replaces doing set_global on an immutable global, which is also not valid. - It's expected be valid in the near future: https://github.com/WebAssembly/threads/blob/master/proposals/threads/Globals.md - This only occurs before linking, so a fully linked object will be valid. llvm-svn: 319810
* [WebAssembly] Implement WASM_STACK_POINTER.Dan Gohman2017-12-051-11/+12
| | | | | | | Use the .stack_pointer directive to implement WASM_STACK_POINTER for specifying a global variable to be the stack pointer. llvm-svn: 319797
* Re-submit r289925 (Update .debug_line section version to match DWARF version)Paul Robinson2017-12-041-2/+12
| | | | | | | | | | | | | | | Set the .debug_line version to match the requested DWARF version, except with a maximum of v4 because we don't support v5 yet. Previously Chromium had issues with this patch; see PR31407. Chromium tool issues have been addressed, so hopefully this will go through this time. Patch by Katya Romanova! Differential Revision: https://reviews.llvm.org/D38002 llvm-svn: 319699
* Reland "[WebAssembly] Add visibility flag to Wasm symbol flags""Sam Clegg2017-12-032-3/+10
| | | | | | | | | | Original change was rL319488. This was reverted rL319602 due to a gcc 7.1 warning. Differential Revision: https://reviews.llvm.org/D40772 llvm-svn: 319626
* [WebAssembly] Revert r319488 "Add visibility flag to Wasm symbol flags"Heejin Ahn2017-12-022-10/+3
| | | | | | | | | This patch reportedly broke one of LLVM bots (ubuntu-gcc7.1-werror). See http://lab.llvm.org:8011/builders/ubuntu-gcc7.1-werror/builds/3369 for details. llvm-svn: 319602
* [MC] Handle unknown literal register numbers in .cfi_* directivesJake Ehrlich2017-12-013-10/+43
| | | | | | | | | | | | | | | | | r230670 introduced a step to map EH register numbers to standard DWARF register numbers. This failed to consider the case when a user .cfi_* directive uses an integer literal rather than a register name, to specify a DWARF register number that has no corresponding LLVM register number (e.g. a special register that the compiler and assembler have no name for). Fixes PR34028. Patch by Roland McGrath Differential Revision: https://reviews.llvm.org/D36493 llvm-svn: 319586
* Add visibility flag to Wasm symbol flagsSam Clegg2017-11-302-3/+10
| | | | | | | | | | | | | | The LLVM "hidden" flag needs to be passed through the Wasm intermediate objects in order for the linker to apply it to the final Wasm object. The corresponding change in LLD is here: https://github.com/WebAssembly/lld/pull/14 Patch by Nicholas Wilson Differential Revision: https://reviews.llvm.org/D40442 llvm-svn: 319488
* [MC] Function stack size section.Sean Eveson2017-11-301-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | Re applying after fixing issues in the diff, sorry for any painful conflicts/merges! Original RFC: http://lists.llvm.org/pipermail/llvm-dev/2017-August/117028.html This change adds a '.stack-size' section containing metadata on function stack sizes to output ELF files behind the new -stack-size-section flag. The section contains pairs of function symbol references (8 byte) and stack sizes (unsigned LEB128). The contents of this section can be used to measure changes to stack sizes between different versions of the compiler or a source base. The advantage of having a section is that we can extract this information when examining binaries that we didn't build, and it allows users and tools easy access to that information just by referencing the binary. There is a follow up change to add an option to clang. Thanks. Reviewers: hfinkel, MatzeB Reviewed By: MatzeB Subscribers: thegameg, asb, llvm-commits Differential Revision: https://reviews.llvm.org/D39788 llvm-svn: 319430
* Revert r319423: [MC] Function stack size section.Sean Eveson2017-11-301-907/+905
| | | | | | I messed up the diff. llvm-svn: 319429
* [MC] Function stack size section.Sean Eveson2017-11-301-905/+907
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Original RFC: http://lists.llvm.org/pipermail/llvm-dev/2017-August/117028.html I wasn't sure who to put as reviewers, so please add/remove people as appropriate. This change adds a '.stack-size' section containing metadata on function stack sizes to output ELF files behind the new -stack-size-section flag. The section contains pairs of function symbol references (8 byte) and stack sizes (unsigned LEB128). The contents of this section can be used to measure changes to stack sizes between different versions of the compiler or a source base. The advantage of having a section is that we can extract this information when examining binaries that we didn't build, and it allows users and tools easy access to that information just by referencing the binary. There is a follow up change to add an option to clang. Thanks. Reviewers: hfinkel, MatzeB Reviewed By: MatzeB Subscribers: thegameg, asb, llvm-commits Differential Revision: https://reviews.llvm.org/D39788 llvm-svn: 319423
* [WebAssembly] Support bitcasted function addresses with varargs.Dan Gohman2017-11-281-3/+6
| | | | | | | | | | | | | Generalize FixFunctionBitcasts to handle varargs functions. This in particular fixes the case where clang bitcasts away a varargs when calling a K&R-style function. This avoids interacting with tricky ABI details because it operates at the LLVM IR level before varargs ABI details are exposed. This fixes PR35385. llvm-svn: 319186
* [MC] Fix regression tests on Windows when git “core.autocrlf” is set to ↵Zhen Cao2017-11-171-0/+2
| | | | | | | | | | true. Differential Revision: https://reviews.llvm.org/D39737 This is the second attempt to commit this. The test was broken on Linux in the first attempt. llvm-svn: 318560
* Revert "[MC] Fix regression tests on Windows when git “core.autocrlf” is ↵Rafael Espindola2017-11-171-2/+0
| | | | | | | | | | set to true." This reverts commit r318528. MC/AsmParser/preserve-comments-crlf.s fails on linux. llvm-svn: 318533
* [MC] Fix regression tests on Windows when git “core.autocrlf” is set to ↵Zhen Cao2017-11-171-0/+2
| | | | | | | | true. Differential Revision: https://reviews.llvm.org/D39737 llvm-svn: 318528
* NFC: Rename MCSafeSEHFragment to MCSymbolIdFragmentAdrian McCarthy2017-11-083-9/+9
| | | | | | | | | | | | | | | Summary: This fragment emits a symbol ID and will be useful for more than just Safe SEH tables (e.g., I plan to re-use it for Control Flow Guard tables). This is simply a rename refactor. Reviewers: rnk Subscribers: llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D39770 llvm-svn: 317703
* [AsmPrinterDwarf] Add support for .cfi_restore directiveFrancis Visoiu Mistrih2017-11-021-0/+8
| | | | | | | | | | | | | | As of today we only use .cfi_offset to specify the offset of a CSR, but we never use .cfi_restore when the CSR is restored. If we want to perform a more advanced type of shrink-wrapping, we need to use .cfi_restore in order to switch the CFI state between blocks. This patch only aims at adding support for the directive. Differential Revision: https://reviews.llvm.org/D36114 llvm-svn: 317199
* [WebAssembly] MC: Don't allow zero sized data segmentsSam Clegg2017-10-271-0/+8
| | | | | | | | | | | This ensures that each segment has a unique address. Without this, consecutive zero sized symbols would end up with the same address and the linker cannot map symbols to unique data segments. Differential Revision: https://reviews.llvm.org/D39107 llvm-svn: 316717
* [MC] Adding code padding for performance stability - infrastructure. NFC.Omer Paparo Bivas2017-10-246-1/+473
| | | | | | | | | | | | | | | | | Infrastructure designed for padding code with nop instructions in key places such that preformance improvement will be achieved. The infrastructure is implemented such that the padding is done in the Assembler after the layout is done and all IPs and alignments are known. This patch by itself in a NFC. Future patches will make use of this infrastructure to implement required policies for code padding. Reviewers: aaboud zvi craig.topper gadi.haber Differential revision: https://reviews.llvm.org/D34393 Change-Id: I92110d0c0a757080a8405636914a93ef6f8ad00e llvm-svn: 316413
* [WebAssembly] MC: Fix crash when -g specified.Sam Clegg2017-10-204-29/+32
| | | | | | | | | At this point we don't output any debug sections or thier relocations. Differential Revision: https://reviews.llvm.org/D39076 llvm-svn: 316240
* [WebAssembly] MC: Handle (ignore) MCSA_Protected symbol attributeSam Clegg2017-10-201-0/+1
| | | | llvm-svn: 316220
* [MC] Lex CRLF as one tokenReid Kleckner2017-10-161-1/+9
| | | | | | | | | | This will prevent doubling of line endings when parsing assembly and emitting assembly. Otherwise we'd parse the directive, consume the end of statement, hit the next end of statement, and emit a fresh newline. llvm-svn: 315943
* Reverting r315590; it did not include changes for llvm-tblgen, which is ↵Aaron Ballman2017-10-1510-11/+11
| | | | | | | | causing link errors for several people. Error LNK2019 unresolved external symbol "public: void __cdecl `anonymous namespace'::MatchableInfo::dump(void)const " (?dump@MatchableInfo@?A0xf4f1c304@@QEBAXXZ) referenced in function "public: void __cdecl `anonymous namespace'::AsmMatcherEmitter::run(class llvm::raw_ostream &)" (?run@AsmMatcherEmitter@?A0xf4f1c304@@QEAAXAEAVraw_ostream@llvm@@@Z) llvm-tblgen D:\llvm\2017\utils\TableGen\AsmMatcherEmitter.obj 1 llvm-svn: 315854
* [dump] Remove NDEBUG from test to enable dump methods [NFC]Don Hinton2017-10-1210-11/+11
| | | | | | | | | | | | | | | Summary: Add LLVM_FORCE_ENABLE_DUMP cmake option, and use it along with LLVM_ENABLE_ASSERTIONS to set LLVM_ENABLE_DUMP. Remove NDEBUG and only use LLVM_ENABLE_DUMP to enable dump methods. Move definition of LLVM_ENABLE_DUMP from config.h to llvm-config.h so it'll be picked up by public headers. Differential Revision: https://reviews.llvm.org/D38406 llvm-svn: 315590
* [MC] Have MCObjectStreamer take its MCAsmBackend argument via unique_ptr.Lang Hames2017-10-115-19/+27
| | | | | | | | MCObjectStreamer owns its MCCodeEmitter -- this fixes the types to reflect that, and allows us to remove the last instance of MCObjectStreamer's weird "holding ownership via someone else's reference" trick. llvm-svn: 315531
* [codeview] Implement FPO data assembler directivesReid Kleckner2017-10-112-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This adds a set of new directives that describe 32-bit x86 prologues. The directives are limited and do not expose the full complexity of codeview FPO data. They are merely a convenience for the compiler to generate more readable assembly so we don't need to generate tons of labels in CodeGen. If our prologue emission changes in the future, we can change the set of available directives to suit our needs. These are modelled after the .seh_ directives, which use a different format that interacts with exception handling. The directives are: .cv_fpo_proc _foo .cv_fpo_pushreg ebp/ebx/etc .cv_fpo_setframe ebp/esi/etc .cv_fpo_stackalloc 200 .cv_fpo_endprologue .cv_fpo_endproc .cv_fpo_data _foo I tried to follow the implementation of ARM EHABI CFI directives by sinking most directives out of MCStreamer and into X86TargetStreamer. This helps avoid polluting non-X86 code with WinCOFF specific logic. I used cdb to confirm that this can show locals in parent CSRs in a few cases, most importantly the one where we use ESI as a frame pointer, i.e. the one in http://crbug.com/756153#c28 Once we have cdb integration in debuginfo-tests, we can add integration tests there. Reviewers: majnemer, hans Subscribers: aemerson, mgorny, kristof.beyls, llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D38776 llvm-svn: 315513
* [Asm] Add debug tracing in table-generated assembly matcherOliver Stannard2017-10-111-2/+3
| | | | | | | | | | | | | This adds debug tracing to the table-generated assembly instruction matcher, enabled by the -debug-only=asm-matcher option. The changes in the target AsmParsers are to add an MCInstrInfo reference under a consistent name, so that we can use it from table-generated code. This was already being used this way for targets that use deprecation warnings, but 5 targets did not have it, and Hexagon had it under a different name to the other backends. llvm-svn: 315445
* [MC] Have MCObjectStreamer take its MCAsmBackend argument via unique_ptr.Lang Hames2017-10-115-17/+28
| | | | | | | | MCObjectStreamer owns its MCAsmBackend -- this fixes the types to reflect that, and allows us to remove another instance of MCObjectStreamer's weird "holding ownership via someone else's reference" trick. llvm-svn: 315410
* [MC] Thread unique_ptr<MCObjectWriter> through the create.*ObjectWriterLang Hames2017-10-106-15/+20
| | | | | | | | | | functions. This makes the ownership of the resulting MCObjectWriter clear, and allows us to remove one instance of MCObjectStreamer's bizarre "holding ownership via someone else's reference" trick. llvm-svn: 315327
* [MC] Properly diagnose badly scoped .cfi_ directivesReid Kleckner2017-10-101-38/+66
| | | | | | | | | | Removes two report_fatal_errors. Implement this by removing EmitCFICommon, and do the checking in getCurrentDwarfFrameInfo. Have the callers check for null before dereferencing it. llvm-svn: 315264
* [SEH] Use reportError instead of report_fatal_error for bad directivesReid Kleckner2017-10-104-152/+187
| | | | | | | | | | This makes the .seh_ directives slightly more usable from standalone assembly files. This removes a large number of report_fatal_errors and recovers from the error by ignoring the directive. llvm-svn: 315262
* [MC] Plumb unique_ptr<MCWasmObjectTargetWriter> through createWasmObjectWriterLang Hames2017-10-101-5/+8
| | | | | | | | | | to WasmObjectWriter's constructor. Fixes the same ownership issue for COFF that r315245 did for MachO: WasmObjectWriter takes ownership of its MCWasmObjectTargetWriter, so we want to pass this through to the constructor via a unique_ptr, rather than a raw ptr. llvm-svn: 315260
* [MC] Suppress .Lcfi labels when emitting textual assemblyReid Kleckner2017-10-102-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This suppresses the generation of .Lcfi labels in our textual assembler. It was annoying that this generated cascading .Lcfi labels: llc foo.ll -o - | llvm-mc | llvm-mc After three trips through MCAsmStreamer, we'd have three labels in the output when none are necessary. We should only bother creating the labels and frame data when making a real object file. This supercedes D38605, which moved the entire .seh_ implementation into MCObjectStreamer. This has the advantage that we do more checking when emitting textual assembly, as a minor efficiency cost. Outputting textual assembly is not performance critical, so this shouldn't matter. Reviewers: majnemer, MatzeB Subscribers: qcolombet, nemanjai, javed.absar, eraman, hiraditya, JDevlieghere, llvm-commits Differential Revision: https://reviews.llvm.org/D38638 llvm-svn: 315259
* [MC] Plumb unique_ptr<MCWinCOFFObjectTargetWriter> throughLang Hames2017-10-101-8/+8
| | | | | | | | | | | createWinCOFFObjectWriter to WinCOFFObjectWriter's constructor. Fixes the same ownership issue for COFF that r315245 did for MachO: WinCOFFObjectWriter takes ownership of its MCWinCOFFObjectTargetWriter, so we want to pass this through to the constructor via a unique_ptr, rather than a raw ptr. llvm-svn: 315257
OpenPOWER on IntegriCloud