summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [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
* [WebAssembly] Whitespace consistency. NFC.Dan Gohman2015-11-251-1/+0
| | | | llvm-svn: 254071
* [WebAssembly] Rename SWITCH to TABLESWITCH to match the current wording in ↵Dan Gohman2015-11-201-3/+3
| | | | | | the spec. llvm-svn: 253642
* [WebAssembly] Implement isCheapToSpeculateCtlz and isCheapToSpeculateCttz.Dan Gohman2015-11-191-0/+10
| | | | | | | This unbreaks test/CodeGen/WebAssembly/i32.ll and test/CodeGen/WebAssembly/i64.ll after r224899. llvm-svn: 253617
* [WebAssembly] Fix function return type printingDerek Schuff2015-11-161-3/+0
| | | | | | | | | | | Summary: Previously return type information for a function was derived from return dag nodes. But this didn't work for dags with != return node. So instead compute it directly from the LLVM function as is done for imports. Differential Revision: http://reviews.llvm.org/D14593 llvm-svn: 253251
* [WebAssembly] Minor code simplification. NFC.Dan Gohman2015-11-141-3/+1
| | | | llvm-svn: 253150
* [WebAssembly] Support signext, zeroext, and several other function attributes.Dan Gohman2015-11-141-22/+0
| | | | llvm-svn: 253148
* [WebAssembly] Inline asm support.Dan Gohman2015-11-131-0/+17
| | | | llvm-svn: 252997
* [WebAssembly] Support non-legal argument and return types.Dan Gohman2015-11-111-13/+31
| | | | llvm-svn: 252687
* [WebAssembly] Support for floating point min and max.Dan Gohman2015-11-101-0/+3
| | | | llvm-svn: 252653
* [WebAssembly] Support 'unreachable' expressionDerek Schuff2015-11-101-0/+3
| | | | | | | | | | | | | | | Lower LLVM's 'unreachable' terminator to ISD::TRAP, and lower ISD::TRAP to wasm's 'unreachable' expression. WebAssembly type-checks expressions, but a noreturn function with a return type that doesn't match the context will cause a check failure. So we lower LLVM 'unreachable' to ISD::TRAP and then lower that to WebAssembly's 'unreachable' expression, which typechecks in any context and causes a trap if executed. Differential Revision: http://reviews.llvm.org/D14515 llvm-svn: 252566
* [WebAssembly] Switch to a more traditional assembly syntaxDan Gohman2015-10-061-1/+6
| | | | | | | | | | | This new syntax is built around putting each instruction on its own line in a "mnemonic op, op, op" like syntax. It also uses conventional data section directives like ".byte" and so on rather than requiring everything to be in hierarchical S-expression format. This is a more natural syntax for a ".s" file format from the perspective of LLVM MC and related tools, while remaining easy to translate into other forms as needed. llvm-svn: 249364
* [WebAssembly] Support calls marked as "tail", fastcc, and coldcc.Dan Gohman2015-10-021-4/+14
| | | | llvm-svn: 249184
* [WebAssembly] Rename several functions and types according to the new spec.Dan Gohman2015-09-261-4/+4
| | | | llvm-svn: 248644
* [WebAssembly] Check in an initial CFG Stackifier passDan Gohman2015-09-161-0/+51
| | | | | | | | | | | | This pass implements a simple algorithm for conversion from CFG to wasm's structured control flow. It doesn't yet handle multiple-entry loops; that will be added in a future patch. It also adds initial support for switch statements. Differential Revision: http://reviews.llvm.org/D12735 llvm-svn: 247818
* [WebAssembly] Implement calls with void return types.Dan Gohman2015-09-091-1/+3
| | | | llvm-svn: 247158
* [WebAssembly] Fix lowering of calls with more than one argument.Dan Gohman2015-09-091-2/+5
| | | | llvm-svn: 247118
* WebAssembly: generate load/storeJF Bastien2015-08-311-2/+10
| | | | | | | | | Summary: This handles all load/store operations that WebAssembly defines, and handles those necessary for C++ such as i1. I left a FIXME for outstanding features which aren't required for now. Reviewers: sunfish Subscribers: jfb, llvm-commits, dschuff llvm-svn: 246500
* [WebAssembly] DYNAMIC_STACKALLOC returns a pointer.Dan Gohman2015-08-241-1/+1
| | | | llvm-svn: 245893
* WebAssembly: Implement callJF Bastien2015-08-241-20/+60
| | | | | | | | | | | | Summary: Support function calls. Reviewers: sunfish, sunfishcode Subscribers: sunfishcode, jfb, llvm-commits Differential revision: http://reviews.llvm.org/D12219 llvm-svn: 245887
* Revert two bad commits.JF Bastien2015-08-241-21/+19
| | | | | | | | | | Summary: I forgot to squash git commits before doing an svn dcommit of D12219. Reverting, and re-submitting. Subscribers: jfb, llvm-commits Differential Revision: http://reviews.llvm.org/D12298 llvm-svn: 245886
* Missing print.JF Bastien2015-08-241-13/+13
| | | | llvm-svn: 245883
OpenPOWER on IntegriCloud