summaryrefslogtreecommitdiffstats
path: root/llvm/test/MC/WebAssembly
Commit message (Collapse)AuthorAgeFilesLines
...
* [WebAssembly] Update MC for bulk memoryThomas Lively2019-02-1911-37/+62
| | | | | | | | | | | | | | | | | | Summary: Rename MemoryIndex to InitFlags and implement logic for determining data segment layout in ObjectYAML and MC. Also adds a "passive" flag for the .section assembler directive although this cannot be assembled yet because the assembler does not support data sections. Reviewers: sbc100, aardappel, aheejin, dschuff Subscribers: jgravelle-google, hiraditya, sunfish, rupprecht, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D57938 llvm-svn: 354397
* [WebAssembly] memory.fillThomas Lively2019-02-131-0/+18
| | | | | | | | | | | | | | | | Summary: memset lowering, fix argument types in memcpy lowering, and test encodings. Depends on D57736. Reviewers: aheejin Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D57791 llvm-svn: 353986
* [WebAssembly] Fix imported function symbol names that differ from their ↵Dan Gohman2019-02-072-1/+33
| | | | | | | | | | | | | | import names in the .o format Add a flag to allow symbols to have a wasm import name which differs from the linker symbol name, allowing the linker to link code using the import_module attribute. This is the MC/Object portion of the patch. Differential Revision: https://reviews.llvm.org/D57632 llvm-svn: 353474
* [WebAssembly] Add symbol flag to the binary format llvm.usedSam Clegg2019-02-071-0/+21
| | | | | | | | | | | | | | Summary: Rather than add a new attribute See https://github.com/WebAssembly/tool-conventions/issues/64 Subscribers: dschuff, jgravelle-google, aheejin, sunfish, rupprecht, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D57864 llvm-svn: 353360
* [WebAssembly] Expand symbol flags shown by llvm-objdump --symbolsSam Clegg2019-02-073-13/+32
| | | | | | Differential Revision: https://reviews.llvm.org/D57861 llvm-svn: 353357
* [WebAssembly] Make disassembler always emit most canonical name.Wouter van Oortmerssen2019-02-051-2/+2
| | | | | | | | | | | | | | | | | | | | | Summary: There are a few instructions that all map to the same opcode, so when disassembling, we have to pick one. That was just the first one before (the except_ref variant in the case of "call"), now it is the one marked as IsCanonical in tablegen, or failing that, the shortest name (which is typically the "canonical" one). Also introduced a canonical "end" instruction for this purpose. Reviewers: dschuff, tlively Subscribers: sbc100, jgravelle-google, aheejin, llvm-commits, sunfish Tags: #llvm Differential Revision: https://reviews.llvm.org/D57713 llvm-svn: 353131
* [WebAssembly] MC: Mark more function aliases as functionsSam Clegg2019-02-041-0/+32
| | | | | | | | | | | | | Aliases of functions are now marked as function symbols even if they are bitcast to some other other non-function type. This is important for WebAssembly where object and function symbols can't alias each other. Fixes PR38866 Differential Revision: https://reviews.llvm.org/D57538 llvm-svn: 353109
* [llvm-readobj] Report more WebAssembly symbol infoSam Clegg2019-02-041-0/+12
| | | | | | Differential Revision: https://reviews.llvm.org/D57695 llvm-svn: 353104
* [WebAssembly] Make segment/size/type directives optional in asmWouter van Oortmerssen2019-02-044-20/+0
| | | | | | | | | | | | | | | | | | | | Summary: These were "boilerplate" that repeated information already present in .functype and end_function, that needed to be repeated to Please the particular way our object writing works, and missing them would generate errors. Instead, we generate the information for these automatically so the user can concern itself with writing more canonical wasm functions that always work as expected. Reviewers: dschuff, sbc100 Subscribers: jgravelle-google, aheejin, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D57546 llvm-svn: 353067
* [WebAssembly] Rename relocations from R_WEBASSEMBLY_ to R_WASM_Sam Clegg2019-02-0413-58/+58
| | | | | | | | | | | | | | | | See https://github.com/WebAssembly/tool-conventions/pull/95. This is less typing and IMHO more readable, and it also fits with our naming around the binary format which tends to use the short name. e.g. include/llvm/BinaryFormat/Wasm.h tools/llvm-objdump/WasmDump.cpp etc.. Differential Revision: https://reviews.llvm.org/D57611 llvm-svn: 353062
* [WebAssembly] Add codegen support for the import_field attributeDan Gohman2019-02-011-2/+2
| | | | | | | | | This adds the LLVM side of https://reviews.llvm.org/D57602 -- the import_field attribute. See that patch for details. Differential Revision: https://reviews.llvm.org/D57603 llvm-svn: 352931
* [WebAssembly] MC: Fix for outputing wasm object to /dev/nullSam Clegg2019-01-311-0/+10
| | | | | | | | Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D57479 llvm-svn: 352806
* [WebAssembly] Exception handling: Switch to the new proposalHeejin Ahn2019-01-302-6/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This switches the EH implementation to the new proposal: https://github.com/WebAssembly/exception-handling/blob/master/proposals/Exceptions.md (The previous proposal was https://github.com/WebAssembly/exception-handling/blob/master/proposals/old/Exceptions.md) - Instruction changes - Now we have one single `catch` instruction that returns a except_ref value - `throw` now can take variable number of operations - `rethrow` does not have 'depth' argument anymore - `br_on_exn` queries an except_ref to see if it matches the tag and branches to the given label if true. - `extract_exception` is a pseudo instruction that simulates popping values from wasm stack. This is to make `br_on_exn`, a very special instruction, work: `br_on_exn` puts values onto the stack only if it is taken, and the # of values can vay depending on the tag. - Now there's only one `catch` per `try`, this patch removes all special handling for terminate pad with a call to `__clang_call_terminate`. Before it was the only case there are two catch clauses (a normal `catch` and `catch_all` per `try`). - Make `rethrow` act as a terminator like `throw`. This splits BB after `rethrow` in WasmEHPrepare, and deletes an unnecessary `unreachable` after `rethrow` in LateEHPrepare. - Now we stop at all catchpads (because we add wasm `catch` instruction that catches all exceptions), this creates new `findWasmUnwindDestinations` function in SelectionDAGBuilder. - Now we use `br_on_exn` instrution to figure out if an except_ref matches the current tag or not, LateEHPrepare generates this sequence for catch pads: ``` catch block i32 br_on_exn $__cpp_exception end_block extract_exception ``` - Branch analysis for `br_on_exn` in WebAssemblyInstrInfo - Other various misc. changes to switch to the new proposal. Reviewers: dschuff Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D57134 llvm-svn: 352598
* [WebAssembly] Add languages from debug info to producers sectionThomas Lively2019-01-181-1/+1
| | | | | | | | | | Reviewers: aheejin, dschuff, sbc100 Subscribers: aprantl, jgravelle-google, hiraditya, sunfish Differential Revision: https://reviews.llvm.org/D56889 llvm-svn: 351507
* [WebAssembly] Fixed objdump not parsing function headers.Wouter van Oortmerssen2019-01-172-6/+40
| | | | | | | | | | | | | | | | | | | | | | | Summary: objdump was interpreting the function header containing the locals declaration as instructions. To parse these without injecting target specific code in objdump, MCDisassembler::onSymbolStart was added to be implemented by the WebAssembly implemention. WasmObjectFile now returns a code offset for the "address" of a symbol, rather than the index. This is also more in-line with what other targets do. Also ensured that the AsmParser correctly puts each function in its own segment to enable this test case. Reviewers: sbc100, dschuff Subscribers: jgravelle-google, aheejin, sunfish, rupprecht, llvm-commits Differential Revision: https://reviews.llvm.org/D56684 llvm-svn: 351460
* [WebAssembly] Parse llvm.ident into producers sectionThomas Lively2019-01-172-0/+15
| | | | llvm-svn: 351413
* Revert "[WebAssembly] Parse llvm.ident into producers section"Thomas Lively2019-01-172-15/+0
| | | | | | This reverts commit eccdbba3a02a33e13b5262e92200a33e2ead873d. llvm-svn: 351410
* [WebAssembly] Parse llvm.ident into producers sectionThomas Lively2019-01-162-0/+15
| | | | | | | | | | | | | | Summary: Everything before the word "version" is the tool, and everything after the word "version" is the version. Reviewers: aheejin, dschuff Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D56742 llvm-svn: 351399
* [WebAssembly] Store section alignment as a power of 2Sam Clegg2019-01-1610-24/+24
| | | | | | | | | | | This change bumps for version number of the wasm object file metadata. See https://github.com/WebAssembly/tool-conventions/pull/92 Differential Revision: https://reviews.llvm.org/D56758 llvm-svn: 351285
* [WebAssembly] Add unimplemented-simd128 subtarget featureThomas Lively2019-01-103-4/+4
| | | | | | | | | | | | | | Summary: This is a third attempt, but this time we have vetted it on Windows first. The previous errors were due to an uninitialized class member. Reviewers: aheejin Subscribers: dschuff, sbc100, jgravelle-google, sunfish, jfb, llvm-commits Differential Revision: https://reviews.llvm.org/D56560 llvm-svn: 350901
* Revert "[WebAssembly] Add simd128-unimplemented subtarget feature"Thomas Lively2019-01-103-4/+4
| | | | | | This reverts rL350791. llvm-svn: 350795
* [WebAssembly] Add simd128-unimplemented subtarget featureThomas Lively2019-01-103-4/+4
| | | | | | | | | | This is a second attempt at r350778, which was reverted in r350789. The only change is that the unimplemented-simd128 feature has been renamed simd128-unimplemented, since naming it unimplemented-simd128 somehow made the simd128 feature flag enable the unimplemented-simd128 feature on Windows. llvm-svn: 350791
* Revert "[WebAssembly] Add unimplemented-simd128 subtarget feature"Thomas Lively2019-01-103-4/+4
| | | | | | This reverts L350778. llvm-svn: 350789
* [WebAssembly] Add unimplemented-simd128 subtarget featureThomas Lively2019-01-093-4/+4
| | | | | | | | | | | | | | | Summary: This replaces the old ad-hoc -wasm-enable-unimplemented-simd flag. Also makes the new unimplemented-simd128 feature imply the simd128 feature. Reviewers: aheejin, dschuff Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits, alexcrichton Differential Revision: https://reviews.llvm.org/D56501 llvm-svn: 350778
* [WebAssembly] Massive instruction renamingThomas Lively2019-01-086-42/+42
| | | | | | | | | | | | | | | 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] made assembler parse block_typeWouter van Oortmerssen2019-01-021-21/+21
| | | | | | | | | | | | | | | Summary: This was previously ignored and an incorrect value generated. Also fixed Disassembler's handling of block_type. Reviewers: dschuff, aheejin Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D56092 llvm-svn: 350270
* [WebAssembly] Added basic support for if/else/end_if in MC layer.Wouter van Oortmerssen2018-12-261-10/+10
| | | | | | | | | | | | | | | | | Summary: These instructions are currently unused in our backend, but for completeness it is good to support them, so they can be used with the assembler in hand-written code. Tests are very basic, signature support missing much like other blocks. Reviewers: dschuff, aheejin Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D55973 llvm-svn: 350079
* [WebAssembly] Make assembler check for proper nesting of control flow.Wouter van Oortmerssen2018-12-263-0/+38
| | | | | | | | | | | | | | | | | | | | | Summary: It does so using a simple nesting stack, and gives clear errors upon violation. This is unique to wasm, since most CPUs do not have any nested constructs. Had to add an end of file check to the general assembler for this. Note: if/else/end instructions are not currently supported in our tablegen defs, so these tests will be enabled in a follow-up. They already pass the nesting check. Reviewers: dschuff, aheejin Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D55797 llvm-svn: 350078
* [WebAssembly] Fix assembler parsing of br_table.Wouter van Oortmerssen2018-12-171-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: We use `variable_ops` in the tablegen defs to denote the list of branch targets in `br_table`, but unlike other uses of `variable_ops` (e.g. call) the these branch targets need to actually be encoded in the instruction. The existing tables for `variable_ops` cause not operands to be accepted by the assembly matcher. Following the example of ARM: https://github.com/llvm-mirror/llvm/blob/2cc0a7da876c1d8c32775b0119e1e15aaa759b9e/lib/Target/ARM/ARMInstrInfo.td#L550-L555 we introduce a new operand type to capture this list, and we use the same {} syntax as ARM as well to differentiate them from regular integer operands. Also removed definition and use of TSFlags in tablegen defs, since `br_table` now has a non-variable_ops immediate operand, so the previous logic of only the variable_ops arguments being labels didn't make sense anymore. Reviewers: dschuff, aheejin, sunfish Subscribers: javed.absar, sbc100, jgravelle-google, kristof.beyls, llvm-commits Differential Revision: https://reviews.llvm.org/D55401 llvm-svn: 349405
* Fix for llvm-dwarfdump changes for subroutine typesDavid Blaikie2018-12-121-2/+2
| | | | llvm-svn: 348974
* [WebAssembly] Add '.eventtype' directive supportHeejin Ahn2018-12-111-0/+2
| | | | | | | | | | | | | | Summary: This patch supports `.eventtype` directive printing and parsing in the same syntax with `.functype`. Reviewers: aardappel, sbc100 Subscribers: dschuff, sbc100, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D55353 llvm-svn: 348818
* [WebAssembly] Change event section code to 13Heejin Ahn2018-12-051-1/+1
| | | | | | | | | | | | | | | Summary: We decided to change the event section code from 12 to 13 as new `DataCount` section in the bulk memory operations proposal will take the code 12 instead. Reviewers: sbc100 Subscribers: dschuff, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D55343 llvm-svn: 348424
* [WebAssembly] Enforce assembler emits to streamer in order.Wouter van Oortmerssen2018-12-031-0/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The assembler processes directives and instructions in whatever order they are in the file, then directly emits them to the streamer. This could cause badly written (or generated) .s files to produce incorrect binaries. It now has state that tracks what it has most recently seen, to enforce they are emitted in a given order that always produces correct wasm binaries. Also added a new test that compares obj2yaml output from llc (the backend) to that going via .s and the assembler to ensure both paths generate the same binaries. The features this test covers could be extended. Passes all wasm Lit tests. Fixes: https://bugs.llvm.org/show_bug.cgi?id=39557 Reviewers: sbc100, dschuff, aheejin Subscribers: jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D55149 llvm-svn: 348185
* [WebAssembly] replaced .param/.result by .functypeWouter van Oortmerssen2018-11-191-4/+2
| | | | | | | | | | | | | | | | | | | | | 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] Split BBs after throw instructionsHeejin Ahn2018-11-161-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: `throw` instruction is a terminator in wasm, but BBs were not splitted after `throw` instructions, causing machine instruction verifier to fail. This patch - Splits BBs after `throw` instructions in WasmEHPrepare and adding an unreachable instruction after `throw`, which will be deleted in LateEHPrepare pass - Refactors WasmEHPrepare into two member functions - Changes the semantics of `eraseBBsAndChildren` in LateEHPrepare pass to match that of WasmEHPrepare pass, which is newly added. Now `eraseBBsAndChildren` does not delete BBs with remaining predecessors. - Fixes style nits, making static function names conform to clang-tidy - Re-enables the test temporarily disabled by rL346840 && rL346845 Reviewers: dschuff Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D54571 llvm-svn: 347003
* [WebAssembly] Renumber SIMD bitwise instructionsThomas Lively2018-11-151-6/+6
| | | | | | | | | | | | Summary: Changed to match https://github.com/WebAssembly/simd/pull/54. Reviewers: aheejin Subscribers: dschuff, sbc100, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D54561 llvm-svn: 346931
* [WebAssembly] Make sure event-section XFAILs for build optionsHeejin Ahn2018-11-141-2/+2
| | | | | | | | | | rL346840 temporarily marked event-section.ll as XFAIL because it was failing for builds with LLVM_ENABLE_EXPENSIVE_CHECKS turned on, but to make sure it XFAILs even without LLVM_ENABLE_EXPENSIVE_CHECKS on we need this `-verify-machineinstrs` flag, which was missing in the previous commit. llvm-svn: 346845
* [WebAssembly] Temporarily disable event-section.llHeejin Ahn2018-11-141-0/+1
| | | | | | | | This test is failing in builds with LLVM_ENABLE_EXPENSIVE_CHECKS after rL346825 not because of the patch but due to a pre-existing codegen problem. Marking this as XFAIL temporarily until the bug is fixed. llvm-svn: 346840
* [WebAssembly] Add support for the event sectionHeejin Ahn2018-11-141-0/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This adds support for the 'event section' specified in the exception handling proposal. (This was named 'exception section' first, but later renamed to 'event section' to take possibilities of other kinds of events into consideration. But currently we only store exception info in this section.) The event section is added between the global section and the export section. This is for ease of validation per request of the V8 team. This patch: - Creates the event symbol type, which is a weak symbol - Makes 'throw' instruction take the event symbol '__cpp_exception' - Adds relocation support for events - Adds WasmObjectWriter / WasmObjectFile (Reader) support - Adds obj2yaml / yaml2obj support - Adds '.eventtype' printing support Reviewers: dschuff, sbc100, aardappel Subscribers: jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D54096 llvm-svn: 346825
* [WebAssembly] Added WasmAsmParser.Wouter van Oortmerssen2018-11-121-0/+3
| | | | | | | | | | | | | | | | | | | | | | | Summary: This is to replace the ELFAsmParser that WebAssembly was using, which so far was a stub that didn't do anything, and couldn't work correctly with wasm. This new class is there to implement generic directives related to wasm as a binary format. Wasm target specific directives are still parsed in WebAssemblyAsmParser as before. The two classes now cooperate more correctly too. Also implemented .result which was missing. Any unknown directives will now result in errors. Reviewers: dschuff, sbc100 Subscribers: mgorny, jgravelle-google, eraman, aheejin, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D54360 llvm-svn: 346700
* [MC] Fix 3 objdump tests after rL346610Fangrui Song2018-11-111-4/+4
| | | | llvm-svn: 346617
* [WebAssembly] Renumber and LEB128-encode SIMD opcodesThomas Lively2018-11-091-277/+277
| | | | | | | | | | Reviewers: aheejin, dschuff, aardappel Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D54126 llvm-svn: 346463
* [WebAssembly] Parsing missing directives to produce valid .oWouter van Oortmerssen2018-11-021-1/+7
| | | | | | | | | | | | | | | | | | | | | | | Summary: The assembler was able to assemble and then dump back to .s, but was failing to parse certain directives necessary for valid .o output: - .type directives are now recognized to distinguish function symbols and others. - .size is now parsed to provide function size. - .globaltype (introduced in https://reviews.llvm.org/D54012) is now recognized to ensure symbols like __stack_pointer have a proper type set for both .s and .o output. Also added tests for the above. Reviewers: sbc100, dschuff Subscribers: jgravelle-google, aheejin, dexonsmith, kristina, llvm-commits, sunfish Differential Revision: https://reviews.llvm.org/D53842 llvm-svn: 346047
* [WebAssembly] Fix signature parsing for 'try' in AsmParserHeejin Ahn2018-11-011-1/+15
| | | | | | | | | | | | | | | Summary: Like `block` or `loop`, `try` can take an optional signature which can be omitted. This patch allows `try`'s signature to be omitted. Also added some tests for EH instructions. Reviewers: aardappel Subscribers: dschuff, sbc100, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D53873 llvm-svn: 345888
* Delete test case. Assertions can't be tested.Heejin Ahn2018-10-251-11/+0
| | | | llvm-svn: 345336
* Tidy up test caseHeejin Ahn2018-10-251-2/+0
| | | | llvm-svn: 345335
* Address commentsHeejin Ahn2018-10-251-0/+13
| | | | | | | - Add llvm-mc test case (and delete the old one) - Change report_fatal_error to assertions llvm-svn: 345334
* [WebAssembly] Change tabs to spaces in basic-assembly.sHeejin Ahn2018-10-211-2/+2
| | | | llvm-svn: 344866
* [WebAssembly] SIMD min and maxThomas Lively2018-10-131-0/+12
| | | | | | | | | | | | Summary: Depends on D52324 and D52764. Reviewers: aheejin, dschuff Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D52325 llvm-svn: 344438
* [WebAssembly] Saturating arithmetic intrinsicsThomas Lively2018-10-051-0/+24
| | | | | | | | | | | | Summary: Depends on D52805. Reviewers: aheejin, dschuff Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D52813 llvm-svn: 343833
OpenPOWER on IntegriCloud