summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [WebAssembly] Handle CopyToReg nodes with flag results in LowerCopyToReg.Dan Gohman2016-02-201-3/+7
| | | | llvm-svn: 261457
* [WebAssembly] Call memcpy for large byval copies.Dan Gohman2016-02-171-1/+1
| | | | | | | | | | This fixes very slow compilation on test/CodeGen/Generic/2010-11-04-BigByval.ll . Note that MaxStoresPerMemcpy and friends are not yet carefully tuned so the cutoff point is currently somewhat arbitrary. However, it's important that there be a cutoff point so that we don't emit unbounded quantities of loads and stores. llvm-svn: 261050
* [WebAssembly] Use SDValue::getConstantOperandVal. NFC.Dan Gohman2016-02-171-1/+1
| | | | llvm-svn: 261037
* [WebAssembly] Implement __builtin_frame_address.Dan Gohman2016-02-161-3/+17
| | | | | | Differential Revision: http://reviews.llvm.org/D17307 llvm-svn: 261032
* [WebAssembly] Insert COPY_LOCAL between CopyToReg and FrameIndex DAG nodesDerek Schuff2016-02-161-0/+26
| | | | | | | | | | | | | | CopyToReg nodes don't support FrameIndex operands. Other targets select the FI to some LEA-like instruction, but since we don't have that, we need to insert some kind of instruction that can take an FI operand and produces a value usable by CopyToReg (i.e. in a vreg). So insert a dummy copy_local between Op and its FI operand. This results in a redundant copy which we should optimize away later (maybe in the post-FI-lowering peephole pass). Differential Revision: http://reviews.llvm.org/D17213 llvm-svn: 260987
* [WebAssembly] Report more meaningful error messages for some unsupportedDerek Schuff2016-02-121-0/+13
| | | | | | | | | ops. Computed gotos and RETURNADDR may never be supported; we can do FRAMEADDR in the future. llvm-svn: 260759
* [WebAssembly] Fix byval for empty types.Dan Gohman2016-02-121-2/+1
| | | | llvm-svn: 260740
* [WebAssembly] Reformat WebAssemblyFrameLowering and WebAssemblyISelLoweringDerek Schuff2016-02-111-50/+42
| | | | | | | | | | Reviewers: sunfish, jfb Subscribers: jfb, dschuff Differential Revision: http://reviews.llvm.org/D17156 llvm-svn: 260585
* [WebAssembly] Address comments left over from r260421Derek Schuff2016-02-101-7/+9
| | | | llvm-svn: 260429
* [WebAssembly] Switch varags calling convention to use a registerDerek Schuff2016-02-101-39/+42
| | | | | | | | | | | | Instead of passing varargs directly on the user stack, allocate a buffer in the caller's stack frame and pass a pointer to it. This simplifies the C ABI (e.g. non-C callers of C functions do not need to use C's user stack if they have their own mechanism) and allows further optimizations in the future (e.g. fewer functions may need to use the stack). Differential Revision: http://reviews.llvm.org/D17048 llvm-svn: 260421
* Refactor backend diagnostics for unsupported featuresOliver Stannard2016-02-021-56/+1
| | | | | | | | | | | | | | | | | Re-commit of r258951 after fixing layering violation. The BPF and WebAssembly backends had identical code for emitting errors for unsupported features, and AMDGPU had very similar code. This merges them all into one DiagnosticInfo subclass, that can be used by any backend. There should be minimal functional changes here, but some AMDGPU tests have been updated for the new format of errors (it used a slightly different format to BPF and WebAssembly). The AMDGPU error messages will now benefit from having precise source locations when debug info is available. llvm-svn: 259498
* Revert r259035, it introduces a cyclic library dependencyOliver Stannard2016-01-281-2/+57
| | | | llvm-svn: 259045
* Unbreak the wasm backend again after r259035.Benjamin Kramer2016-01-281-1/+1
| | | | llvm-svn: 259040
* Add backend dignostic printer for unsupported featuresOliver Stannard2016-01-281-56/+1
| | | | | | | | | | | | | | | | Re-commit of r258951 after fixing layering violation. The related LLVM patch adds a backend diagnostic type for reporting unsupported features, this adds a printer for them to clang. In the case where debug location information is not available, I've changed the printer to report the location as the first line of the function, rather than the closing brace, as the latter does not give the user any information. This also affects optimisation remarks. Differential Revision: http://reviews.llvm.org/D16590 llvm-svn: 259035
* WebAssembly: fix buildJF Bastien2016-01-281-1/+1
| | | | | | r259016 didn't also revert r258957 which broken the WebAssembly build. llvm-svn: 259020
* Revert r258951 (and r258950), "Refactor backend diagnostics for unsupported ↵NAKAMURA Takumi2016-01-281-0/+55
| | | | | | | | | | | features" It broke layering violation in LLVMIR. clang r258950 "Add backend dignostic printer for unsupported features" llvm r258951 "Refactor backend diagnostics for unsupported features" llvm-svn: 259016
* [WebAssembly] Implement byval argumentsDerek Schuff2016-01-271-7/+19
| | | | | | | | | | Summary: Just does the simple allocation of a stack object and passes a pointer to the callee. Differential Revision: http://reviews.llvm.org/D16610 llvm-svn: 258989
* Unbreak wasm build after r258951.Benjamin Kramer2016-01-271-1/+1
| | | | llvm-svn: 258957
* Refactor backend diagnostics for unsupported featuresOliver Stannard2016-01-271-55/+0
| | | | | | | | | | | | | | | | | | | | | The BPF and WebAssembly backends had identical code for emitting errors for unsupported features, and AMDGPU had very similar code. This merges them all into one DiagnosticInfo subclass, that can be used by any backend. There should be minimal functional changes here, but some AMDGPU tests have been updated for the new format of errors (it used a slightly different format to BPF and WebAssembly). The AMDGPU error messages will now benefit from having precise source locations when debug info is available. The implementation of DiagnosticInfoUnsupported::print must be in lib/Codegen rather than in the existing file in lib/IR/ to avoid introducing a dependency from IR to CodeGen. Differential Revision: http://reviews.llvm.org/D16590 llvm-svn: 258951
* [WebAssembly] Fix a typo in a comment.Dan Gohman2016-01-261-1/+1
| | | | llvm-svn: 258810
* [WebAssembly] Implement unaligned loads and stores.Dan Gohman2016-01-261-0/+14
| | | | | | Differential Revision: http://reviews.llvm.org/D16534 llvm-svn: 258779
* [WebAssembly] Define WebAssembly-specific relocation codes.Dan Gohman2016-01-111-3/+11
| | | | | | | | Currently WebAssembly has two kinds of relocations; data addresses and function addresses. This adds ELF relocations for them, as well as an MC symbol kind to indicate which type of relocation is needed. llvm-svn: 257416
* [WebAssembly] Experimental ELF writer supportDan Gohman2015-12-171-8/+0
| | | | | | | | | This creates the initial infrastructure for writing ELF output files. It doesn't yet have any implementation for encoding instructions. Differential Revision: http://reviews.llvm.org/D15555 llvm-svn: 255869
* [WebAssembly] Fix legalization of shift operators on large integer types.Dan Gohman2015-12-161-0/+7
| | | | llvm-svn: 255847
* [WebAssembly] Implement eliminateCallFramePseudoDerek Schuff2015-12-161-1/+1
| | | | | | | | | | | | | | | | | | Summary: Implement eliminateCallFramePsuedo to handle ADJCALLSTACKUP/DOWN pseudo-instructions. Add a test calling a vararg function which causes non-0 adjustments. This revealed an issue with RegisterCoalescer wherein it eliminates a COPY from SP32 to a vreg but failes to update the live ranges of EXPR_STACK, causing a machineinstr verifier failure (so this test is commented out). Also add a dynamic alloca test, which causes a callseq_end dag node with a 0 (instead of undef) second argument to be generated. We currently fail to select that, so adjust the ADJCALLSTACKUP tablegen code to handle it. Differential Revision: http://reviews.llvm.org/D15587 llvm-svn: 255844
* [WebAssembly] Implement instruction selection for constant offsets in addresses.Dan Gohman2015-12-151-4/+23
| | | | | | | | | | | | | | | | | | | | Add instruction patterns for matching load and store instructions with constant offsets in addresses. The code is fairly redundant due to the need to replicate everything between imm, tglobaldadr, and texternalsym, but this appears to be common tablegen practice. The main alternative appears to be to introduce matching functions with C++ code, but sticking with purely generated matchers seems better for now. Also note that this doesn't yet support offsets from getelementptr, which will be the most common case; that will depend on a change in target-independent code in order to set the NoUnsignedWrap flag, which I'll submit separately. Until then, the testcase uses ptrtoint+add+inttoptr with a nuw on the add. Also implement isLegalAddressingMode with an approximation of this. Differential Revision: http://reviews.llvm.org/D15538 llvm-svn: 255681
* [WebAssembly] Implement prolog/epilog insertion and FrameIndex eliminationDerek Schuff2015-12-111-0/+10
| | | | | | | | | | | | | | | | | | Summary: Use the SP32 physical register as the base for FrameIndex lowering. Update it and the __stack_pointer global var in the prolog and epilog. Extend the mapping of virtual registers to wasm locals to include the physical registers. Rather than modify the target-independent PrologEpilogInserter (which asserts that there are no virtual registers left) include a slightly-modified copy for Wasm that does not have this assertion and only clears the virtual registers if scavenging was needed (which of course it isn't for wasm). Differential Revision: http://reviews.llvm.org/D15344 llvm-svn: 255392
* [WebAssembly] Fix ADJCALLSTACKDOWN/UP use/defsDerek Schuff2015-12-111-4/+9
| | | | | | | | | | | | | | | | | | | | | | Summary: ADJCALLSTACK{DOWN,UP} (aka CALLSEQ_{START,END}) MIs are supposed to use and def the stack pointer. Since they do not, all the nodes are being eliminated by DeadMachineInstructionElim, so they aren't in the IR when PrologEpilogInserter/eliminateCallFramePseudo needs them. This change fixes that, but since RegStackify will not stackify across them (and it runs early, before PEI), change LowerCall to only emit them when the call frame size is > 0. That makes the current code work the same way and makes code handled by D15344 also work the same way. We can expand the condition beyond NumBytes > 0 in the future if needed. Reviewers: sunfish, jfb Subscribers: jfb, dschuff, llvm-commits Differential Revision: http://reviews.llvm.org/D15459 llvm-svn: 255356
* [WebAssembly] Implement fma.Dan Gohman2015-12-101-1/+1
| | | | | | It is lowered to a libcall for now, but this is expected to change in the future. llvm-svn: 255219
* [WebAssembly] Fix legalization of f32->f64 EXTLOAD.Dan Gohman2015-12-101-1/+1
| | | | llvm-svn: 255202
* [WebAssembly] Also legalize sign_extend_inreg of i32->i64.Dan Gohman2015-12-101-1/+1
| | | | llvm-svn: 255191
* [WebAssembly] Fix legalization of shift operators with illegal types.Dan Gohman2015-12-101-1/+7
| | | | llvm-svn: 255181
* [WebAssembly] Fix copy+pastos.Dan Gohman2015-12-101-12/+12
| | | | llvm-svn: 255180
* [WebAssembly] Remove an unneeded static_cast.Dan Gohman2015-12-081-2/+1
| | | | llvm-svn: 254998
* [WebAssembly] Enable folding of offsets into global variable addresses.Dan Gohman2015-12-061-6/+4
| | | | llvm-svn: 254882
* [WebAssembly] Support inline asm constraints of type i16 and similar.Dan Gohman2015-12-051-4/+7
| | | | llvm-svn: 254861
* [WebAssembly] Expand frem as a floating point library function.Dan Gohman2015-12-051-1/+2
| | | | llvm-svn: 254854
* [WebAssembly] Initial varargs support.Dan Gohman2015-12-041-15/+85
| | | | | | | | | Full varargs support will depend on prologue/epilogue support, but this patch gets us started with most of the basic infrastructure. Differential Revision: http://reviews.llvm.org/D15231 llvm-svn: 254799
* [WebAssembly] Add several more calling conventions to the supported list.Dan Gohman2015-12-041-2/+7
| | | | llvm-svn: 254741
* [WebAssembly] clang-format CallingConvSupported. NFC.Dan Gohman2015-12-041-4/+2
| | | | llvm-svn: 254729
* [WebAssembly] Factor out the list of supported calling conventions.Dan Gohman2015-12-041-4/+13
| | | | llvm-svn: 254728
* [WebAssembly] Check for more unsupported ABI flags.Dan Gohman2015-12-041-1/+26
| | | | llvm-svn: 254727
* [WebAssembly] Use SelectionDAG::getUNDEF. NFC.Dan Gohman2015-12-041-1/+1
| | | | llvm-svn: 254726
* [WebAssembly] Assert that byval and nest are not used for return types.Dan Gohman2015-12-021-4/+2
| | | | llvm-svn: 254567
* [WebAssembly] Minor clang-format and selected clang-tidy cleanups. NFC.Dan Gohman2015-11-291-17/+18
| | | | llvm-svn: 254267
* [WebAssembly] Fix inline asm support for i64 operands.Dan Gohman2015-11-251-1/+5
| | | | llvm-svn: 254106
* [WebAssembly] Use a physical register to describe ARGUMENT liveness.Dan Gohman2015-11-251-0/+4
| | | | | | | | | | Instead of trying to move ARGUMENT instructions back up to the top after they've been scheduled or sunk down, use a fake physical register to create a liveness constraint that prevents ARGUMENT instructions from moving down in the first place. This is still not entirely ideal, however it is more robust than letting them move and moving them back. llvm-svn: 254084
* [WebAssembly] Clean up several FIXME comments.Dan Gohman2015-11-251-2/+4
| | | | llvm-svn: 254079
* [WebAssembly] Codegen support for ISD::ExternalSymbolDan Gohman2015-11-251-0/+13
| | | | llvm-svn: 254075
* [WebAssembly] Add 'final' to some classes. NFC.Dan Gohman2015-11-251-1/+1
| | | | llvm-svn: 254073
OpenPOWER on IntegriCloud