summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/WebAssembly
Commit message (Collapse)AuthorAgeFilesLines
...
* [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
* Fix Wasm as a follow up to r321035 and the other oneReid Kleckner2017-12-191-1/+7
| | | | | | | This array is tightly coupled with the .def file. Someone should look into fixing that. llvm-svn: 321050
* Fix WebAssembly backend for some LLVM API changesDavid Blaikie2017-12-156-11/+10
| | | | llvm-svn: 320893
* [WebAssembly] Implement @llvm.global_ctors and @llvm.global_dtorsSam Clegg2017-12-154-0/+196
| | | | | | | | | | | | | | | Summary: - lowers @llvm.global_dtors by adding @llvm.global_ctors functions which register the destructors with `__cxa_atexit`. - impements @llvm.global_ctors with wasm start functions and linker metadata See [here](https://github.com/WebAssembly/tool-conventions/issues/25) for more background. Subscribers: jfb, dschuff, mgorny, jgravelle-google, aheejin, sunfish Differential Revision: https://reviews.llvm.org/D41211 llvm-svn: 320774
* Rename LiveIntervalAnalysis.h to LiveIntervals.hMatthias Braun2017-12-136-7/+7
| | | | | | | | | | Headers/Implementation files should be named after the class they declare/define. Also eliminated an `#include "llvm/CodeGen/LiveIntervalAnalysis.h"` in favor of `class LiveIntarvals;` llvm-svn: 320546
* [WebAssembly] Reapply r319186: "Support bitcasted function addresses with ↵Dan Gohman2017-12-081-1/+1
| | | | | | | | | 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
* [WebAssemby] Re-apply r320041: "Support main functions with alternate ↵Dan Gohman2017-12-081-1/+50
| | | | | | | | | | signatures." This includes a fix so that it doesn't transform declarations, and it puts the functionality under control of a command-line option which is off by default to avoid breaking existing setups. llvm-svn: 320196
* Revert "[WebAssemby] Support main functions with alternate signatures."Derek Schuff2017-12-081-45/+1
| | | | | | | | | This reverts commit 959e37e669b0c3cfad4cb9f1f7c9261ce9f5e9ae. That commit doesn't handle the case where main is declared rather than defined, in particular the even-more special case where main is a prototypeless declaration (which is of course the one actually used by musl currently). llvm-svn: 320121
* [WebAssemby] Support main functions with alternate signatures.Dan Gohman2017-12-071-1/+45
| | | | | | | | | | WebAssembly requires caller and callee signatures to match, so the usual C runtime trick of calling main and having it just work regardless of whether main is defined as '()' or '(int argc, char *argv[])' doesn't work. Extend the FixFunctionBitcasts pass to rewrite main to use the latter form. llvm-svn: 320041
* [WebAssembly] Don't try to emit size information for unsized typesDan Gohman2017-12-071-5/+7
| | | | | | | | | | Patch by John Sully! Fixes PR35164. Differential Revision: https://reviews.llvm.org/D39519 llvm-svn: 319991
* [WebAssembly] Remove WASM_STACK_POINTER.Dan Gohman2017-12-063-28/+0
| | | | | | | WASM_STACK_POINTER and the .stack_pointer directive are no longer needed now that the stack pointer global is an import. llvm-svn: 319956
* [WebAssembly] Only emit stack pointer delcaration in BinFormatWasm assemblyDerek Schuff2017-12-061-2/+4
| | | | llvm-svn: 319870
* [WebAssembly] Implement WASM_STACK_POINTER.Dan Gohman2017-12-053-9/+14
| | | | | | | Use the .stack_pointer directive to implement WASM_STACK_POINTER for specifying a global variable to be the stack pointer. llvm-svn: 319797
* [WebAssembly] Don't emit .import_global for the wasm target.Dan Gohman2017-12-051-1/+2
| | | | | | | .import_global is used by the ELF-based target and not needed by the wasm target. llvm-svn: 319796
* [CodeGen] Unify MBB reference format in both MIR and debug outputFrancis Visoiu Mistrih2017-12-041-2/+1
| | | | | | | | | | | | | | | | As part of the unification of the debug format and the MIR format, print MBB references as '%bb.5'. The MIR printer prints the IR name of a MBB only for block definitions. * find . \( -name "*.mir" -o -name "*.cpp" -o -name "*.h" -o -name "*.ll" \) -type f -print0 | xargs -0 sed -i '' -E 's/BB#" << ([a-zA-Z0-9_]+)->getNumber\(\)/" << printMBBReference(*\1)/g' * find . \( -name "*.mir" -o -name "*.cpp" -o -name "*.h" -o -name "*.ll" \) -type f -print0 | xargs -0 sed -i '' -E 's/BB#" << ([a-zA-Z0-9_]+)\.getNumber\(\)/" << printMBBReference(\1)/g' * find . \( -name "*.txt" -o -name "*.s" -o -name "*.mir" -o -name "*.cpp" -o -name "*.h" -o -name "*.ll" \) -type f -print0 | xargs -0 sed -i '' -E 's/BB#([0-9]+)/%bb.\1/g' * grep -nr 'BB#' and fix Differential Revision: https://reviews.llvm.org/D40422 llvm-svn: 319665
* [WebAssembly] Revert r319186 "Support bitcasted function addresses with ↵Dan Gohman2017-11-301-0/+5
| | | | | | | | | | | 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] Update test expectations for gcc torture testsSam Clegg2017-11-291-6/+0
| | | | | | | | | I believe these were recently fixed by: https://reviews.llvm.org/rL319186 Differential Revision: https://reviews.llvm.org/D40619 llvm-svn: 319380
* [WebAssembly] Fix fptoui lowering boundsDan Gohman2017-11-292-14/+47
| | | | | | | To fully avoid trapping on wasm, fptoui needs a second check to ensure that the operand isn't below the supported range. llvm-svn: 319354
* [WebAssembly] Support bitcasted function addresses with varargs.Dan Gohman2017-11-281-6/+5
| | | | | | | | | | | | | 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] Handle errors better in fast-isel.Dan Gohman2017-11-281-12/+40
| | | | | | | | | Fast-isel routines need to bail out in the case that fast-isel fails on the operands. This fixes https://bugs.llvm.org/show_bug.cgi?id=35064 llvm-svn: 319144
* [WebAssembly] Fix trapping behavior in fptosi/fptoui.Dan Gohman2017-11-288-19/+227
| | | | | | | | | | | | This adds code to protect WebAssembly's `trunc_s` family of opcodes from values outside their domain. Even though such conversions have full undefined behavior in C/C++, LLVM IR's `fptosi` and `fptoui` do not, and only return undef. This also implements the proposed non-trapping float-to-int conversion feature and uses that instead when available. llvm-svn: 319128
* Fix a bunch more layering of CodeGen headers that are in TargetDavid Blaikie2017-11-174-4/+4
| | | | | | | | All these headers already depend on CodeGen headers so moving them into CodeGen fixes the layering (since CodeGen depends on Target, not the other way around). llvm-svn: 318490
* Try to fix WebAssembly build after r318352Reid Kleckner2017-11-161-2/+2
| | | | llvm-svn: 318355
* [WebAssembly] Update test expectationsSam Clegg2017-11-081-14/+3
| | | | | | | | I believe these were fixed in rL317707 Differential Revision: https://reviews.llvm.org/D39813 llvm-svn: 317718
* [WebAssembly] Call signExtend to get sign extended registerDan Gohman2017-11-081-1/+1
| | | | | | | | Patch by Jatin Bhateja! Differential Revision: https://reviews.llvm.org/D39529 llvm-svn: 317710
* [WebAssembly] Revise the strategy for inline asm.Dan Gohman2017-11-082-6/+25
| | | | | | | | | | | | | | | | | | | | | | Previously, an "r" constraint would mean the compiler provides a value on WebAssembly's operand stack. This was tricky to use properly, particularly since it isn't possible to declare a new local from within an inline asm string. With this patch, "r" provides the value in a WebAssembly local, and the local index is provided to the inline asm string. This requires inline asm to use get_local and set_local to read the register. This does potentially result in larger code size, however inline asm should hopefully be quite rare in WebAssembly. This also means that the "m" constraint can no longer be supported, as WebAssembly has nothing like a "memory operand" that includes an implicit get_local. This fixes PR34599 for the wasm32-unknown-unknown-wasm target (though not for the ELF target). llvm-svn: 317707
* Target/TargetInstrInfo.h -> CodeGen/TargetInstrInfo.h to match layeringDavid Blaikie2017-11-081-1/+1
| | | | | | | | This header includes CodeGen headers, and is not, itself, included by any Target headers, so move it into CodeGen to match the layering of its implementation. llvm-svn: 317647
OpenPOWER on IntegriCloud