summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/WebAssembly
Commit message (Collapse)AuthorAgeFilesLines
* [WebAssembly] Fix printing of global operandsDerek Schuff2015-11-171-4/+4
| | | | | | | | | | This was regressed in r252656 which wasn't quite NFC. Instead of using a custom instruction as before, use a pattern to select CONST_I32 for the global addrs. Differential Revision: http://reviews.llvm.org/D14587 llvm-svn: 253276
* [WebAssembly] Fix function return type printingDerek Schuff2015-11-163-29/+32
| | | | | | | | | | | Summary: Previously return type information for a function was derived from return dag nodes. But this didn't work for dags with != return node. So instead compute it directly from the LLVM function as is done for imports. Differential Revision: http://reviews.llvm.org/D14593 llvm-svn: 253251
* [WebAssembly] Reverse the order of operands for br_ifDerek Schuff2015-11-162-6/+6
| | | | | | | | | | | | Summary: This is to match the new version in the spec Reviewers: sunfish Subscribers: jfb, llvm-commits, dschuff Differential Revision: http://reviews.llvm.org/D14519 llvm-svn: 253249
* [WebAssembly] Prototype passes for register coloring and register stackifying.Dan Gohman2015-11-165-0/+341
| | | | | | These passes are not yet enabled by default. llvm-svn: 253217
* [WebAssembly] Use tabs instead of spaces in assembly output.Dan Gohman2015-11-158-85/+85
| | | | | | This seems to be the most popular convention among the other backends. llvm-svn: 253172
* [WebAssembly] Minor code simplification. NFC.Dan Gohman2015-11-141-3/+1
| | | | llvm-svn: 253150
* [WebAssembly] Support signext, zeroext, and several other function attributes.Dan Gohman2015-11-141-22/+0
| | | | llvm-svn: 253148
* [WebAssembly] Rename the Const instructions to be upper-case too.Dan Gohman2015-11-131-4/+4
| | | | llvm-svn: 253072
* [WebAssembly] Rename memory intrinsics to be upper-case, following ↵Dan Gohman2015-11-131-4/+4
| | | | | | convention. NFC. llvm-svn: 253070
* [WebAssembly] Inline asm support.Dan Gohman2015-11-134-0/+80
| | | | llvm-svn: 252997
* [WebAssembly] Un-mangle the conversion instruction names.Dan Gohman2015-11-131-75/+75
| | | | | | | | This arranges the types in the LLVM instruction names in the same order that they appear in the WebAssembly opcode names, and eliminates double-underscores. llvm-svn: 252988
* [WebAssembly] Rename BR_IF_ to BR_IFDan Gohman2015-11-133-6/+6
| | | | | | | With MC-based instruction printing, we no longer need instruction names to mangle in hints about how they should be printed. llvm-svn: 252987
* [WebAssembly] Remove unneeded TODO items. NFC.Dan Gohman2015-11-132-19/+0
| | | | llvm-svn: 252985
* [WebAssembly] Tidy up and update a TODO item. NFC.Dan Gohman2015-11-131-14/+9
| | | | llvm-svn: 252984
* [WebAssembly] Introduce a new pseudo-operand for unused expression results.Dan Gohman2015-11-135-12/+31
| | | | llvm-svn: 252975
* Roll an expression into an assert to fix -Wunused-variable in a -Asserts buildDavid Blaikie2015-11-121-2/+1
| | | | llvm-svn: 252925
* [WebAssembly] Reapply r252858, with svn add for the new file.Dan Gohman2015-11-1210-173/+219
| | | | | | | | | | | | | | | | | | | | | | 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-129-121/+173
| | | | | | | | It broke the CMake build: "Cannot find source file: WebAssemblyRegNumbering.cpp" llvm-svn: 252897
* [WebAssembly] Switch to MC for instruction printing.Dan Gohman2015-11-129-173/+121
| | | | | | | | | | | | | | | | | | | | 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] Support non-legal argument and return types.Dan Gohman2015-11-113-79/+127
| | | | llvm-svn: 252687
* [WebAssembly] Remove special cases for things that are no longer special. NFC.Dan Gohman2015-11-101-16/+0
| | | | llvm-svn: 252656
* [WebAssembly] Support for floating point min and max.Dan Gohman2015-11-102-7/+6
| | | | llvm-svn: 252653
* [WebAssembly] Support 'unreachable' expressionDerek Schuff2015-11-103-2/+15
| | | | | | | | | | | | | | | Lower LLVM's 'unreachable' terminator to ISD::TRAP, and lower ISD::TRAP to wasm's 'unreachable' expression. WebAssembly type-checks expressions, but a noreturn function with a return type that doesn't match the context will cause a check failure. So we lower LLVM 'unreachable' to ISD::TRAP and then lower that to WebAssembly's 'unreachable' expression, which typechecks in any context and causes a trap if executed. Differential Revision: http://reviews.llvm.org/D14515 llvm-svn: 252566
* Try to fix build more -- like r252392 but for WebAssembly.Nico Weber2015-11-071-4/+4
| | | | llvm-svn: 252394
* [WebAssembly] Make expression-stack pushing explicitDan Gohman2015-11-061-7/+19
| | | | | | | | | 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] Fix copypasta.Dan Gohman2015-11-052-3/+3
| | | | | | Noticed by dschff in http://reviews.llvm.org/rL252203 llvm-svn: 252208
* [WebAssembly] Rename Immediate instructions to Const.Dan Gohman2015-11-052-16/+16
| | | | | | This more closely reflects the naming convention in the spec. llvm-svn: 252204
* [WebAssembly] Add AsmString strings for most instructions.Dan Gohman2015-11-057-135/+212
| | | | | | | | | Mangling type information into MachineInstr opcode names was a temporary measure, and it's starting to get hairy. At the same time, the MC instruction printer wants to use AsmString strings for printing. This patch takes the first step, starting the process of adding AsmStrings for instructions. llvm-svn: 252203
* [WebAssembly] Update wasm builtin functions to match spec changes.Dan Gohman2015-11-051-15/+7
| | | | | | | The page_size operator has been removed from the spec, and the resize_memory operator has been changed to grow_memory. llvm-svn: 252202
* [WebAssembly] Add WebAssemblyMCInstLower.cpp.Dan Gohman2015-11-055-4/+168
| | | | | | | This isn't used yet; it's just a start towards eventually using MC to do instruction printing, and eventually binary encoding. llvm-svn: 252194
* [WebAssembly] Rename ior operator to or to match the specDerek Schuff2015-11-051-1/+1
| | | | | | | | | | | | Summary: The spec uses "or" for inclusive-or and "xor" for exclusive-or Reviewers: sunfish Subscribers: jfb, llvm-commits, dschuff Differential Revision: http://reviews.llvm.org/D14362 llvm-svn: 252174
* Align whitespaceDerek Schuff2015-11-032-4/+4
| | | | llvm-svn: 252003
* [WebAssembly] Support wasm select operatorDerek Schuff2015-11-032-0/+10
| | | | | | | | | | | | | | Summary: Add support for wasm's select operator, and lower LLVM's select DAG node to it. Reviewers: sunfish Subscribers: dschuff, llvm-commits, jfb Differential Revision: http://reviews.llvm.org/D14295 llvm-svn: 252002
* [WebAssembly] Make WebAssemblyCodeGen depend on WebAssemblyAsmPrinterDerek Schuff2015-11-021-1/+1
| | | | llvm-svn: 251859
* [WebAssembly] Fix import statementJF Bastien2015-10-301-9/+10
| | | | | | | | | | Summary: Imports should be generated like (param i32 f32...) not (param i32) (param f32) ... Author: binji Reviewers: jfb Subscribers: jfb, dschuff llvm-svn: 251714
* [WebAssembly] Update opcode name format for conversionsJF Bastien2015-10-292-27/+35
| | | | | | | | | | | | Summary: Conversion opcode name format should be f64.convert_u/i64 not f64_convert_u Author: s3ththompson Reviewers: jfb Subscribers: sunfish, jfb, llvm-commits, dschuff Differential Revision: http://reviews.llvm.org/D14160 llvm-svn: 251613
* WebAssembly: fix more syntaxJF Bastien2015-10-222-5/+5
| | | | | | | br_if shouldn't start with a dot. div and rem went from prefix u/s to suffix. llvm-svn: 250972
* WebAssembly: support importsJF Bastien2015-10-211-1/+23
| | | | | | C/C++ code can declare an extern function, which will show up as an import in WebAssembly's output. It's expected that the linker will resolve these, and mark unresolved imports as call_import (I have a patch which does this in wasmate). llvm-svn: 250875
* WebAssembly: fix call/return syntax.JF Bastien2015-10-201-1/+6
| | | | | | They are now typeless, unlike other operations. llvm-svn: 250793
* WebAssembly: fix syntax for br_if.JF Bastien2015-10-203-5/+5
| | | | llvm-svn: 250777
* WebAssembly: don't omit dead vregs from localsJF Bastien2015-10-171-2/+4
| | | | | | | | | | | | | | | | | | Summary: This is a temporary hack until we get around to remapping the vreg numbers to local numbers. Dead vregs cause bad numbering and make consumers sad. We could also just look at debug info an use named locals instead, but vregs have to work properly anyways so there! Reviewers: binji, sunfish Subscribers: jfb, llvm-commits, dschuff Differential Revision: http://reviews.llvm.org/D13839 llvm-svn: 250594
* WebAssembly: fix the syntax for comparisonsJF Bastien2015-10-171-8/+8
| | | | | | | | | | | | Summary: It has also slightly changed. Reviewers: binji Subscribers: jfb, dschuff, llvm-commits, sunfish Differential Revision: http://reviews.llvm.org/D13837 llvm-svn: 250591
* WebAssembly: fix load/store syntaxJF Bastien2015-10-161-51/+51
| | | | | | | | | | | | Summary: The syntax has changed a bit recently. Reviewers: binji Subscribers: llvm-commits, jfb, sunfish, dschuff Differential Revision: http://reviews.llvm.org/D13821 llvm-svn: 250535
* WebAssembly: relooper analysis passJF Bastien2015-10-163-56/+109
| | | | | | | | | | | | Summary: Make the relooper an analysis pass, to convert CFG to AST. Reviewers: sunfish Subscribers: jfb, dschuff Differential Revision: http://reviews.llvm.org/D12744 llvm-svn: 250524
* WebAssembly: update syntaxJF Bastien2015-10-161-31/+59
| | | | | | | | | | | | | | | | | | | | | | | | 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] Remove a TODO comment which is no longer needed. NFC.Dan Gohman2015-10-131-7/+0
| | | | llvm-svn: 250233
* [WebAssembly] Rename floating-point operators to match their spec names.Dan Gohman2015-10-091-6/+6
| | | | llvm-svn: 249859
* [WebAssembly] Switch to a more traditional assembly syntaxDan Gohman2015-10-064-144/+113
| | | | | | | | | | | 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] Implement the remaining conversion operations.Dan Gohman2015-10-031-31/+54
| | | | | | | This is a temporary assembly syntax that will likely evolve along with broader upcoming syntax changes. llvm-svn: 249225
* [WebAssembly] Rename setlocal to set_local to match the spec.Dan Gohman2015-10-031-1/+1
| | | | llvm-svn: 249218
OpenPOWER on IntegriCloud