summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/WebAssembly
Commit message (Collapse)AuthorAgeFilesLines
* [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
* [WebAssembly] Properly ignore llvm.dbg.value instructions.Dan Gohman2016-02-221-0/+18
| | | | llvm-svn: 261538
* [WebAssembly] Support physical registers in the rewrite-to-discard optimization.Dan Gohman2016-02-211-10/+10
| | | | llvm-svn: 261465
* [WebAssembly] Handle CopyToReg nodes with flag results in LowerCopyToReg.Dan Gohman2016-02-201-0/+12
| | | | llvm-svn: 261457
* [WebAssembly] Write stack pointer back to memory when FP is usedDerek Schuff2016-02-201-1/+4
| | | | | | | | The stack pointer is bumped when there is a frame pointer or when there are static-size objects, but was only getting written back when there were static-size objects. llvm-svn: 261453
* [WebAssembly] Stackify function prologs and epilogsDerek Schuff2016-02-203-87/+90
| | | | | | | | The instructions are the same, but fewer locals are used. Differential Revision: http://reviews.llvm.org/D17428 llvm-svn: 261452
* [WebAssembly] Don't use setRequiresStructuredCFG(true).Dan Gohman2016-02-181-37/+28
| | | | | | | | | | | | While we still do want reducible control flow, the RequiresStructuredCFG flag imposes more strict structure constraints than WebAssembly wants. Unsetting this flag enables critical edge splitting and tail merging. Also, disable TailDuplication explicitly, as it doesn't support virtual registers, and was previously only disabled by the RequiresStructuredCFG flag. llvm-svn: 261190
* [WebAssembly] Call memcpy for large byval copies.Dan Gohman2016-02-171-17/+14
| | | | | | | | | | This fixes very slow compilation on test/CodeGen/Generic/2010-11-04-BigByval.ll . Note that MaxStoresPerMemcpy and friends are not yet carefully tuned so the cutoff point is currently somewhat arbitrary. However, it's important that there be a cutoff point so that we don't emit unbounded quantities of loads and stores. llvm-svn: 261050
* [WebAssembly] Implement __builtin_frame_address.Dan Gohman2016-02-161-0/+31
| | | | | | Differential Revision: http://reviews.llvm.org/D17307 llvm-svn: 261032
* [WebAssemly] Don't move calls or stores past intervening loadsDerek Schuff2016-02-161-0/+39
| | | | | | | | | | The register stackifier currently checks for intervening stores (and loads that may alias them) but doesn't account for the fact that the instruction being moved may affect intervening loads. Differential Revision: http://reviews.llvm.org/D17298 llvm-svn: 261014
* [WebAssembly] Insert COPY_LOCAL between CopyToReg and FrameIndex DAG nodesDerek Schuff2016-02-161-0/+21
| | | | | | | | | | | | | | CopyToReg nodes don't support FrameIndex operands. Other targets select the FI to some LEA-like instruction, but since we don't have that, we need to insert some kind of instruction that can take an FI operand and produces a value usable by CopyToReg (i.e. in a vreg). So insert a dummy copy_local between Op and its FI operand. This results in a redundant copy which we should optimize away later (maybe in the post-FI-lowering peephole pass). Differential Revision: http://reviews.llvm.org/D17213 llvm-svn: 260987
* [WebAssembly] Switch from RPO sorting to topological sorting.Dan Gohman2016-02-161-87/+133
| | | | | | | | | | WebAssembly doesn't require full RPO; topological sorting is sufficient and can preserve more of the MachineBlockPlacement ordering. Unfortunately, this still depends a lot on heuristics, because while we use the MachineBlockPlacement ordering as a guide, we can't use it in places where it isn't topologically ordered. This area will require further attention. llvm-svn: 260978
* [WebAssembly] Create new registers instead of reusing old ones in RegStackify.Dan Gohman2016-02-162-30/+73
| | | | | | | | This avoids some complications updating LiveIntervals to be aware of the new register lifetimes, because we can just compute new intervals from scratch rather than describe how the old ones have been changed. llvm-svn: 260971
* [WebAssembly] Implement support for custom NaN bit patterns.Dan Gohman2016-02-161-0/+35
| | | | llvm-svn: 260968
* [WebAssembly] Fix byval for empty types.Dan Gohman2016-02-121-0/+19
| | | | llvm-svn: 260740
* [WebAssembly] Fix insertion of a BLOCK in a loop header that also ends a BLOCK.Dan Gohman2016-02-121-0/+62
| | | | llvm-svn: 260737
* [WebAssembly] Switch varags calling convention to use a registerDerek Schuff2016-02-101-8/+30
| | | | | | | | | | | | Instead of passing varargs directly on the user stack, allocate a buffer in the caller's stack frame and pass a pointer to it. This simplifies the C ABI (e.g. non-C callers of C functions do not need to use C's user stack if they have their own mechanism) and allows further optimizations in the future (e.g. fewer functions may need to use the stack). Differential Revision: http://reviews.llvm.org/D17048 llvm-svn: 260421
* [WebAssembly] Update the br_if instructions' operand orders to match the spec.Dan Gohman2016-02-082-101/+101
| | | | llvm-svn: 260152
* [WebAssembly] Update the select instructions' operand orders to match the spec.Dan Gohman2016-02-051-12/+12
| | | | llvm-svn: 259893
* [WebAssembly] Fix uses of FrameIndex as store valuesDerek Schuff2016-01-301-3/+12
| | | | | | | | Previously the code assumed all uses of FI on loads and stores were as addresses. This checks whether the use is the address or a value and handles the latter case as it does for non-memory instructions. llvm-svn: 259306
* WebAssembly: don't optimize frameindex storeJF Bastien2016-01-301-0/+10
| | | | | | | | The previous code was incorrect (can't getReg a frameindex). We could instead optimize it to reduce tree height, but I'm not sure that's worthwhile yet because we then try to eliminate the frameindex. This patch also fixes frame index elimination for operations which may load or store: it used to assume the base was operand 2 and immediate offset operand 1. That's not true for stores, where they're 4 and 3. llvm-svn: 259305
* [WebAssembly] Refine block placement to insert blocks between trees.Dan Gohman2016-01-301-4/+4
| | | | | | | | | Refine the test for whether an instruction is in an expression tree so that it detects when one tree ends and another begins, so we can place a block at that point, rather than continuing to find the first instruction not in a tree at all. llvm-svn: 259294
* [WebAssembly] Support frame pointerDerek Schuff2016-01-291-3/+30
| | | | | | | | | Add support for frame pointer use in prolog/epilog. Supports dynamic allocas but not yet over-aligned locals. Target-independend CG generates SP updates, but we still need to write back the SP value to memory when necessary. llvm-svn: 259220
* [WebAssembly] Don't stackify a register def past a get_local use in the same ↵Dan Gohman2016-01-281-0/+21
| | | | | | tree. llvm-svn: 259013
* [WebAssembly] Enhanced register stackificationDan Gohman2016-01-283-24/+127
| | | | | | | | | | | This patch revamps the RegStackifier pass with a new tree traversal mechanism, enabling three major new features: - Stackification of values with multiple uses, using the result value of set_local - More aggressive stackification of instructions with side effects - Reordering operands in commutative instructions to enable more stackification. llvm-svn: 259009
* [WebAssembly] Implement byval argumentsDerek Schuff2016-01-271-0/+105
| | | | | | | | | | Summary: Just does the simple allocation of a stack object and passes a pointer to the callee. Differential Revision: http://reviews.llvm.org/D16610 llvm-svn: 258989
* [WebAssembly] Add a test for the mem-intrinsic code in WebAssemblyPeephole.cppDan Gohman2016-01-271-0/+31
| | | | llvm-svn: 258895
* [WebAssembly] Omit no-op adds for non-mem uses of FrameIndexDerek Schuff2016-01-262-0/+23
| | | | | | Differential Revision: http://reviews.llvm.org/D16554 llvm-svn: 258872
* WebAssembly: don't optimize memcpy/memmove/memcpy to frame indexJF Bastien2016-01-261-0/+11
| | | | | | r258781 optimized memcpy/memmove/memcpy so the intrinsic call can return its first argument, but missed the frame index case. Teach it to ignore that case so C code doesn't assert out in these cases. llvm-svn: 258851
* [WebAssembly] Optimize memcpy/memmove/memcpy calls.Dan Gohman2016-01-262-2/+62
| | | | | | | | These calls return their first argument, but because LLVM uses an intrinsic with a void return type, they can't use the returned attribute. Generalize the store results pass to optimize these calls too. llvm-svn: 258781
* [WebAssembly] Implement unaligned loads and stores.Dan Gohman2016-01-264-10/+556
| | | | | | Differential Revision: http://reviews.llvm.org/D16534 llvm-svn: 258779
* [MC] Use .p2align instead of .alignDan Gohman2016-01-261-15/+15
| | | | | | | | | | | | | | | For historic reasons, the behavior of .align differs between targets. Fortunately, there are alternatives, .p2align and .balign, which make the interpretation of the parameter explicit, and which behave consistently across targets. This patch teaches MC to use .p2align instead of .align, so that people reading code for multiple architectures don't have to remember which way each platform does its .align directive. Differential Revision: http://reviews.llvm.org/D16549 llvm-svn: 258750
* [WebAssembly] Fix unbalanced register stack code in the case of late DCE.Dan Gohman2016-01-251-2/+2
| | | | | | | Instructions can be DCE'd after the RegStackify pass. If the instruction which would be the pop for what would be a push is removed, don't use a push. llvm-svn: 258694
* [WebAssembly] Add tests for negative offsets with global variable addresses.Dan Gohman2016-01-251-0/+18
| | | | llvm-svn: 258693
* [SelectionDAG] Use the correct return type for memcpy, memmove, and memset.Dan Gohman2016-01-251-1/+1
| | | | | | | | | | | | | When generating calls to memcpy, memmove, and memset, use void* as the return type rather than void, to match the standard signatures for these functions. This has no practical effect for most targets, since the return values of these calls aren't being used anyway, and most calling conventions tolerate this kind of mismatch. However, this change will help support future optimizations to utilize the return value to avoid holding the argument value live across a call. llvm-svn: 258691
* [SelectionDAG] Fold more offsets into GlobalAddressesDan Gohman2016-01-221-0/+672
| | | | | | | | This reapplies r258296 and r258366, and also fixes an existing bug in SelectionDAG.cpp's isMemSrcFromString, neglecting to account for the offset in a GlobalAddressSDNode, which is uncovered by those patches. llvm-svn: 258482
* Revert "[SelectionDAG] Fold more offsets into GlobalAddresses"Reid Kleckner2016-01-221-672/+0
| | | | | | | | | | | | | | This reverts r258296 and the follow up r258366. With this change, we miscompiled the following program on Windows: #include <string> #include <iostream> static const char kData[] = "asdf jkl;"; int main() { std::string s(kData + 3, sizeof(kData) - 3); std::cout << s << '\n'; } llvm-svn: 258465
* [SelectionDAG] Fold more offsets into GlobalAddressesDan Gohman2016-01-201-0/+672
| | | | | | | | | | | | | | | | | | SelectionDAG previously missed opportunities to fold constants into GlobalAddresses in several areas. For example, given `(add (add GA, c1), y)`, it would often reassociate to `(add (add GA, y), c1)`, missing the opportunity to create `(add GA+c, y)`. This isn't often visible on targets such as X86 which effectively reassociate adds in their complex address-mode folding logic, however it is currently visible on WebAssembly since it currently has very simple address mode folding code that doesn't reassociate anything. This patch fixes this by making SelectionDAG fold offsets into GlobalAddresses at the same times that it folds constants together, so that it doesn't miss any opportunities to perform such folding. Differential Revision: http://reviews.llvm.org/D16090 llvm-svn: 258296
OpenPOWER on IntegriCloud