summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/WebAssembly/userstack.ll
Commit message (Collapse)AuthorAgeFilesLines
* [WebAssembly] Update CodeGen test expectations after rL354697. NFCSam Clegg2019-02-231-31/+31
| | | | llvm-svn: 354705
* [WebAssembly] Massive instruction renamingThomas Lively2019-01-081-67/+67
| | | | | | | | | | | | | | | Summary: An automated renaming of all the instructions listed at https://github.com/WebAssembly/spec/issues/884#issuecomment-426433329 as well as some similarly-named identifiers. Reviewers: aheejin, dschuff, aardappel Subscribers: sbc100, jgravelle-google, eraman, sunfish, jfb, llvm-commits Differential Revision: https://reviews.llvm.org/D56338 llvm-svn: 350609
* [WebAssembly] replaced .param/.result by .functypeWouter van Oortmerssen2018-11-191-1/+1
| | | | | | | | | | | | | | | | | | | | | Summary: This makes it easier/cleaner to generate a single signature from this directive. Also: - Adds the symbol name, such that we don't depend on the location of this directive anymore. - Actually constructs the signature in the assembler, and make the assembler own it. - Refactor the use of MVT vs ValType in the streamer and assembler to require less conversions overall. - Changed 700 or so tests to use it. Reviewers: sbc100, dschuff Subscribers: jgravelle-google, eraman, aheejin, sunfish, jfb, llvm-commits Differential Revision: https://reviews.llvm.org/D54652 llvm-svn: 347228
* [WebAssembly] Added a .globaltype directive to .s output.Wouter van Oortmerssen2018-11-021-0/+2
| | | | | | | | | | | | | | | | | | | | | | | Summary: Assembly output can use globals like __stack_pointer implicitly, but has no way of indicating the type of such a global, which makes it hard for tools processing it (such as the MC Assembler) to reconstruct this information. The improved assembler directives parsing (in progress in https://reviews.llvm.org/D53842) will make use of this information. Also deleted code for the .import_global directive which was unused. New test case in userstack.ll Reviewers: dschuff, sbc100 Subscribers: jgravelle-google, aheejin, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D54012 llvm-svn: 345917
* [WebAssembly] Added default stack-only instruction mode for MC.Wouter van Oortmerssen2018-08-271-1/+1
| | | | | | | | | | | | | | | | | | | | | Summary: Made it convert from register to stack based instructions, and removed the registers. Fixes to related code that was expecting register based instructions. Added the correct testing flag to all tests, depending on what the format they were expecting so far. Translated one test to stack format as example: reg-stackify-stack.ll tested: llvm-lit -v `find test -name WebAssembly` unittests/MC/* Reviewers: dschuff, sunfish Subscribers: sbc100, jgravelle-google, eraman, aheejin, llvm-commits, jfb Differential Revision: https://reviews.llvm.org/D51241 llvm-svn: 340750
* Revert "[WebAssembly] Added default stack-only instruction mode for MC."Wouter van Oortmerssen2018-08-131-1/+1
| | | | | | This reverts commit 917a99b71ce21c975be7bfbf66f4040f965d9f3c. llvm-svn: 339630
* [WebAssembly] Added default stack-only instruction mode for MC.Wouter van Oortmerssen2018-08-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Summary: Moved Explicit Locals pass to last. Made that pass obligatory. Made it convert from register to stack based instructions, and removed the registers. Fixes to related code that was expecting register based instructions. Added the correct testing flag to all tests, depending on what the format they were expecting so far. Translated one test to stack format as example: reg-stackify-stack.ll tested: llvm-lit -v `find test -name WebAssembly` unittests/MC/* Reviewers: dschuff, sunfish Subscribers: jfb, llvm-commits, aheejin, eraman, jgravelle-google, sbc100 Differential Revision: https://reviews.llvm.org/D50568 llvm-svn: 339474
* [WebAssembly] Cleanup of the way globals and global flags are handledNicholas Wilson2018-08-031-26/+26
| | | | | | Differential Revision: https://reviews.llvm.org/D44030 llvm-svn: 338894
* Revert "[WebAssembly] Added default stack-only instruction mode for MC."Wouter van Oortmerssen2018-07-271-2/+2
| | | | | | | This reverts commit d3c9af4179eae7793d1487d652e2d4e23844555f. (SVN revision 338164) llvm-svn: 338176
* [WebAssembly] Added default stack-only instruction mode for MC.Wouter van Oortmerssen2018-07-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | Summary: Moved Explicit Locals pass to last. Made that pass obligatory. Made it convert from register to stack based instructions, and removed the registers. Fixes to related code that was expecting register based instructions. Added the correct testing flag to all tests, depending on what the format they were expecting so far. Translated one test to stack format as example: reg-stackify-stack.ll tested: llvm-lit -v `find test -name WebAssembly` unittests/MC/* Reviewers: dschuff, sunfish Subscribers: sbc100, jgravelle-google, eraman, aheejin, llvm-commits Differential Revision: https://reviews.llvm.org/D49160 llvm-svn: 338164
* [WebAsembly] Update default triple in test files to wasm32-unknown-unkown.Sam Clegg2018-05-101-1/+1
| | | | | | | | | | Summary: The final -wasm component has been the default for some time now. Subscribers: jfb, dschuff, jgravelle-google, eraman, aheejin, JDevlieghere, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D46342 llvm-svn: 332007
* Revert r308273 to reinstate part of r308100.Chandler Carruth2017-07-191-5/+5
| | | | | | | | | That part was reverted because the underlying change necessitating it (r308025) was reverted in r308271. Nirav re-landed r308025 again in r308350, so re-landing this fix. llvm-svn: 308418
* Revert part of r308100 since the cause (r308025) was also reverted.Chandler Carruth2017-07-181-5/+5
| | | | | | | | | | The commit r308100 updated WebAssembly tests for r308025. In one case it merely made the test more resilient but in another case it made a substantive update. Because r308025 was reverted in r308271, these changes to the test also need to be reverted. They should be folded into the recommit of r308025 when it is ready. llvm-svn: 308273
* [wasm] Update two tests for r308025 which causes scheduling changes dueChandler Carruth2017-07-151-5/+5
| | | | | | to the newly improved AA information. llvm-svn: 308100
* [WebAssembly] Use __stack_pointer global when writing wasm binarySam Clegg2017-06-161-26/+26
| | | | | | | | | | | | | | | | | | This ensures that symbolic relocations are generated for stack pointer manipulations. These relocations are of type R_WEBASSEMBLY_GLOBAL_INDEX_LEB. This change also adds support for reading relocations of this type in WasmObjectFile.cpp. Since its a globally imported symbol this does mean that the get_global/set_global instruction won't be valid until the objects are linked that global used in no longer an imported global. Differential Revision: https://reviews.llvm.org/D34172 llvm-svn: 305616
* [WebAssembly] Convert the remaining unit tests to the new wasm-object-file ↵Dan Gohman2017-02-281-87/+86
| | | | | | | | | | | target. To facilitate this, add a new hidden command-line option to disable the explicit-locals pass. That causes llc to emit invalid code that doesn't have all locals converted to get_local/set_local, however it simplifies testwriting in many cases. llvm-svn: 296540
* [WebAssembly] Remove the output operand from stores.Dan Gohman2016-10-061-31/+31
| | | | | | | | | Per spec changes, store instructions in WebAssembly no longer have a return value. Update the instruction descriptions. Differential Revision: https://reviews.llvm.org/D25122 llvm-svn: 283501
* [WebAssembly] Make register stackification more conservativeDerek Schuff2016-09-301-0/+36
| | | | | | | | | | | | Register stackification currently checks VNInfo for changes. Make that more accurate by testing each intervening instruction for any other defs to the same virtual register. Patch by Jacob Gravelle Differential Revision: https://reviews.llvm.org/D24942 llvm-svn: 282886
* [WebAssembly] Use the frame pointer instead of the stack pointerDerek Schuff2016-09-261-12/+53
| | | | | | | | | | | When we have dynamic allocas we have a frame pointer, and when we're lowering frame indexes we should make sure we use it. Patch by Jacob Gravelle Differential Revision: https://reviews.llvm.org/D24889 llvm-svn: 282442
* [WebAssembly] Disable the store-results optimization.Dan Gohman2016-08-181-35/+37
| | | | | | | | | | The WebAssemly spec removing the return value from store instructions, so remove the associated optimization from LLVM. This patch leaves the store instruction operands in place for now, so stores now always write to "$drop"; these will be removed in a seperate patch. llvm-svn: 279100
* [WebAssembly] Put __stack_pointer in the offset field of loads and stores.Dan Gohman2016-05-241-39/+40
| | | | | | | | | | | | | | | | | | | | 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-211-1/+1
| | | | | | | | | 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-191-2/+2
| | | | llvm-svn: 270011
* [WebAssembly] Rename $discard to $drop in the assembly output.Dan Gohman2016-05-171-13/+13
| | | | llvm-svn: 269862
* [WebAssembly] Model the stack evaluation order more precisely.Dan Gohman2016-05-171-8/+8
| | | | | | | | | | | 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] Mark COPY_LOCAL and TEE_LOCAL instructions has having no side ↵Dan Gohman2016-05-161-3/+5
| | | | | | effects. llvm-svn: 269683
* [WebAssembly] Preliminary fast-isel support.Dan Gohman2016-05-101-2/+0
| | | | llvm-svn: 269083
* [WebAssembly] Move register stackification and coloring to a late phase.Dan Gohman2016-05-101-76/+75
| | | | | | | | | | | | | | | | | | | 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] Stackify code emitted by eliminateFrameIndex and SP writebackDerek Schuff2016-03-171-30/+30
| | | | | | | | | | | | | | | | | 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
* Revert "[WebAssembly] Stackify code emitted by eliminateFrameIndex"Derek Schuff2016-02-231-13/+13
| | | | | | This reverts r261685 due to wasm test breakage. llvm-svn: 261702
* [WebAssembly] Stackify code emitted by eliminateFrameIndexDerek Schuff2016-02-231-13/+13
| | | | 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] 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-201-68/+70
| | | | | | | | The instructions are the same, but fewer locals are used. Differential Revision: http://reviews.llvm.org/D17428 llvm-svn: 261452
* [WebAssembly] Implement __builtin_frame_address.Dan Gohman2016-02-161-0/+31
| | | | | | Differential Revision: http://reviews.llvm.org/D17307 llvm-svn: 261032
* [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] 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] 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] Omit no-op adds for non-mem uses of FrameIndexDerek Schuff2016-01-261-0/+18
| | | | | | Differential Revision: http://reviews.llvm.org/D16554 llvm-svn: 258872
* [WebAssembly] Implement unaligned loads and stores.Dan Gohman2016-01-261-4/+4
| | | | | | Differential Revision: http://reviews.llvm.org/D16534 llvm-svn: 258779
* [WebAssembly] Don't stackify stores across instructions with side effects.Dan Gohman2016-01-201-12/+19
| | | | llvm-svn: 258285
* [WebAssembly] Support combining GEP and FrameIndex offsets in memory operand ↵Derek Schuff2016-01-071-0/+21
| | | | | | | | | | | offset field Previously we only supported putting the FI into memory operand offset fields if there was nothing there already. Now combine them. Differential Revision: http://reviews.llvm.org/D15941 llvm-svn: 257084
* [WebAssembly] Add -m:e to the target triple.Dan Gohman2016-01-071-1/+1
| | | | | | | This enables ELF-style name mangling, which primarily means using ".L" for private symbols. llvm-svn: 257020
* [WebAssembly] Implement eliminateCallFramePseudoDerek Schuff2015-12-161-0/+6
| | | | | | | | | | | | | | | | | | Summary: Implement eliminateCallFramePsuedo to handle ADJCALLSTACKUP/DOWN pseudo-instructions. Add a test calling a vararg function which causes non-0 adjustments. This revealed an issue with RegisterCoalescer wherein it eliminates a COPY from SP32 to a vreg but failes to update the live ranges of EXPR_STACK, causing a machineinstr verifier failure (so this test is commented out). Also add a dynamic alloca test, which causes a callseq_end dag node with a 0 (instead of undef) second argument to be generated. We currently fail to select that, so adjust the ADJCALLSTACKUP tablegen code to handle it. Differential Revision: http://reviews.llvm.org/D15587 llvm-svn: 255844
* [WebAssembly] Print an extra local decl when the user stack pointer is usedDerek Schuff2015-12-161-0/+5
| | | | | | Differential Revision: http://reviews.llvm.org/D15546 llvm-svn: 255815
* [WebAssembly] Implement prolog/epilog insertion and FrameIndex eliminationDerek Schuff2015-12-111-0/+70
Summary: Use the SP32 physical register as the base for FrameIndex lowering. Update it and the __stack_pointer global var in the prolog and epilog. Extend the mapping of virtual registers to wasm locals to include the physical registers. Rather than modify the target-independent PrologEpilogInserter (which asserts that there are no virtual registers left) include a slightly-modified copy for Wasm that does not have this assertion and only clears the virtual registers if scavenging was needed (which of course it isn't for wasm). Differential Revision: http://reviews.llvm.org/D15344 llvm-svn: 255392
OpenPOWER on IntegriCloud