summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/WebAssembly/call.ll
Commit message (Collapse)AuthorAgeFilesLines
* [WebAssembly] Implement tail calls and unify tablegen call classesThomas Lively2019-06-261-8/+19
| | | | | | | | | | | | | | | | | Summary: Implements direct and indirect tail calls enabled by the 'tail-call' feature in both DAG ISel and FastISel. Updates existing call tests and adds new tests including a binary encoding test. Reviewers: aheejin Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D62877 llvm-svn: 364445
* [WebAssembly] Update CodeGen test expectations after rL354697. NFCSam Clegg2019-02-231-14/+14
| | | | llvm-svn: 354705
* [WebAssembly] Re-enable main-function signature rewritingDan Gohman2019-01-291-2/+2
| | | | | | | | | | | | | | | | Re-enable the code to rewrite main-function signatures into "int main(int argc, char *argv[])", but limited to only handling the case of "int main(void)", so that it doesn't silently strip an argument in the "int main(int argc, char *argv[], char *envp[])" case. This allows main to be called by C startup code, since WebAssembly requires caller and callee signatures to match, so it can't rely on passing main a different number of arguments than it expects. Differential Revision: https://reviews.llvm.org/D57323 llvm-svn: 352479
* [WebAssembly] Massive instruction renamingThomas Lively2019-01-081-14/+14
| | | | | | | | | | | | | | | 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-22/+20
| | | | | | | | | | | | | | | | | | | | | 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
* Revert "[WebAssembly] Fixup `main` signature by default"Sam Clegg2018-11-061-2/+2
| | | | | | | | | | This reverts rL345880. It caused some test failures on the webassembly waterfall. e.g. binaryen2.test_mainenv fails due the fact that `envp` ends up being undef rather than 0. Differential Revision: https://reviews.llvm.org/D54117 llvm-svn: 346187
* [WebAssembly] Fixup `main` signature by defaultSam Clegg2018-11-011-2/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D53396 llvm-svn: 345880
* [WebAssembly][NFC] Add missing tests for indirect callsThomas Lively2018-09-201-0/+33
| | | | | | | | | | | | Summary: Depends on D52105. Reviewers: aheejin, dschuff Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D52254 llvm-svn: 342691
* [WebAssembly] Add V128 value type to binary formatThomas Lively2018-09-201-2/+23
| | | | | | | | | | | | | | Summary: Adds the necessary support to lib/ObjectYAML and fixes SIMD calls to allow the tests to work. Also removes some dead code that would otherwise have to have been updated. Reviewers: aheejin, dschuff, sbc100 Subscribers: jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D52105 llvm-svn: 342689
* [WebAssembly] Added default stack-only instruction mode for MC.Wouter van Oortmerssen2018-08-271-2/+2
| | | | | | | | | | | | | | | | | | | | | 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-2/+2
| | | | | | This reverts commit 917a99b71ce21c975be7bfbf66f4040f965d9f3c. llvm-svn: 339630
* [WebAssembly] Added default stack-only instruction mode for MC.Wouter van Oortmerssen2018-08-101-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: jfb, llvm-commits, aheejin, eraman, jgravelle-google, sbc100 Differential Revision: https://reviews.llvm.org/D50568 llvm-svn: 339474
* [WebAssembly] Ensure bitcasts that would result in invalid wasm are removed ↵Sam Clegg2018-08-021-1/+1
| | | | | | | | | | | | by FixFunctionBitcasts Rather than allowing invalid bitcasts to be lowered to wasm call instructions that won't validate, generate wrappers that contain unreachable thereby delaying the error until runtime. Differential Revision: https://reviews.llvm.org/D49517 llvm-svn: 338744
* 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
* [WebAssembly] Reapply r319186: "Support bitcasted function addresses with ↵Dan Gohman2017-12-081-3/+3
| | | | | | | | | varargs." This puts the functionality under control of a command-line option which is off by default to avoid breaking existing setups. llvm-svn: 320197
* [WebAssembly] Revert r319186 "Support bitcasted function addresses with ↵Dan Gohman2017-11-301-1/+1
| | | | | | | | | | | varargs." The patch broke Emscripten's EM_ASM macros, which utiltize unprototyped functions. See https://bugs.llvm.org/show_bug.cgi?id=35385 for details. llvm-svn: 319452
* [WebAssembly] Support bitcasted function addresses with varargs.Dan Gohman2017-11-281-1/+1
| | | | | | | | | | | | | Generalize FixFunctionBitcasts to handle varargs functions. This in particular fixes the case where clang bitcasts away a varargs when calling a K&R-style function. This avoids interacting with tricky ABI details because it operates at the LLVM IR level before varargs ABI details are exposed. This fixes PR35385. llvm-svn: 319186
* [WebAssembly] FastISel : Bail to SelectionDAG for constexpr callsJacob Gravelle2017-08-241-0/+21
| | | | | | | | | | | | | | Summary: Currently FastISel lowers constexpr calls as indirect calls. We'd like those to direct calls, and falling back to SelectionDAGISel handles that. Reviewers: dschuff, sunfish Subscribers: jfb, sbc100, llvm-commits, aheejin Differential Revision: https://reviews.llvm.org/D37073 llvm-svn: 311693
* [WebAssembly] Basic support for Wasm object file encoding.Dan Gohman2017-02-241-7/+18
| | | | | | | | | With the "wasm32-unknown-unknown-wasm" triple, this allows writing out simple wasm object files, and is another step in a larger series toward migrating from ELF to general wasm object support. Note that this code and the binary format itself is still experimental. llvm-svn: 296190
* [WebAssembly] Fix for 0xc call_indirect changesDerek Schuff2016-10-211-0/+18
| | | | | | | | | | | | | | | | | Summary: Need to reorder the operands to have the callee as the last argument. Adds a pseudo-instruction, and a pass to lower it into a real call_indirect. This is the first of two options for how to fix the problem. Reviewers: dschuff, sunfish Subscribers: jfb, beanz, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D25708 llvm-svn: 284840
* [WebAssembly] Optimize away return instructions using fallthroughs.Dan Gohman2016-05-211-2/+2
| | | | | | | | | 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] Fast-isel support for calls, arguments, and selects.Dan Gohman2016-05-121-0/+1
| | | | llvm-svn: 269273
* [WebAssembly] Change a FIXME to a TODO in a comment.Dan Gohman2016-01-191-1/+1
| | | | llvm-svn: 258139
* [WebAssembly] Define WebAssembly-specific relocation codes.Dan Gohman2016-01-111-10/+10
| | | | | | | | 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
* [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] Add type prefixes to call instructionsDan Gohman2015-12-141-12/+12
| | | | | | | | | Add return type information to call and call_indirect instructions. This allows them to be disambiguated without knowledge of the callee. Differential Revision: http://reviews.llvm.org/D15484 llvm-svn: 255565
* [WebAssembly] Don't special-case call operand order.Dan Gohman2015-11-231-7/+7
| | | | | | | | With the '=' suffix now indicating which operands are output operands, it's no longer as important to distinguish between a call's inputs and its outputs using operand ordering, so we can go back to printing them in the normal order. llvm-svn: 253925
* [WebAssembly] Suffix output operands with '='.Dan Gohman2015-11-231-7/+7
| | | | | | | | This distinguishes input operands from output operands. This is something of a syntactic experiment to see whether the mild amount of clutter this adds is outweighed by the extra information it conveys to the reader. llvm-svn: 253922
* [WebAssembly] Emit .param, .result, and .local through MC.Dan Gohman2015-11-231-12/+11
| | | | | | This eliminates one of the main remaining uses of EmitRawText. llvm-svn: 253878
* [WebAssembly] Enable register coloring and register stackifying.Dan Gohman2015-11-181-32/+17
| | | | | | | | | | | | | | | | This also takes the push/pop syntax another step forward, introducing stack slot numbers to make it easier to see how expressions are connected. For example, the value pushed in $push7 is popped in $pop7. And, this begins an experiment with making get_local and set_local implicit when an operation directly uses or defines a register. This greatly reduces clutter. If this experiment succeeds, it may make sense to do this for const instructions as well. And, this introduces more special code for ARGUMENTS; hopefully this code will soon be obviated by proper support for live-in virtual registers. llvm-svn: 253465
* [WebAssembly] Reapply r252858, with svn add for the new file.Dan Gohman2015-11-121-32/+22
| | | | | | | | | | | | | | | | | | | | | | Switch to MC for instruction printing. This encompasses several changes which are all interconnected: - Use the MC framework for printing almost all instructions. - AsmStrings are now live. - This introduces an indirection between LLVM vregs and WebAssembly registers, and a new pass, WebAssemblyRegNumbering, for computing a basic the mapping. This addresses some basic issues with argument registers and unused registers. - The way ARGUMENT instructions are handled no longer generates redundant get_local+set_local for every argument. This also changes the assembly syntax somewhat; most notably, MC's printing does not use sigils on label names, so those are no longer present, and push/pop now have a sigil to keep them unambiguous. The usage of set_local/get_local/$push/$pop will continue to evolve significantly. This patch is just one step of a larger change. llvm-svn: 252910
* Revert r252858: "[WebAssembly] Switch to MC for instruction printing."Hans Wennborg2015-11-121-22/+32
| | | | | | | | It broke the CMake build: "Cannot find source file: WebAssemblyRegNumbering.cpp" llvm-svn: 252897
* [WebAssembly] Switch to MC for instruction printing.Dan Gohman2015-11-121-32/+22
| | | | | | | | | | | | | | | | | | | | This encompasses several changes which are all interconnected: - Use the MC framework for printing almost all instructions. - AsmStrings are now live. - This introduces an indirection between LLVM vregs and WebAssembly registers, and a new pass, WebAssemblyRegNumbering, for computing a basic the mapping. This addresses some basic issues with argument registers and unused registers. - The way ARGUMENT instructions are handled no longer generates redundant get_local+set_local for every argument. This also changes the assembly syntax somewhat; most notably, MC's printing use sigils on label names, so those are no longer present, and push/pop now have a sigil to keep them unambiguous. The usage of set_local/get_local/$push/$pop will continue to evolve significantly. This patch is just one step of a larger change. llvm-svn: 252858
* [WebAssembly] Add more explicit pushes to the tests.Dan Gohman2015-11-061-5/+5
| | | | llvm-svn: 252344
* [WebAssembly] Make expression-stack pushing explicitDan Gohman2015-11-061-11/+11
| | | | | | | | | Modelling of the expression stack is evolving. This patch takes another step by making pushes explicit. Differential Revision: http://reviews.llvm.org/D14338 llvm-svn: 252334
* WebAssembly: update syntaxJF Bastien2015-10-161-28/+36
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Follow the same syntax as for the spec repo. Both have evolved slightly independently and need to converge again. This, along with wasmate changes, allows me to do the following: echo "int add(int a, int b) { return a + b; }" > add.c ./out/bin/clang -O2 -S --target=wasm32-unknown-unknown add.c -o add.wack ./experimental/prototype-wasmate/wasmate.py add.wack > add.wast ./sexpr-wasm-prototype/out/sexpr-wasm add.wast -o add.wasm ./sexpr-wasm-prototype/third_party/v8-native-prototype/v8/v8/out/Release/d8 -e "print(WASM.instantiateModule(readbuffer('add.wasm'), {print:print}).add(42, 1337));" As you'd expect, the d8 shell prints out the right value. Reviewers: sunfish Subscribers: jfb, llvm-commits, dschuff Differential Revision: http://reviews.llvm.org/D13712 llvm-svn: 250480
* [WebAssembly] Switch to a more traditional assembly syntaxDan Gohman2015-10-061-49/+65
| | | | | | | | | | | This new syntax is built around putting each instruction on its own line in a "mnemonic op, op, op" like syntax. It also uses conventional data section directives like ".byte" and so on rather than requiring everything to be in hierarchical S-expression format. This is a more natural syntax for a ".s" file format from the perspective of LLVM MC and related tools, while remaining easy to translate into other forms as needed. llvm-svn: 249364
* [WebAssembly] Rename setlocal to set_local to match the spec.Dan Gohman2015-10-031-12/+12
| | | | llvm-svn: 249218
* [WebAssembly] Support calls marked as "tail", fastcc, and coldcc.Dan Gohman2015-10-021-1/+24
| | | | llvm-svn: 249184
* [WebAssembly] Support for direct call and call_indirect.Dan Gohman2015-09-281-20/+33
| | | | llvm-svn: 248716
* [WebAssembly] Update target datalayout strings.Dan Gohman2015-09-091-1/+1
| | | | llvm-svn: 247187
* [WebAssembly] Implement calls with void return types.Dan Gohman2015-09-091-0/+10
| | | | llvm-svn: 247158
* [WebAssembly] Fix lowering of calls with more than one argument.Dan Gohman2015-09-091-0/+13
| | | | llvm-svn: 247118
* WebAssembly: emit `(func (param t) (result t))` s-expressionsJF Bastien2015-08-251-5/+10
| | | | | | | | | | | | Summary: Match spec format: https://github.com/WebAssembly/spec/blob/master/ml-proto/test/fac.wasm Reviewers: sunfish Subscribers: llvm-commits, jfb Differential Revision: http://reviews.llvm.org/D12307 llvm-svn: 245986
* WebAssembly: Implement callJF Bastien2015-08-241-12/+55
| | | | | | | | | | | | Summary: Support function calls. Reviewers: sunfish, sunfishcode Subscribers: sunfishcode, jfb, llvm-commits Differential revision: http://reviews.llvm.org/D12219 llvm-svn: 245887
* Revert two bad commits.JF Bastien2015-08-241-5/+4
| | | | | | | | | | Summary: I forgot to squash git commits before doing an svn dcommit of D12219. Reverting, and re-submitting. Subscribers: jfb, llvm-commits Differential Revision: http://reviews.llvm.org/D12298 llvm-svn: 245886
* Missing print.JF Bastien2015-08-241-4/+5
| | | | llvm-svn: 245883
* callJF Bastien2015-08-241-0/+22
llvm-svn: 245882
OpenPOWER on IntegriCloud