summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/WebAssembly
Commit message (Collapse)AuthorAgeFilesLines
* [WebAssembly] Change std::sort to llvm::sort in response to r327219Mandeep Singh Grang2018-04-091-10/+10
| | | | | | | | | | | | | | | | | | | | | | Summary: r327219 added wrappers to std::sort which randomly shuffle the container before sorting. This will help in uncovering non-determinism caused due to undefined sorting order of objects having the same key. To make use of that infrastructure we need to invoke llvm::sort instead of std::sort. Note: This patch is one of a series of patches to replace *all* std::sort to llvm::sort. Refer the comments section in D44363 for a list of all the required patches. Reviewers: sunfish, RKSimon Reviewed By: sunfish Subscribers: jfb, dschuff, sbc100, jgravelle-google, aheejin, llvm-commits Differential Revision: https://reviews.llvm.org/D44873 llvm-svn: 329607
* [WebAssembly] Allow for the creation of user-defined custom sectionsSam Clegg2018-04-051-1/+22
| | | | | | | | | | | | | This patch adds a way for users to create their own custom sections to be added to wasm files. At the LLVM IR layer, they are defined through the "wasm.custom_sections" named metadata. The expected use case for this is bindings generators such as wasm-bindgen. Patch by Dan Gohman Differential Revision: https://reviews.llvm.org/D45297 llvm-svn: 329315
* [WebAssembly] Only write 32-bits for WebAssembly::OPERAND_OFFSET32Sam Clegg2018-04-041-0/+5
| | | | | | | | | A bug was found where an offset of -1 would generate an encoding of max int64 which is invalid in the binary format. Differential Revision: https://reviews.llvm.org/D45280 llvm-svn: 329238
* Sort targetgen calls in lib/Target/*/CMakeLists.Nico Weber2018-04-041-1/+2
| | | | | | | | | | | Makes it easier to see mistakes such as the one fixed in r329178 and makes the different target CMakeLists more consistent. Also remove some stale-looking comments from the Nios2 target cmakefile. No intended behavior change. llvm-svn: 329181
* [CodeGen]Add NoVRegs property on PostRASink and ShrinkWrapJun Bum Lim2018-04-031-3/+2
| | | | | | | | | | | | | | | | | Summary: This change declare that PostRAMachineSinking and ShrinkWrap require NoVRegs property, so now the MachineFunctionPass can enforce this check. These passes are disabled in NVPTX & WebAssembly. Reviewers: dschuff, jlebar, tra, jgravelle-google, MatzeB, sebpop, thegameg, mcrosier Reviewed By: dschuff, thegameg Subscribers: jholewinski, jfb, sbc100, aheejin, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D45183 llvm-svn: 329095
* [WebAssembly] Register wasm passes with the PassRegistryJacob Gravelle2018-03-3021-4/+107
| | | | | | | | | | | | | | Summary: This exposes WebAssembly passes for use on the command line (as arguments to -print-before and the like). Reviewers: dschuff, sunfish Subscribers: MatzeB, jfb, sbc100, llvm-commits, aheejin Differential Revision: https://reviews.llvm.org/D45103 llvm-svn: 328901
* [WebAssembly] Refactor tablegen for store instructions (NFC)Derek Schuff2018-03-301-194/+115
| | | | | | | | Summary: Add patterns similar to loads. Differential Revision: https://reviews.llvm.org/D45064 llvm-svn: 328876
* Transforms: Introduce Transforms/Utils.h rather than spreading the ↵David Blaikie2018-03-281-0/+1
| | | | | | | | | declarations amongst Scalar.h and IPO.h Fixes layering - Transforms/Utils shouldn't depend on including a Scalar or IPO header, because Scalar and IPO depend on Utils. llvm-svn: 328717
* Fix layering of MachineValueType.h by moving it from CodeGen to SupportDavid Blaikie2018-03-232-2/+2
| | | | | | | | | This is used by llvm tblgen as well as by LLVM Targets, so the only common place is Support for now. (maybe we need another target for these sorts of things - but for now I'm at least making them correct & we can make them better if/when people have strong feelings) llvm-svn: 328395
* [WebAssembly] Really disable wasm register name matcherReid Kleckner2018-03-212-8/+5
| | | | | | | | The "ShouldEmitMatchRegisterName" bit wasn't taking effect because the WebAssembly target didn't point to the custom WebAssemblyAsmParser record. llvm-svn: 328155
* [WebAssembly] Suppress unused function warning for register name matcherReid Kleckner2018-03-211-0/+4
| | | | llvm-svn: 328112
* [WebAssembly] Update torture compile test expectationsDerek Schuff2018-03-201-6/+0
| | | | | | The tests compile after r328049 llvm-svn: 328057
* [WebAssembly] Strip threadlocal attribute from globals in single thread modeDerek Schuff2018-03-201-2/+20
| | | | | | | | | The default thread model for wasm is single, and in this mode thread-local global variables can be lowered identically to non-thread-local variables. Differential Revision: https://reviews.llvm.org/D44703 llvm-svn: 328049
* [WebAssembly] Added initial AsmParser implementation.Derek Schuff2018-03-208-7/+610
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It uses the MC framework and the tablegen matcher to do the heavy lifting. Can handle both explicit and implicit locals (-disable-wasm-explicit-locals). Comes with a small regression test. This is a first basic implementation that can parse most llvm .s output and round-trips most instructions succesfully, but in order to keep the commit small, does not address all issues. There are a fair number of mismatches between what MC / assembly matcher think a "CPU" should look like and what WASM provides, some already have workarounds in this commit (e.g. the way it deals with register operands) and some that require further work. Some of that further work may involve changing what the Disassembler outputs (and what s2wasm parses), so are probably best left to followups. Some known things missing: - Many directives are ignored and not emitted. - Vararg calls are parsed but extra args not emitted. - Loop signatures are likely incorrect. - $drop= is not emitted. - Disassembler does not output SIMD types correctly, so assembler can't test them. Patch by Wouter van Oortmerssen Differential Revision: https://reviews.llvm.org/D44329 llvm-svn: 328028
* [WebAssembly] Add DebugLoc information to WebAssembly block and loop.Derek Schuff2018-03-151-8/+11
| | | | | | | Patch by Yury Delendik Differential Revision: https://reviews.llvm.org/D44448 llvm-svn: 327673
* [WebAssembly] Add except_ref as a first-class typeHeejin Ahn2018-03-0811-14/+89
| | | | | | | | | | | | Summary: Add except_ref as a first-class type, according to the [[https://github.com/WebAssembly/exception-handling/blob/master/proposals/Level-1.md | Level 1 exception handling proposal ]]. Reviewers: dschuff Subscribers: jfb, sbc100, llvm-commits Differential Revision: https://reviews.llvm.org/D43706 llvm-svn: 326985
* [WebAssembly] Avoid cast ExprType to wasm::ValTypeSam Clegg2018-03-021-31/+30
| | | | | | | | | | | This cast was causing invalid signatures to be written for libcall functions. Add an MC test which includes a call to builtin memcpy. Differential Revision: https://reviews.llvm.org/D44037 llvm-svn: 326618
* Reland "[WebAssembly] More uses of uint8_t for single byte values"Heejin Ahn2018-03-022-14/+14
| | | | | | | | | | | | | | Summary: Original change was D43991 (rL326541) and was reverted by rL326571 and rL326572. This adds also the necessary MCCodeEmitter patch. Reviewers: sbc100 Subscribers: jfb, dschuff, sbc100, jgravelle-google, sunfish, llvm-commits, ncw Differential Revision: https://reviews.llvm.org/D44034 llvm-svn: 326614
* Revert "[WebAssembly] More uses of uint8_t" and "[WebAssembly] Update tests"Nicholas Wilson2018-03-021-13/+13
| | | | | | | | | | This reverts commits r326541 and r326571. The tests were correct, and were updated with incorrect expectations. The original commit was broken and should be reverted to get things back to a working state. llvm-svn: 326572
* [WebAssembly] More uses of uint8_t for single byte valuesHeejin Ahn2018-03-021-13/+13
| | | | | | | | | | | | Summary: It looks like this was missing from D43921. Reviewers: sbc100 Subscribers: jfb, dschuff, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D43991 llvm-svn: 326541
* [WebAssembly] Gather EH instructions in one place. NFC.Heejin Ahn2018-03-021-10/+20
| | | | | | | | | | | | | | | Summary: - Gather EH instructions in one place for easy tracking (more will be added later) - Variable name change Reviewers: dschuff Subscribers: jfb, sbc100, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D43742 llvm-svn: 326522
* [WebAssembly] Fix broken gcc build after rL326454Sam Clegg2018-03-011-1/+2
| | | | | | | The gcc builders were broken by rL326454 See: https://reviews.llvm.org/D43921 llvm-svn: 326460
* [WebAssembly] Use uint8_t for single byte values to match the specSam Clegg2018-03-012-4/+4
| | | | | | | | | | | | | The original BinaryEncoding.md document used to specify that these values were `varint7`, but the official spec lists them explicitly as single byte values and not LEB. A similar change for wabt is in flight: https://github.com/WebAssembly/wabt/pull/782 Differential Revision: https://reviews.llvm.org/D43921 llvm-svn: 326454
* [WebAssembly] Relax constexpr for old standard libraries.Benjamin Kramer2018-02-261-1/+1
| | | | | | | | This will still be constexpr when the standard library supports it, but doesn't force constexpr. Old libraries will get a global constructor, which is not too bad. llvm-svn: 326080
* [WebAssembly] Add exception handling option and featureHeejin Ahn2018-02-246-9/+20
| | | | | | | | | | | | | | Summary: Add a llc command line option and WebAssembly architecture feature for exception handling. Reviewers: dschuff Subscribers: jfb, sbc100, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D43683 llvm-svn: 326004
* [WebAssembly] Fix macro metaprogram to not duplicate code as much.Benjamin Kramer2018-02-231-7/+11
| | | | | | No functionality change intended. llvm-svn: 325947
* [WebAssembly] Add first claass symbol table to wasm objectsSam Clegg2018-02-232-6/+13
| | | | | | | | | | | | | | | | | | | | This is combination of two patches by Nicholas Wilson: 1. https://reviews.llvm.org/D41954 2. https://reviews.llvm.org/D42495 Along with a few local modifications: - One change I made was to add the UNDEFINED bit to the binary format to avoid the extra byte used when writing data symbols. Although this bit is redundant for other symbols types (i.e. undefined can be implied if a function or global is a wasm import) - I prefer to be explicit and consistent and not have derived flags. - Some field renaming. - Some reverting of unrelated minor changes. - No test output differences. Differential Revision: https://reviews.llvm.org/D43147 llvm-svn: 325860
* Fix the build of the wasm backend.Benjamin Kramer2018-02-221-2/+2
| | | | | | | toString conflicts with llvm::toString here. Yay for overly generic function names. llvm-svn: 325833
* [WebAssembly] MC: Make explicit our current lack of support for relocations ↵Sam Clegg2018-02-161-4/+2
| | | | | | | | | | | | against unnamed temporary symbols. Add an explicit check before looking up symbol in SymbolIndices. This was previously silently succeeding and returning zero for such unnamed temporaries. Differential Revision: https://reviews.llvm.org/D43365 llvm-svn: 325367
* [WebAssembly] Fix casting MCSymbol to MCSymbolWasm on ELFJacob Gravelle2018-02-121-3/+5
| | | | | | | | | | | | | | Summary: wasm32-unknown-unknown-elf has MCSymbols that are not MCSymbolWasms, so we need a non-asserting cast here. Reviewers: dschuff, sunfish Subscribers: jfb, sbc100, aheejin, llvm-commits Differential Revision: https://reviews.llvm.org/D43205 llvm-svn: 324942
* [WebAssembly] Add mechanisms for specifying an explicit import module name.Dan Gohman2018-02-093-2/+29
| | | | | | | | | | | | | | | | | | | | This adds a wasm-import-module function attribute and a .import_module assembler directive, for specifying module import names for WebAssembly. Currently these may only be used for function symbols; global variables may be considered in the future. WebAssembly has a two-level namespace scheme for symbols, and it's normally the linker's job to assign the module name, which is the first-level name. The attributes here allow users to specify their own module names explicitly, which is useful for tools generating bindings to modules defined in other languages. This feature is not fully usable yet. It will evolve along with the ongoing symbol table and lld changes. Differential Revision: https://reviews.llvm.org/D42520 llvm-svn: 324778
* [WebAssembly] Add an LLVM_FALLTHROUGH to address a warning. NFC.Dan Gohman2018-02-091-0/+1
| | | | llvm-svn: 324777
* [WebAssembly] MC: Remove unused code for handling of wasm globalsSam Clegg2018-01-312-56/+0
| | | | | | | | | | | | | | | For now, we are not using wasm globals, except for modeling of the stack points. Alos, factor out common struct WasmGlobalType, which matches the name for that tuple in the Wasm spec and rename methods to "isBindingGlobal", "isTypeGlobal" to avoid ambiguity. Patch by Nicholas Wilson! Differential Revision: https://reviews.llvm.org/D42750 llvm-svn: 323901
* [SelectionDAGISel] Add a debug print before call to Select. Adjust where ↵Craig Topper2018-01-261-5/+0
| | | | | | | | | | | | blank lines are printed during isel process to make things more sensibly grouped. Previously some targets printed their own message at the start of Select to indicate what they were selecting. For the targets that didn't, it means there was no print of the root node before any custom handling in the target executed. So if the target did something custom and never called SelectNodeCommon, no print would be made. For the targets that did print a message in Select, if they didn't custom handle a node SelectNodeCommon would reprint the root node before walking the isel table. It seems better to just print the message before the call to Select so all targets behave the same. And then remove the root node printing from SelectNodeCommon and just leave a message that says we're starting the table search. There were also some oddities in blank line behavior. Usually due to a \n after a call to SelectionDAGNode::dump which already inserted a new line. llvm-svn: 323551
* [NFC] fix trivial typos in comments and documentsHiroshi Inoue2018-01-261-1/+1
| | | | | | "in in" -> "in", "on on" -> "on" etc. llvm-svn: 323508
* [WebAssembly] Add mem.* intrinsics.Dan Gohman2018-01-231-0/+9
| | | | | | | | | | | | The grow_memory and current_memory instructions are expected to be officially renamed to mem.grow and mem.size. Introduce new intrinsics with the new names. These new names aren't yet official, so for now, use them at your own risk. Also, take this opportunity to add arguments for the currently unused immediate field in those instructions. llvm-svn: 323222
* [WebAssembly] Fix MSVC buildDerek Schuff2018-01-201-5/+6
| | | | | | nullptr_t can't be used left of boolean && llvm-svn: 323012
* [WebAssembly] Fix libcall signature lookupDerek Schuff2018-01-191-13/+14
| | | | | | | | | | | | | | | | | RuntimeLibcallSignatures previously manually initialized all the libcall names into an array and searched it linearly for the first match to lookup the corresponding index. r322802 switched that to initializing a map keyed by the libcall name. Neither of these approaches works correctly because some libcall numbers use the same name on different platforms (e.g. the "l" suffixed functions use f80 or f128 or ppcf128). This change fixes that by ensuring that each name only goes into the map once. It also adds tests. Differential Revision: https://reviews.llvm.org/D42271 llvm-svn: 322971
* [WebAssembly] Make sign-extension opcodes a distinct feature.Dan Gohman2018-01-196-6/+20
| | | | | | | | | | Sign-extension opcodes have been split into a separate proposal from the main threads proposal, so switch them to their own target feature. See: https://github.com/WebAssembly/sign-extension-ops llvm-svn: 322966
* [WebAssembly] Add test expectations for gcc C++ tests (gcc/testsuite/g++.dg)Sam Clegg2018-01-191-0/+50
| | | | | | Differential Revision: https://reviews.llvm.org/D42226 llvm-svn: 322915
* [WebAssembly] Remove duplicated RTLIB namesDerek Schuff2018-01-181-976/+394
| | | | | | | | | | | | | | Remove the tight coupling between llvm/CodeGenRuntimeLibcalls.def and the table of supported singatures for wasm. This will allow adding new libcalls without changing wasm's signature table. Also, some cleanup: Use ManagedStatics instead of const tables to avoid memory/binary bloat. Use a StringMap instead of a linear search for name lookup. Differential Revision: https://reviews.llvm.org/D35592 llvm-svn: 322802
* Add support for emitting libcalls for x86_fp80 -> fp128 and vice-versaBenjamin Kramer2018-01-171-0/+4
| | | | | | compiler_rt doesn't provide them (yet), but libgcc does. PR34076. llvm-svn: 322772
* [WebAssembly] Update README.txt.Dan Gohman2018-01-151-13/+41
| | | | | | | Describe more of the current status, mention Rust as another easy way to use this backend, and add more documentation links. llvm-svn: 322508
* [WebAssembly] Update libcall signature listsDerek Schuff2018-01-091-0/+60
| | | | | | New signatures added in r322087. A fix for this tight coupling is forthcoming. llvm-svn: 322105
* Fix build of WebAssembly and AVR backends after r321692Alex Bradbury2018-01-031-2/+2
| | | | | | | As experimental backends, I didn't have them configured to build in my local build config. llvm-svn: 321696
* Avoid int to string conversion in Twine or raw_ostream contexts.Benjamin Kramer2017-12-281-1/+1
| | | | | | Some output changes from uppercase hex to lowercase hex, no other functionality change intended. llvm-svn: 321526
* (Re-landing) Expose a TargetMachine::getTargetTransformInfo functionSanjoy Das2017-12-222-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Re-land r321234. It had to be reverted because it broke the shared library build. The shared library build broke because there was a missing LLVMBuild dependency from lib/Passes (which calls TargetMachine::getTargetIRAnalysis) to lib/Target. As far as I can tell, this problem was always there but was somehow masked before (perhaps because TargetMachine::getTargetIRAnalysis was a virtual function). Original commit message: This makes the TargetMachine interface a bit simpler. We still need the std::function in TargetIRAnalysis to avoid having to add a dependency from Analysis to Target. See discussion: http://lists.llvm.org/pipermail/llvm-dev/2017-December/119749.html I avoided adding all of the backend owners to this review since the change is simple, but let me know if you feel differently about this. Reviewers: echristo, MatzeB, hfinkel Reviewed By: hfinkel Subscribers: jholewinski, jfb, arsenm, dschuff, mcrosier, sdardis, nemanjai, nhaehnle, javed.absar, sbc100, jgravelle-google, aheejin, kbarton, llvm-commits Differential Revision: https://reviews.llvm.org/D41464 llvm-svn: 321375
* Revert "Expose a TargetMachine::getTargetTransformInfo function"Sanjoy Das2017-12-212-4/+6
| | | | | | This reverts commit r321234. It breaks the -DBUILD_SHARED_LIBS=ON build. llvm-svn: 321243
* Expose a TargetMachine::getTargetTransformInfo functionSanjoy Das2017-12-212-6/+4
| | | | | | | | | | | | | | | | | | | | | | | Summary: This makes the TargetMachine interface a bit simpler. We still need the std::function in TargetIRAnalysis to avoid having to add a dependency from Analysis to Target. See discussion: http://lists.llvm.org/pipermail/llvm-dev/2017-December/119749.html I avoided adding all of the backend owners to this review since the change is simple, but let me know if you feel differently about this. Reviewers: echristo, MatzeB, hfinkel Reviewed By: hfinkel Subscribers: jholewinski, jfb, arsenm, dschuff, mcrosier, sdardis, nemanjai, nhaehnle, javed.absar, sbc100, jgravelle-google, aheejin, kbarton, llvm-commits Differential Revision: https://reviews.llvm.org/D41464 llvm-svn: 321234
* [WebAssembly] Disable tee_local optimizations when targeting the ELF ABI.Dan Gohman2017-12-201-1/+9
| | | | | | | These optimizations depend on the ExplicitLocals pass to lower TEE instructions, which is disabled in the ELF ABI, so disable them too. llvm-svn: 321131
OpenPOWER on IntegriCloud