summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/WebAssembly
Commit message (Collapse)AuthorAgeFilesLines
...
* [WebAssembly] Handle debug information and virtual registers without crashingDominic Chen2016-08-173-3/+5
| | | | | | | | | | | | Summary: Currently, enabling debug information when compiling for WebAssembly crashes the backend. This commit fixes these by skipping debug values in backend passes. Reviewers: jfb, aprantl, dschuff, echristo Subscribers: mehdi_amini, yurydelendik, dexonsmith, MatzeB, jfb, dschuff, llvm-commits Differential Revision: https://reviews.llvm.org/D21808 llvm-svn: 278967
* [WebAssembly] Plug MachineMemOperand leaks.Benjamin Kramer2016-08-121-6/+6
| | | | llvm-svn: 278545
* Use the range variant of remove_if instead of unpacking begin/endDavid Majnemer2016-08-121-1/+1
| | | | | | No functionality change is intended. llvm-svn: 278475
* [WebAssembly] Cleanup trailing whitespaceDominic Chen2016-08-111-2/+2
| | | | | | | | | | Summary: Test for commit access. Subscribers: jfb, dschuff Differential Revision: https://reviews.llvm.org/D23392 llvm-svn: 278313
* [WebAssembly] Add -emscripten-cxx-exceptions-whitelist optionDerek Schuff2016-08-091-2/+15
| | | | | | | | | | | | | | | 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-092-34/+93
| | | | | | | | | | | | | | | | | | * 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] Check return value of getRegForValue in FastISelDerek Schuff2016-08-041-0/+13
| | | | | | | | | | | | 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] Remove unnecessary subtarget checks in peephole passDerek Schuff2016-08-021-22/+13
| | | | | | | Leftover from D22686; the passes can handle all the instructions unconditionally; only isel needs to care whether to generate them. llvm-svn: 277549
* [WebAssembly] Initial SIMD128 support.Derek Schuff2016-08-0216-14/+243
| | | | | | | | | | | | | | 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] Remove a README.txt entry that is now implemented.Dan Gohman2016-08-021-6/+0
| | | | llvm-svn: 277467
* [WebAssembly] Support CFI for WebAssembly targetDerek Schuff2016-08-014-3/+28
| | | | | | | | | | | | | | | 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-014-0/+477
| | | | | | | | | | | | | | | | | | 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
* MachineFunction: Return reference for getFrameInfo(); NFCMatthias Braun2016-07-283-22/+22
| | | | | | | getFrameInfo() never returns nullptr so we should use a reference instead of a pointer. llvm-svn: 277017
* [WebAssembly] Update for Target API (TargetRegistry::RegisterMCAsmBackend) ↵David Blaikie2016-07-251-1/+2
| | | | | | change llvm-svn: 276694
* Fix calls to SelectionDAG::getStoreDerek Schuff2016-07-151-2/+2
| | | | | | It was refactored in r275592. NFC llvm-svn: 275601
* Rename AnalyzeBranch* to analyzeBranch*.Jacques Pienaar2016-07-152-2/+2
| | | | | | | | | | | | Summary: NFC. Rename AnalyzeBranch/AnalyzeBranchPredicate to analyzeBranch/analyzeBranchPredicate to follow LLVM coding style and be consistent with TargetInstrInfo's analyzeCompare and analyzeSelect. Reviewers: tstellarAMD, mcrosier Subscribers: mcrosier, jholewinski, jfb, arsenm, dschuff, jyknight, dsanders, nemanjai Differential Revision: https://reviews.llvm.org/D22409 llvm-svn: 275564
* Fix branch relaxation in 16-bit mode.Nirav Dave2016-07-111-1/+2
| | | | | | | | | | | | | | | Thread through MCSubtargetInfo to relaxInstruction function allowing relaxation to generate jumps with 16-bit sized immediates in 16-bit mode. This fixes PR22097. Reviewers: dwmw2, tstellarAMD, craig.topper, jyknight Subscribers: jfb, arsenm, jyknight, llvm-commits, dsanders Differential Revision: http://reviews.llvm.org/D20830 llvm-svn: 275068
* WebAssembly: Avoid implicit iterator conversions, NFCDuncan P. N. Exon Smith2016-07-083-33/+30
| | | | | | | | Avoid implicit conversions from MachineInstrBundleIterator to MachineInstr* in the WebAssembly backend by preferring MachineInstr& over MachineInstr*. llvm-svn: 274912
* Delete MCCodeGenInfo.Rafael Espindola2016-06-301-9/+3
| | | | | | | MC doesn't really care about CodeGen stuff, so this was just complicating target initialization. llvm-svn: 274258
* CodeGen: Use MachineInstr& in TargetInstrInfo, NFCDuncan P. N. Exon Smith2016-06-303-29/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is mostly a mechanical change to make TargetInstrInfo API take MachineInstr& (instead of MachineInstr* or MachineBasicBlock::iterator) when the argument is expected to be a valid MachineInstr. This is a general API improvement. Although it would be possible to do this one function at a time, that would demand a quadratic amount of churn since many of these functions call each other. Instead I've done everything as a block and just updated what was necessary. This is mostly mechanical fixes: adding and removing `*` and `&` operators. The only non-mechanical change is to split ARMBaseInstrInfo::getOperandLatencyImpl out from ARMBaseInstrInfo::getOperandLatency. Previously, the latter took a `MachineInstr*` which it updated to the instruction bundle leader; now, the latter calls the former either with the same `MachineInstr&` or the bundle leader. As a side effect, this removes a bunch of MachineInstr* to MachineBasicBlock::iterator implicit conversions, a necessary step toward fixing PR26753. Note: I updated WebAssembly, Lanai, and AVR (despite being off-by-default) since it turned out to be easy. I couldn't run tests for AVR since llc doesn't link with it turned on. llvm-svn: 274189
* Fix the wasm build by including EndianStream.hReid Kleckner2016-06-231-0/+1
| | | | llvm-svn: 273591
* Pass DebugLoc and SDLoc by const ref.Benjamin Kramer2016-06-125-11/+11
| | | | | | | | This used to be free, copying and moving DebugLocs became expensive after the metadata rewrite. Passing by reference eliminates a ton of track/untrack operations. No functionality change intended. llvm-svn: 272512
* Remove dead function with incredibly broken assert.Benjamin Kramer2016-06-061-6/+0
| | | | | | Found by clang-tidy's misc-assert-side-effect. llvm-svn: 271887
* [WebAssembly] Emit type signatures for declared functionsDerek Schuff2016-06-033-10/+56
| | | | | | | | | | | | | | | | | | | | | 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-023-50/+10
| | | | | | | | 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-023-10/+50
| | | | | | | | | | | | | | | | | 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-241-10/+10
| | | | | | | | | | | | | | | | | | | | 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] Basic TargetTransformInfo support for SIMD128.Dan Gohman2016-05-232-1/+65
| | | | llvm-svn: 270508
* [WebAssembly] Speed up LiveIntervals updating.Dan Gohman2016-05-231-6/+9
| | | | | | | | Use the more specific LiveInterval::removeSegment instead of LiveInterval::shrinkToUses when we know the specific range that's being removed. llvm-svn: 270463
* [WebAssembly] Optimize away return instructions using fallthroughs.Dan Gohman2016-05-216-10/+111
| | | | | | | | | 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] Simplify code that never has to handle physical registers. NFC.Dan Gohman2016-05-191-9/+2
| | | | llvm-svn: 270137
* [WebAssembly] Update WebAssembly target for r269988.Dan Gohman2016-05-192-4/+11
| | | | llvm-svn: 270017
* [WebAssembly] Disable the MachineScheduler.Dan Gohman2016-05-182-1/+14
| | | | llvm-svn: 269976
* [WebAssembly] Don't expand divisions by constants.Dan Gohman2016-05-182-0/+7
| | | | | | | 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-174-13/+12
| | | | llvm-svn: 269862
* [WebAssembly] Model the stack evaluation order more precisely.Dan Gohman2016-05-171-20/+40
| | | | | | | | | | | 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-172-20/+41
| | | | llvm-svn: 269843
* [WebAssembly] Stackify induction variable increment instructions.Dan Gohman2016-05-171-28/+65
| | | | | | | This handles instructions where the defined register is also used, as in "x = x + 1". llvm-svn: 269830
* [WebAssembly] Remove our copy of PrologEpilogInserterDerek Schuff2016-05-173-1060/+0
| | | | | | It's no longer needed after r269750 llvm-svn: 269756
* Factor PrologEpilogInserter around spilling, frame finalization, and scavengingDerek Schuff2016-05-172-8/+2
| | | | | | | | | | | | | | | PrologEpilogInserter has these 3 phases, which are related, but not all of them are needed by all targets. This patch reorganizes PEI's varous functions around those phases for more clear separation. It also introduces a new TargetMachine hook, usesPhysRegsForPEI, which is true for non-virtual targets. When it is true, all the phases operate as before, and PEI requires the AllVRegsAllocated property on MachineFunctions. Otherwise, CSR spilling and scavenging are skipped and only prolog/epilog insertion/frame finalization is done. Differential Revision: http://reviews.llvm.org/D18366 llvm-svn: 269750
* [WebAssembly] Improve the precision of memory and side effect dependence ↵Dan Gohman2016-05-171-23/+192
| | | | | | | | | | 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-0/+2
| | | | | | effects. llvm-svn: 269683
* [WebAssembly] Use eqz to negate a branch conditions.Dan Gohman2016-05-161-8/+2
| | | | llvm-svn: 269681
* [WebAssembly] Add a few optimization ideas to README.txt.Dan Gohman2016-05-161-0/+15
| | | | llvm-svn: 269677
* [WebAssembly] Fix legalization of i128 shifts.Dan Gohman2016-05-141-9/+4
| | | | | | | | 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] Update expected torture test failuresDerek Schuff2016-05-141-2/+2
| | | | | | NFC; the waterfall just changed the way they are built. llvm-svn: 269523
* SDAG: Implement Select instead of SelectImpl in WebAssemblyDAGToDAGISelJustin Bogner2016-05-131-14/+4
| | | | | | | | | This backend doesn't do anything custom here yet, so we just modernize the boilerplate. Part of llvm.org/pr26808. llvm-svn: 269506
* [WebAssembly] Fast-isel support for calls, arguments, and selects.Dan Gohman2016-05-123-55/+331
| | | | llvm-svn: 269273
* [WebAssembl] Implement enough of fast-isel to run the comparison tests.Dan Gohman2016-05-111-98/+389
| | | | llvm-svn: 269203
* [WebAssembly] Preliminary fast-isel support.Dan Gohman2016-05-101-4/+542
| | | | llvm-svn: 269083
OpenPOWER on IntegriCloud