summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/WebAssembly
Commit message (Collapse)AuthorAgeFilesLines
...
* [WebAssembly] Refactor WebAssemblyLowerEmscriptenException pass for ↵Derek Schuff2016-08-182-9/+9
| | | | | | | | | | | | | | | | | | | | | | setjmp/longjmp This patch changes the code structure of WebAssemblyLowerEmscriptenException pass to support both exception handling and setjmp/longjmp. It also changes the name of the pass and the source file. 1. Change the file/pass name to WebAssemblyLowerEmscriptenExceptions -> WebAssemblyLowerEmscriptenEHSjLj to make it clear that it supports both EH and SjLj 2. List function / global variable names at the top so they can be changed easily 3. Some cosmetic changes Patch by Heejin Ahn Differential Revision: https://reviews.llvm.org/D23588 llvm-svn: 279075
* Fix WAsm test after LSR change in r278658Reid Kleckner2016-08-151-8/+8
| | | | | | Now the increment is done in a different location llvm-svn: 278713
* [WebAssembly] Re-enable disabled debug value testDominic Chen2016-08-121-1/+0
| | | | | | | | | | | | | | | Summary: This test was resulting in asan/valgrind failures due to undefined DWARF register mappings for WebAssembly, and was disabled in r278495. These have been resolved. Reviewers: sunfish, dschuff Subscribers: bkramer, llvm-commits, jfb Differential Revision: https://reviews.llvm.org/D23459 llvm-svn: 278576
* [Webassembly] disable unstable test.Benjamin Kramer2016-08-121-0/+2
| | | | | | It reads uninitialized memory and crashes randomly. llvm-svn: 278495
* Improve virtual register handling when computing debug informationDominic Chen2016-08-111-0/+69
| | | | | | | | | | | | Summary: Some backends, like WebAssembly, use virtual registers instead of physical registers. This crashes the DbgValueHistoryCalculator pass, which assumes that all registers are physical. Instead, skip virtual registers when iterating aliases, and assume that they are clobbered. Reviewers: dexonsmith, dschuff, aprantl Subscribers: yurydelendik, llvm-commits, jfb, sunfish Differential Revision: https://reviews.llvm.org/D22590 llvm-svn: 278371
* [WebAssembly] Add -emscripten-cxx-exceptions-whitelist optionDerek Schuff2016-08-091-0/+62
| | | | | | | | | | | | | | | This patch adds -emscripten-cxx-exceptions-whitelist option to WebAssemblyLowerEmscriptenExceptions pass. This options is the list of function names in which Emscripten-style exception handling is enabled. This is to support emscripten's EXCEPTION_CATCHING_WHITELIST which exists because of the performance impact of emscripten's non-zero-cost EH method. Patch by Heejin Ahn Differential Revision: https://reviews.llvm.org/D23292 llvm-svn: 278171
* [WebAssembly] Fix bugs in WebAssemblyLowerEmscriptenExceptions passDerek Schuff2016-08-091-6/+52
| | | | | | | | | | | | | | | | | | * Delete extra '_' prefixes from JS library function names. fixImports() function in JS glue code deals with this for wasm. * Change command-line option names in order to be consistent with asm.js. * Add missing lowering code for llvm.eh.typeid.for intrinsics * Delete commas in mangled function names * Fix a function argument attributes bug. Because we add the pointer to the original callee as the first argument of invoke wrapper, all argument attribute indices have to be incremented by one. Patch by Heejin Ahn Differential Revision: https://reviews.llvm.org/D23258 llvm-svn: 278081
* [WebAssembly] Fix CFI index to account for padding nullptr functionDerek Schuff2016-08-081-2/+2
| | | | | | | | | | | | | The WebAssembly linker now creates a dummy function at index 0 to prevent miscomparisons with the NULL pointer, see https://github.com/WebAssembly/binaryen/pull/658. Thanks to pcc for pointing out this problem! Patch by Dominic Chen Differential Revision: https://reviews.llvm.org/D23137 llvm-svn: 278073
* [WebAssembly] Check return value of getRegForValue in FastISelDerek Schuff2016-08-041-0/+35
| | | | | | | | | | | | Previously, FastISel for WebAssembly wasn't checking the return value of `getRegForValue` in certain cases, which would generate instructions referencing NoReg. This patch fixes this behavior. Patch by Dominic Chen Differential Revision: https://reviews.llvm.org/D23100 llvm-svn: 277742
* [WebAssembly] Initial SIMD128 support.Derek Schuff2016-08-021-0/+158
| | | | | | | | | | | | | | Kicks off the implementation of wasm SIMD128 support (spec: https://github.com/stoklund/portable-simd/blob/master/portable-simd.md), adding support for add, sub, mul for i8x16, i16x8, i32x4, and f32x4. The spec is WIP, and might change in the near future. Patch by João Porto Differential Revision: https://reviews.llvm.org/D22686 llvm-svn: 277543
* [WebAssembly] Support CFI for WebAssembly targetDerek Schuff2016-08-011-0/+53
| | | | | | | | | | | | | | | Summary: This patch implements CFI for WebAssembly. It modifies the LowerTypeTest pass to pre-assign table indexes to functions that are called indirectly, and lowers type checks to test against the appropriate table indexes. It also modifies the WebAssembly backend to support a special ".indidx" assembly directive that propagates the table index assignments out to the linker. Patch by Dominic Chen Differential Revision: https://reviews.llvm.org/D21768 llvm-svn: 277398
* [WebAssembly] Add asm.js-style exception handling supportDerek Schuff2016-08-011-0/+143
| | | | | | | | | | | | | | | | | | Summary: This patch includes asm.js-style exception handling support for WebAssembly. The WebAssembly MVP does not have any support for unwinding or non-local control flow. In order to support C++ exceptions, emscripten currently uses JavaScript exceptions along with some support code (written in JavaScript) that is bundled by emscripten with the generated code. This scheme lowers exception-related instructions for wasm such that wasm modules can be compatible with emscripten's existing scheme and share the support code. Patch by Heejin Ahn Differential Revision: https://reviews.llvm.org/D22958 llvm-svn: 277391
* [WebAssembly] Emit type signatures for declared functionsDerek Schuff2016-06-031-0/+73
| | | | | | | | | | | | | | | | | | | | | Under emscripten, C code can take the address of a function implemented in Javascript (which is exposed via an import in wasm). Because imports do not have linear memory address in wasm, we need to generate a thunk to be the target of the indirect call; it call the import directly. To make this possible, LLVM needs to emit the type signatures for these functions, because they may not be called directly or referred to other than where the address is taken. This uses s new .s directive (.functype) which specifies the signature. Differential Revision: http://reviews.llvm.org/D20891 Re-apply r271599 but instead of bailing with an error when a declared function has multiple returns, replace it with a pointer argument. Also add the test case I forgot to 'git add' last time around. llvm-svn: 271703
* Revert "[WebAssembly] Emit type signatures for declared functions"Derek Schuff2016-06-021-70/+0
| | | | | | | | This reverts r271599, it broke the integration tests. More places than I expected had nontrival return types in imports, or else the check was wrong. llvm-svn: 271606
* [WebAssembly] Emit type signatures for declared functionsDerek Schuff2016-06-021-0/+70
| | | | | | | | | | | | | | | | | Under emscripten, C code can take the address of a function implemented in Javascript (which is exposed via an import in wasm). Because imports do not have linear memory address in wasm, we need to generate a thunk to be the target of the indirect call; it call the import directly. To make this possible, LLVM needs to emit the type signatures for these functions, because they may not be called directly or referred to other than where the address is taken. This uses s new .s directive (.functype) which specifies the signature. Differential Revision: http://reviews.llvm.org/D20891 llvm-svn: 271599
* [WebAssembly] Put __stack_pointer in the offset field of loads and stores.Dan Gohman2016-05-243-52/+53
| | | | | | | | | | | | | | | | | | | | Instead of this: i32.const $push10=, __stack_pointer i32.load $push11=, 0($pop10) Emit this: i32.const $push10=, 0 i32.load $push11=, __stack_pointer($pop10) It's not currently clear which is better, though there's a chance the second form may be better at overall compression. We can revisit this when we have more data; for now it makes sense to make PEI consistent with isel. Differential Revision: http://reviews.llvm.org/D20411 llvm-svn: 270635
* [WebAssembly] Optimize away return instructions using fallthroughs.Dan Gohman2016-05-2141-49/+90
| | | | | | | | | This saves a small amount of code size, and is a first small step toward passing values on the stack across block boundaries. Differential Review: http://reviews.llvm.org/D20450 llvm-svn: 270294
* [WebAssembly] Make several CHECK lines less fragile using regexes and CHECK-DAG.Dan Gohman2016-05-192-31/+31
| | | | llvm-svn: 270011
* [WebAssembly] Don't expand divisions by constants.Dan Gohman2016-05-181-0/+62
| | | | | | | Don't expand divisions by constants if it would require multiple instructions. The current assumption is that engines will perform the desired optimizations. llvm-svn: 269930
* [WebAssembly] Rename $discard to $drop in the assembly output.Dan Gohman2016-05-1717-122/+122
| | | | llvm-svn: 269862
* [WebAssembly] Model the stack evaluation order more precisely.Dan Gohman2016-05-172-12/+33
| | | | | | | | | | | We currently don't represent get_local and set_local explicitly; they are just implied by virtual register use and def. This avoids a lot of clutter, but it does complicate stackifying: get_locals read their operands at their position in the stack evaluation order, rather than at their parent instruction. This patch adds code to walk the stack to determine the precise ordering, when needed. llvm-svn: 269854
* [WebAssembly] Don't stackify calls past stack pointer modifications.Dan Gohman2016-05-171-1/+15
| | | | llvm-svn: 269843
* [WebAssembly] Stackify induction variable increment instructions.Dan Gohman2016-05-172-14/+44
| | | | | | | This handles instructions where the defined register is also used, as in "x = x + 1". llvm-svn: 269830
* [WebAssembly] Improve the precision of memory and side effect dependence ↵Dan Gohman2016-05-171-2/+34
| | | | | | | | | | tracking. MachineInstr::isSafeToMove is more conservative than is needed here; use a more explicit check, and incorporate knowledge of some WebAssembly-specific opcodes. llvm-svn: 269736
* [WebAssembly] Mark COPY_LOCAL and TEE_LOCAL instructions has having no side ↵Dan Gohman2016-05-161-3/+5
| | | | | | effects. llvm-svn: 269683
* [WebAssembly] Use eqz to negate a branch conditions.Dan Gohman2016-05-161-2/+1
| | | | llvm-svn: 269681
* [WebAssembly] Fix legalization of i128 shifts.Dan Gohman2016-05-141-0/+280
| | | | | | | | compiler-rt/libgcc shift routines expect the shift count to be an i32, so use i32 as the shift count for shifts that are legalized to libcalls. This also reverts r268991, now that the signatures are correct. llvm-svn: 269531
* [WebAssembly] Fast-isel support for calls, arguments, and selects.Dan Gohman2016-05-122-1/+2
| | | | llvm-svn: 269273
* [WebAssembl] Implement enough of fast-isel to run the comparison tests.Dan Gohman2016-05-112-0/+2
| | | | llvm-svn: 269203
* [WebAssembly] Preliminary fast-isel support.Dan Gohman2016-05-108-5/+38
| | | | llvm-svn: 269083
* [WebAssembly] Move register stackification and coloring to a late phase.Dan Gohman2016-05-107-151/+173
| | | | | | | | | | | | | | | | | | | Move the register stackification and coloring passes to run very late, after PEI, tail duplication, and most other passes. This means that all code emitted and expanded by those passes is now exposed to these passes. This also eliminates the need for prologue/epilogue code to be manually stackified, which significantly simplifies the code. This does require running LiveIntervals a second time. It's useful to think of these late passes not as late optimization passes, but as a domain-specific compression algorithm based on knowledge of liveness information. It's used to compress the code after all conventional optimizations are complete, which is why it uses LiveIntervals at a phase when actual optimization passes don't typically need it. Differential Revision: http://reviews.llvm.org/D20075 llvm-svn: 269012
* [WebAssembly] Don't emit epilogue code in the middle of stackified code.Dan Gohman2016-05-051-0/+12
| | | | llvm-svn: 268679
* [WebAssembly] Rename memory_size intrinsic to current_memoryDerek Schuff2016-05-022-10/+10
| | | | | | This follows the recent renaming in the wasm spec. llvm-svn: 268255
* [WebAssembly] Account for implicit operands when computing operand indices.Dan Gohman2016-04-261-1/+7
| | | | llvm-svn: 267511
* [WebAssembly] Limit alignment hints to natural alignment.Dan Gohman2016-04-213-17/+21
| | | | | | This follows the current binary format rules. llvm-svn: 267082
* Let the DISubprogram in this test point to the right compile unit.Adrian Prantl2016-04-151-1/+1
| | | | llvm-svn: 266468
* Update testcase to new debug metadata format.Adrian Prantl2016-04-151-3/+2
| | | | llvm-svn: 266467
* [WebAssembly] Fix debug info in reg-stackify.ll testDerek Schuff2016-04-121-18/+23
| | | | | | It lacked a CU and thus became invalid with r266102 llvm-svn: 266114
* WebAssembly: fix cfg-stackify testJF Bastien2016-04-051-10/+10
| | | | | | It was broken by reshuffling induced by r265397 'Don't delete empty preheaders in CodeGenPrepare if it would create a critical edge'. llvm-svn: 265415
* [WebAssembly] Implement the rotate instructions.Dan Gohman2016-03-222-0/+108
| | | | llvm-svn: 264076
* [WebAssembly] Implement the eqz instructions.Dan Gohman2016-03-212-0/+22
| | | | llvm-svn: 263976
* [WebAssembly] Stackify code emitted by eliminateFrameIndex and SP writebackDerek Schuff2016-03-173-41/+41
| | | | | | | | | | | | | | | | | Summary: MRI::eliminateFrameIndex can emit several instructions to do address calculations; these can usually be stackified. Because instructions with FI operands can have subsequent operands which may be expression trees, find the top of the leftmost tree and insert the code before it, to keep the LIFO property. Also use stackified registers when writing back the SP value to memory in the epilog; it's unnecessary because SP will not be used after the epilog, and it results in better code. Differential Revision: http://reviews.llvm.org/D18234 llvm-svn: 263725
* [WebAssembly] Implement irreducible control flow.Dan Gohman2016-03-091-0/+88
| | | | | | | | This implements a very simple conservative transformation that doesn't require more than linear code size growth. There's room for much more optimization in this space. llvm-svn: 262982
* [WebAssembly] Update for spec change from tableswitch to br_table.Dan Gohman2016-03-082-4/+4
| | | | | | | Also note that the operand order changed; the default label is now listed after the regular labels. llvm-svn: 262903
* WebAssembly: fix testJF Bastien2016-02-281-10/+10
| | | | | | Operand order seems to have changed, the new one is nicer. llvm-svn: 262180
* Revert "[WebAssembly] Stackify code emitted by eliminateFrameIndex"Derek Schuff2016-02-233-21/+21
| | | | | | This reverts r261685 due to wasm test breakage. llvm-svn: 261702
* [WebAssembly] Stackify code emitted by eliminateFrameIndexDerek Schuff2016-02-233-21/+21
| | | | llvm-svn: 261685
* [WebAssembly] Implement red zone for user stackDerek Schuff2016-02-231-21/+37
| | | | | | | | | | | Implements a mostly-conventional redzone for the userspace stack. Because we have unsigned load/store offsets we continue to use a local SP subtracted from the incoming SP but do not write it back to memory. Differential Revision: http://reviews.llvm.org/D17525 llvm-svn: 261662
* [WebAssembly] Fix writeback of stack pointer with dynamic allocaDerek Schuff2016-02-221-5/+12
| | | | | | | | | | | Previously the stack pointer was only written back to memory in the prolog. But this is wrong for dynamic allocas, for which target-independent codegen handles SP updates after the prolog (and possibly even in another BB). Instead update the SP global in ADJCALLSTACKDOWN which is generated after the SP update sequence. This will have further refinements when we add red zone support. llvm-svn: 261579
* [WebAssembly] Teach address folding to fold bitwise-or nodes.Dan Gohman2016-02-221-0/+21
| | | | | | | | | LLVM converts adds into ors when it can prove that the operands don't share any non-zero bits. Teach address folding to recognize or instructions with constant operands with this property that can be folded into addresses as if they were adds. llvm-svn: 261562
OpenPOWER on IntegriCloud