summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/WebAssembly
Commit message (Collapse)AuthorAgeFilesLines
...
* [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
* [WebAssembly] Tighten up some regexes in some tests.Dan Gohman2016-01-204-80/+80
| | | | llvm-svn: 258295
* [WebAssembly] Don't stackify stores across instructions with side effects.Dan Gohman2016-01-202-12/+36
| | | | llvm-svn: 258285
* [WebAssembly] Rematerialize constants rather than hold them live in registers.Dan Gohman2016-01-198-60/+81
| | | | | | | | | Teach the register stackifier to rematerialize constants that have multiple uses instead of leaving them in registers. In the WebAssembly encoding, it's the same code size to materialize most constants as it is to read a value from a register. llvm-svn: 258142
* [WebAssembly] Change a FIXME to a TODO in a comment.Dan Gohman2016-01-191-1/+1
| | | | llvm-svn: 258139
* [WebAssembly] Re-enable this test, now that interactions with the coalescer ↵Dan Gohman2016-01-191-3/+8
| | | | | | are resolved. llvm-svn: 258138
* [WebAssembly] Re-enable loop idiom recognition for memcpy et al.Dan Gohman2016-01-191-53/+0
| | | | llvm-svn: 258125
* [WebAssembly] Don't create a needless .note.GNU-stack sectionDan Gohman2016-01-151-0/+9
| | | | | | | | | | WebAssembly's stack will never be executable by default, so it isn't necessary to declare .note.GNU-stack sections to request a non-executable stack. Differential Revision: http://reviews.llvm.org/D15969 llvm-svn: 257962
* [WebAssembly] Re-enable a test.Dan Gohman2016-01-151-4/+1
| | | | | | | Out-of-tree projects that don't support this can disable the test for themselves rather than having it disabled in LLVM itself. llvm-svn: 257960
* [WebAssembly] MCFixupKindInfo's TargetSize is in bits rather than bytes.Dan Gohman2016-01-131-0/+14
| | | | llvm-svn: 257655
* [WebAssembly] Fix a test to work even when the integrated assembler is enabled.Dan Gohman2016-01-121-2/+3
| | | | | | | Add -no-integrated-as to this test, since it's testing inline asm strings that aren't actually valid assembly syntax. llvm-svn: 257519
* [WebAssembly] Add a EM_WEBASSEMBLY value, and several bits of code that use it.Dan Gohman2016-01-121-0/+1
| | | | | | | | | A request has been made to the official registry, but an official value is not yet available. This patch uses a temporary value in order to support development. When an official value is recieved, the value of EM_WEBASSEMBLY will be updated. llvm-svn: 257517
* [WebAssembly] Make CFG stackification independent of basic-block labels.Dan Gohman2016-01-123-264/+380
| | | | | | | | | | | | | | | | | | | | | | | This patch changes the way labels are referenced. Instead of referencing the basic-block label name (eg. .LBB0_0), instructions now just have an immediate which indicates the depth in the control-flow stack to find a label to jump to. This makes them much closer to what we expect to have in the binary encoding, and avoids the problem of basic-block label names not being explicit in the binary encoding. Also, it terminates blocks and loops with end_block and end_loop instructions, rather than basic-block label names, for similar reasons. This will also fix problems where two constructs appear to have the same label, because we no longer explicitly use labels, so consumers that need labels will presumably create their own labels, and presumably they won't reuse labels when they do. This patch does make the code a little more awkward to read; as a partial mitigation, this patch also introduces comments showing where the labels are, and comments on each branch showing where it's branching to. llvm-svn: 257505
* [WebAssembly] Define WebAssembly-specific relocation codes.Dan Gohman2016-01-1111-36/+36
| | | | | | | | Currently WebAssembly has two kinds of relocations; data addresses and function addresses. This adds ELF relocations for them, as well as an MC symbol kind to indicate which type of relocation is needed. llvm-svn: 257416
OpenPOWER on IntegriCloud