summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/WebAssembly
Commit message (Collapse)AuthorAgeFilesLines
...
* Move TargetFrameLowering.h to CodeGen where it's implementedDavid Blaikie2017-11-032-2/+2
| | | | | | | | | | | This header already includes a CodeGen header and is implemented in lib/CodeGen, so move the header there to match. This fixes a link error with modular codegeneration builds - where a header and its implementation are circularly dependent and so need to be in the same library, not split between two like this. llvm-svn: 317379
* WebassemblyAsmPrinter.h: Include WebAssemblyMachineFunctionInfo for use with ↵David Blaikie2017-10-241-1/+1
| | | | | | MachineFunction::getInfo llvm-svn: 316507
* [WebAssembly] MC: Fix crash when -g specified.Sam Clegg2017-10-201-4/+4
| | | | | | | | | At this point we don't output any debug sections or thier relocations. Differential Revision: https://reviews.llvm.org/D39076 llvm-svn: 316240
* Revert "TargetMachine: Merge TargetMachine and LLVMTargetMachine"Matthias Braun2017-10-122-5/+6
| | | | | | | | | | Reverting to investigate layering effects of MCJIT not linking libCodeGen but using TargetMachine::getNameWithPrefix() breaking the lldb bots. This reverts commit r315633. llvm-svn: 315637
* TargetMachine: Merge TargetMachine and LLVMTargetMachineMatthias Braun2017-10-122-6/+5
| | | | | | | | | | | | | | | Merge LLVMTargetMachine into TargetMachine. - There is no in-tree target anymore that just implements TargetMachine but not LLVMTargetMachine. - It should still be possible to stub out all the various functions in case a target does not want to use lib/CodeGen - This simplifies the code and avoids methods ending up in the wrong interface. Differential Revision: https://reviews.llvm.org/D38489 llvm-svn: 315633
* [WebAssembly] Update MCObjectWriter and associated interfaces after r315327Derek Schuff2017-10-104-13/+22
| | | | llvm-svn: 315335
* [WebAssembly] Narrow the scope of WebAssemblyFixFunctionBitcastsJacob Gravelle2017-10-101-1/+11
| | | | | | | | | | | | | | | | | Summary: The pass to fix function bitcasts generates thunks for functions that are called directly with a mismatching signature. It was also generating thunks in cases where the function was address-taken, causing aliasing problems in otherwise valid cases. This patch tightens the restrictions for when the pass runs. Reviewers: sunfish, dschuff Subscribers: jfb, sbc100, llvm-commits, aheejin Differential Revision: https://reviews.llvm.org/D38640 llvm-svn: 315326
* [MC] Plumb unique_ptr<MCWasmObjectTargetWriter> through createWasmObjectWriterLang Hames2017-10-101-2/+2
| | | | | | | | | | to WasmObjectWriter's constructor. Fixes the same ownership issue for COFF that r315245 did for MachO: WasmObjectWriter takes ownership of its MCWasmObjectTargetWriter, so we want to pass this through to the constructor via a unique_ptr, rather than a raw ptr. llvm-svn: 315260
* Fix Wasm build after r315254Reid Kleckner2017-10-101-3/+2
| | | | llvm-svn: 315258
* [WebAssembly] Add the rest of the atomic loadsDerek Schuff2017-10-054-56/+198
| | | | | | | | | | Add extending loads and constant offset patterns A bit more refactoring of the tablegen to make the patterns fairly nice and uniform between the regular and atomic loads. Differential Revision: https://reviews.llvm.org/D38523 llvm-svn: 315022
* Change encodeU/SLEB128 to pad to certain number of bytesSam Clegg2017-09-151-5/+2
| | | | | | | | | | | | | | | Previously the 'Padding' argument was the number of padding bytes to add. However most callers that use 'Padding' know how many overall bytes they need to write. With the previous code this would mean encoding the LEB once to find out how many bytes it would occupy and then using this to calulate the 'Padding' value. See: https://reviews.llvm.org/D36595 Differential Revision: https://reviews.llvm.org/D37494 llvm-svn: 313393
* [WebAssembly] Add sign extend instructions from atomics proposalDerek Schuff2017-09-132-2/+24
| | | | | | | | | | Select them from ISD::SIGN_EXTEND_INREG Differential Revision: https://reviews.llvm.org/D37603 remove spurious change llvm-svn: 313101
* [WebAssembly] Update relocation names to match specSam Clegg2017-09-011-3/+3
| | | | | | | | Summary: See https://github.com/WebAssembly/tool-conventions/blob/master/Linking.md Differential Revision: https://reviews.llvm.org/D37385 llvm-svn: 312342
* [WebAssembly] Refactor load ISel tablegen patterns into classesDerek Schuff2017-08-312-327/+215
| | | | | | | | | Not all of these will be able to be used by atomics because tablegen, but it still seems like a good change by itself. Differential Revision: https://reviews.llvm.org/D37345 llvm-svn: 312287
* [WebAssembly] Add target feature for atomicsDerek Schuff2017-08-309-11/+31
| | | | | | | | | | Summary: This tracks the WebAssembly threads feature proposal at https://github.com/WebAssembly/threads/blob/master/proposals/threads/Overview.md Differential Revision: https://reviews.llvm.org/D37300 llvm-svn: 312145
* [WebAssembly] FastISel : Bail to SelectionDAG for constexpr callsJacob Gravelle2017-08-241-1/+4
| | | | | | | | | | | | | | 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] Update GCC test suite failure expectationsHeejin Ahn2017-08-241-0/+8
| | | | | | | | | | | | | | | | Summary: Update GCC test suite failure expectations as we add -O0 to the bare tests in WebAssembly waterfall. There are still several untriaged lld failures. Reviewers: sbc100, jgravelle-google, dschuff Reviewed By: dschuff Subscribers: jfb Differential Revision: https://reviews.llvm.org/D37100 llvm-svn: 311691
* Fix WebAssembly target after r309911.Daniel Jasper2017-08-033-16/+5
| | | | llvm-svn: 309922
* Change CallLoweringInfo::CS to be an ImmutableCallSite instead of a pointer. ↵Peter Collingbourne2017-07-261-1/+1
| | | | | | | | NFCI. This was a use-after-free waiting to happen. llvm-svn: 309159
* [SystemZ, LoopStrengthReduce]Jonas Paulsson2017-07-212-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes LSR generate better code for SystemZ in the cases of memory intrinsics, Load->Store pairs or comparison of immediate with memory. In order to achieve this, the following common code changes were made: * New TTI hook: LSRWithInstrQueries(), which defaults to false. Controls if LSR should do instruction-based addressing evaluations by calling isLegalAddressingMode() with the Instruction pointers. * In LoopStrengthReduce: handle address operands of memset, memmove and memcpy as address uses, and call isFoldableMemAccessOffset() for any LSRUse::Address, not just loads or stores. SystemZ changes: * isLSRCostLess() implemented with Insns first, and without ImmCost. * New function supportedAddressingMode() that is a helper for TTI methods looking at Instructions passed via pointers. Review: Ulrich Weigand, Quentin Colombet https://reviews.llvm.org/D35262 https://reviews.llvm.org/D35049 llvm-svn: 308729
* Add element atomic memset intrinsicDaniel Neilson2017-07-121-0/+11
| | | | | | | | | | | | | | Summary: Continuing the work from https://reviews.llvm.org/D33240, this change introduces an element unordered-atomic memset intrinsic. This intrinsic is essentially memset with the implementation requirement that all stores used for the assignment are done with unordered-atomic stores of a given element size. Reviewers: eli.friedman, reames, mkazantsev, skatkov Reviewed By: reames Subscribers: jfb, dschuff, sbc100, jgravelle-google, aheejin, efriedma, llvm-commits Differential Revision: https://reviews.llvm.org/D34885 llvm-svn: 307854
* [WebAssembly] Mark element atomic memcpy/memmove intrinsics as unsupportedHeejin Ahn2017-07-121-11/+10
| | | | | | | | | | | | | | | | Summary: Element atomic intrinsicAtomic instructions are not yet supported in WebAssembly, so we mark them as unsupported for the moment. Reviewers: sunfish, dschuff, sbc100 Reviewed By: dschuff, sbc100 Subscribers: jfb, sbc100, jgravelle-google Differential Revision: https://reviews.llvm.org/D35322 llvm-svn: 307841
* Fix to web assembly lib call listDaniel Neilson2017-07-121-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Revision 307796 caused an internal build break in WebAssembly bots in the form of a crash. ex: Here's the crash dump from one of the failing tests: /usr/local/google/home/blaikie/dev/llvm/build/default/./bin/llc < /usr/local/google/home/blaikie/dev/llvm/src/test/CodeGen/WebAssembly/global.ll -asm-verbose=false -disable-wasm-fallthrough-return-opt -disable-wasm-explicit-locals | /usr/local/google/home/blaikie/dev/llvm/build/default/./bin/FileCheck /usr/local/google/home/blaikie/dev/llvm/src/test/CodeGen/WebAssembly/global.ll -- Exit Code: 2 Command Output (stderr): -- Stack dump: 0. Program arguments: build/default/./bin/llc -asm-verbose=false -disable-wasm-fallthrough-return-opt -disable-wasm-explicit-locals 1. Running pass 'Function Pass Manager' on module '<stdin>'. 2. Running pass 'WebAssembly Assembly Printer' on function '@call_memcpy' FileCheck error: '-' is empty. FileCheck command line: build/default/./bin/FileCheck src/test/CodeGen/WebAssembly/global.ll The problem is in lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp. There’s an array declared: 545 static const char * Fix to web assembly lib call list Summary: Revision 307796 caused an internal build break in WebAssembly bots in the form of a crash. ex: Here's the crash dump from one of the failing tests: /usr/local/google/home/blaikie/dev/llvm/build/default/./bin/llc < /usr/local/google/home/blaikie/dev/llvm/src/test/CodeGen/WebAssembly/global.ll -asm-verbose=false -disable-wasm-fallthrough-return-opt -disable-wasm-explicit-locals | /usr/local/google/home/blaikie/dev/llvm/build/default/./bin/FileCheck /usr/local/google/home/blaikie/dev/llvm/src/test/CodeGen/WebAssembly/global.ll -- Exit Code: 2 Command Output (stderr): -- Stack dump: 0. Program arguments: build/default/./bin/llc -asm-verbose=false -disable-wasm-fallthrough-return-opt -disable-wasm-explicit-locals 1. Running pass 'Function Pass Manager' on module '<stdin>'. 2. Running pass 'WebAssembly Assembly Printer' on function '@call_memcpy' FileCheck error: '-' is empty. FileCheck command line: build/default/./bin/FileCheck src/test/CodeGen/WebAssembly/global.ll The problem is in lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp. There’s an array declared: static const char * RuntimeLibcallNames[RTLIB::UNKNOWN_LIBCALL] = { That is defining a runtime lib call name for each entry in the enum RTLIB:Libcall from include/llvm/CodeGen/RuntimeLibcalls.h. Revision 307796 added entries to the enum, but didn’t add entries to the RuntimeLibcallNames array, which caused a crash when attempting to access past the end of the array. This patch fixes the issue by adding the element atomic memmove to the WebAssembly arrays. Reviewed by: reames llvm-svn: 307831
* fix trivial typos; NFCHiroshi Inoue2017-07-091-1/+1
| | | | | | sucessor -> successor llvm-svn: 307488
* [WebAssembly] Fix types for address taken functionsSam Clegg2017-07-054-17/+28
| | | | | | Differential Revision: https://reviews.llvm.org/D34966 llvm-svn: 307198
* fix trivial typo; NFCHiroshi Inoue2017-06-301-1/+1
| | | | llvm-svn: 306798
* [WebAssembly] Add support for exception handling instructionsHeejin Ahn2017-06-301-5/+21
| | | | | | | | | | | | | | | | | | | Summary: This adds backend support for throw, rethrow, try, and try_end instructions. This needs the corresponding clang builtin support: https://reviews.llvm.org/D34783 This follows the Wasm exception handling proposal in https://github.com/WebAssembly/exception-handling/blob/master/proposals/Exceptions.md Reviewers: sunfish, dschuff Reviewed By: dschuff Subscribers: jfb, sbc100, jgravelle-google Differential Revision: https://reviews.llvm.org/D34826 llvm-svn: 306774
* [WebAssembly] Fix build after r306177Derek Schuff2017-06-241-10/+14
| | | | llvm-svn: 306190
* [WebAssembly] WebAssemblyFastISel getelementptr variable index supportJacob Gravelle2017-06-221-1/+19
| | | | | | | | | | | | | | Summary: Previously -fast-isel getelementptr would constant-fold non-constant i8 load/stores. Reviewers: sunfish Subscribers: jfb, dschuff, sbc100, llvm-commits Differential Revision: https://reviews.llvm.org/D34044 llvm-svn: 306060
* [wasm] Fix WebAssembly asm backend after r305968Reid Kleckner2017-06-221-10/+12
| | | | llvm-svn: 305978
* [WebAssembly] Use __stack_pointer global when writing wasm binarySam Clegg2017-06-167-65/+28
| | | | | | | | | | | | | | | | | | This ensures that symbolic relocations are generated for stack pointer manipulations. These relocations are of type R_WEBASSEMBLY_GLOBAL_INDEX_LEB. This change also adds support for reading relocations of this type in WasmObjectFile.cpp. Since its a globally imported symbol this does mean that the get_global/set_global instruction won't be valid until the objects are linked that global used in no longer an imported global. Differential Revision: https://reviews.llvm.org/D34172 llvm-svn: 305616
* [WebAssembly] Cleanup WebAssemblyWasmObjectWriterSam Clegg2017-06-132-16/+13
| | | | | | Differential Revision: https://reviews.llvm.org/D34131 llvm-svn: 305316
* [WebAssembly] Fix symbol type for addresses of external functionsSam Clegg2017-06-131-2/+8
| | | | | | | | | | | | | | These symbols were previously not being marked as functions so were appearing as globals instead, and with the incorrect relocation type. Without this fix, objects that take address of external functions include them as global imports rather than function imports which then fails at link time. Differential Revision: https://reviews.llvm.org/D34068 llvm-svn: 305263
* Const correctness for TTI::getRegisterBitWidthDaniel Neilson2017-06-122-2/+2
| | | | | | | | | | | | | | Summary: The method TargetTransformInfo::getRegisterBitWidth() is declared const, but the type erasing implementation classes (TargetTransformInfo::Concept & TargetTransformInfo::Model) that were introduced by Chandler in https://reviews.llvm.org/D7293 do not have the method declared const. This is an NFC to tidy up the const consistency between TTI and its implementation. Reviewers: chandlerc, rnk, reames Reviewed By: reames Subscribers: reames, jfb, arsenm, dschuff, nemanjai, nhaehnle, javed.absar, sbc100, jgravelle-google, llvm-commits Differential Revision: https://reviews.llvm.org/D33903 llvm-svn: 305189
* Move Object format code to lib/BinaryFormat.Zachary Turner2017-06-074-4/+4
| | | | | | | | | | | | This creates a new library called BinaryFormat that has all of the headers from llvm/Support containing structure and layout definitions for various types of binary formats like dwarf, coff, elf, etc as well as the code for identifying a file from its magic. Differential Revision: https://reviews.llvm.org/D33843 llvm-svn: 304864
* [WebAssembly] MC: Refactor relocation handlingSam Clegg2017-06-061-0/+7
| | | | | | | | | | | | | The change cleans up and unifies the handling of relocation entries in WasmObjectWriter. Type index relocation no longer need to be handled separately. The only externally visible change should be that type index relocations are no longer grouped at the end. Differential Revision: https://reviews.llvm.org/D33918 llvm-svn: 304816
* Sort the remaining #include lines in include/... and lib/....Chandler Carruth2017-06-0618-19/+19
| | | | | | | | | | | | | | | | | | | | | | | | | I did this a long time ago with a janky python script, but now clang-format has built-in support for this. I fed clang-format every line with a #include and let it re-sort things according to the precise LLVM rules for include ordering baked into clang-format these days. I've reverted a number of files where the results of sorting includes isn't healthy. Either places where we have legacy code relying on particular include ordering (where possible, I'll fix these separately) or where we have particular formatting around #include lines that I didn't want to disturb in this patch. This patch is *entirely* mechanical. If you get merge conflicts or anything, just ignore the changes in this patch and run clang-format over your #include lines in the files. Sorry for any noise here, but it is important to keep these things stable. I was seeing an increasing number of patches with irrelevant re-ordering of #include lines because clang-format was used. This patch at least isolates that churn, makes it easy to skip when resolving conflicts, and gets us to a clean baseline (again). llvm-svn: 304787
* [WebAssembly] MC: Fix references to undefined externals in data sectionSam Clegg2017-06-021-3/+0
| | | | | | | | | | | | Undefined externals don't need to have a size or an offset. This was broken by r303915. Added a test for this case. This fixes the "Compile LLVM Torture (o)" step on the wasm waterfall. Differential Revision: https://reviews.llvm.org/D33803 llvm-svn: 304505
* TargetPassConfig: Keep a reference to an LLVMTargetMachine; NFCMatthias Braun2017-05-301-2/+2
| | | | | | | | | | | TargetPassConfig is not useful for targets that do not use the CodeGen library, so we may just as well store a pointer to an LLVMTargetMachine instead of just to a TargetMachine. While at it, also change the constructor to take a reference instead of a pointer as the TM must not be nullptr. llvm-svn: 304247
* [SelectionDAG] Set ISD::FPOWI to Expand by defaultCraig Topper2017-05-301-2/+2
| | | | | | | | | | | | | | | | | Summary: Currently FPOWI defaults to Legal and LegalizeDAG.cpp turns Legal into Expand for this opcode because Legal is a "lie". This patch changes the default for this opcode to Expand and removes the hack from LegalizeDAG.cpp. It also removes all the code in the targets that set this opcode to Expand themselves since they can just rely on the default. Reviewers: spatel, RKSimon, efriedma Reviewed By: RKSimon Subscribers: jfb, dschuff, sbc100, jgravelle-google, nemanjai, javed.absar, andrew.w.kaylor, llvm-commits Differential Revision: https://reviews.llvm.org/D33530 llvm-svn: 304215
* [LegacyPassManager] Remove TargetMachine constructorsFrancis Visoiu Mistrih2017-05-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This provides a new way to access the TargetMachine through TargetPassConfig, as a dependency. The patterns replaced here are: * Passes handling a null TargetMachine call `getAnalysisIfAvailable<TargetPassConfig>`. * Passes not handling a null TargetMachine `addRequired<TargetPassConfig>` and call `getAnalysis<TargetPassConfig>`. * MachineFunctionPasses now use MF.getTarget(). * Remove all the TargetMachine constructors. * Remove INITIALIZE_TM_PASS. This fixes a crash when running `llc -start-before prologepilog`. PEI needs StackProtector, which gets constructed without a TargetMachine by the pass manager. The StackProtector pass doesn't handle the case where there is no TargetMachine, so it segfaults. Related to PR30324. Differential Revision: https://reviews.llvm.org/D33222 llvm-svn: 303360
* [WebAssembly][NFC] Update expected testsuite failures for newly passing testsJacob Gravelle2017-05-171-3/+0
| | | | | | | | | | | | Summary: r303050 fixes crashes when calling scalarizeMaskedMemIntrin pass from WebAssembly backend. This updates expected test failures for that. Reviewers: sbc100 Subscribers: jfb, llvm-commits, dschuff Differential Revision: https://reviews.llvm.org/D33295 llvm-svn: 303288
* BitVector: add iterators for set bitsFrancis Visoiu Mistrih2017-05-171-2/+1
| | | | | | Differential revision: https://reviews.llvm.org/D32060 llvm-svn: 303227
* Add extra operand to CALLSEQ_START to keep frame part set up previouslySerge Pavlov2017-05-092-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using arguments with attribute inalloca creates problems for verification of machine representation. This attribute instructs the backend that the argument is prepared in stack prior to CALLSEQ_START..CALLSEQ_END sequence (see http://llvm.org/docs/InAlloca.htm for details). Frame size stored in CALLSEQ_START in this case does not count the size of this argument. However CALLSEQ_END still keeps total frame size, as caller can be responsible for cleanup of entire frame. So CALLSEQ_START and CALLSEQ_END keep different frame size and the difference is treated by MachineVerifier as stack error. Currently there is no way to distinguish this case from actual errors. This patch adds additional argument to CALLSEQ_START and its target-specific counterparts to keep size of stack that is set up prior to the call frame sequence. This argument allows MachineVerifier to calculate actual frame size associated with frame setup instruction and correctly process the case of inalloca arguments. The changes made by the patch are: - Frame setup instructions get the second mandatory argument. It affects all targets that use frame pseudo instructions and touched many files although the changes are uniform. - Access to frame properties are implemented using special instructions rather than calls getOperand(N).getImm(). For X86 and ARM such replacement was made previously. - Changes that reflect appearance of additional argument of frame setup instruction. These involve proper instruction initialization and methods that access instruction arguments. - MachineVerifier retrieves frame size using method, which reports sum of frame parts initialized inside frame instruction pair and outside it. The patch implements approach proposed by Quentin Colombet in https://bugs.llvm.org/show_bug.cgi?id=27481#c1. It fixes 9 tests failed with machine verifier enabled and listed in PR27481. Differential Revision: https://reviews.llvm.org/D32394 llvm-svn: 302527
* [WebAssembly] Fix use of SDNodeFlags after API change in r301803Derek Schuff2017-05-011-2/+2
| | | | llvm-svn: 301811
* [WebAssembly] Update calls to computeKnownBits after the changes from r301620.Craig Topper2017-04-282-5/+6
| | | | | | I didn't realize WebAssembly wasn't a default build target so I missed that changes were needed. llvm-svn: 301629
* Move value type list from TargetRegisterClass to TargetRegisterInfoKrzysztof Parzyszek2017-04-241-1/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D31937 llvm-svn: 301234
* Revert r301231: Accidentally committed stale filesKrzysztof Parzyszek2017-04-241-2/+1
| | | | | | I forgot to commit local changes before commit. llvm-svn: 301232
* Move value type list from TargetRegisterClass to TargetRegisterInfoKrzysztof Parzyszek2017-04-241-1/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D31937 llvm-svn: 301231
* [WebAssembly] Add known failures for wasm object file backendSam Clegg2017-04-201-0/+28
| | | | | | | | Subscribers: jfb, dschuff Differential Revision: https://reviews.llvm.org/D32300 llvm-svn: 300859
OpenPOWER on IntegriCloud