545 Commits

Author SHA1 Message Date
Krzysztof Parzyszek
f3b0bf3070 Move value type list from TargetRegisterClass to TargetRegisterInfo
Differential Revision: https://reviews.llvm.org/D31937


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301234 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 19:51:12 +00:00
Krzysztof Parzyszek
031e2c7f67 Revert r301231: Accidentally committed stale files
I forgot to commit local changes before commit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301232 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 19:48:51 +00:00
Krzysztof Parzyszek
a23ad66819 Move value type list from TargetRegisterClass to TargetRegisterInfo
Differential Revision: https://reviews.llvm.org/D31937


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301231 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 19:43:45 +00:00
Sam Clegg
702bc51679 [WebAssembly] Add known failures for wasm object file backend
Subscribers: jfb, dschuff

Differential Revision: https://reviews.llvm.org/D32300

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300859 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 17:18:15 +00:00
Jacob Gravelle
fee2961b5a [WebAssembly] Fix WebAssemblyOptimizeReturned after r300367
Summary:
Refactoring changed paramHasAttr(1 + i) to paramHasAttr(0), fix that to
paramHasAttr(i).
Add more tests to WebAssemblyOptimizeReturned that catch that
regression.

Reviewers: dschuff

Subscribers: jfb, sbc100, llvm-commits

Differential Revision: https://reviews.llvm.org/D32136

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300502 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 21:40:28 +00:00
Derek Schuff
e39a78c951 [WebAssembly] Encode block signatures as SLEB instead of ULEB
Use SLEB (varint) for block_type immediates in accordance with the spec.

Patch by Yury Delendik

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300490 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 20:28:28 +00:00
Benjamin Kramer
3778de4635 Unbreak build of the wasm backend after r300463.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300479 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 19:08:41 +00:00
Reid Kleckner
1f8f049069 [IR] Make paramHasAttr to use arg indices instead of attr indices
This avoids the confusing 'CS.paramHasAttr(ArgNo + 1, Foo)' pattern.

Previously we were testing return value attributes with index 0, so I
introduced hasReturnAttr() for that use case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300367 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-14 20:19:02 +00:00
Reid Kleckner
1c35defd74 [IR] Make getParamAttributes take argument numbers, not ArgNo+1
Add hasParamAttribute() and use it instead of hasAttribute(ArgNo+1,
Kind) everywhere.

The fact that the AttributeList index for an argument is ArgNo+1 should
be a hidden implementation detail.

NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300272 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 23:12:13 +00:00
Reid Kleckner
e9a46bf123 [IR] Take func, ret, and arg attrs separately in AttributeList::get
This seems like a much more natural API, based on Derek Schuff's
comments on r300015. It further hides the implementation detail of
AttributeList that function attributes come last and appear at index
~0U, which is easy for the user to screw up. git diff says it saves code
as well: 97 insertions(+), 137 deletions(-)

This also makes it easier to change the implementation, which I want to
do next.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300153 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 00:58:09 +00:00
Derek Schuff
490024c934 [WebAssembly] Update use of Attributes after r299875
This fixes the failing WebAssemblyLowerEmscriptenEHSjLj tests

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300072 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 16:03:00 +00:00
Derek Schuff
e9dc13a183 Revert "[WebAssembly] Update use of Attributes after r299875"
This reverts commit 2a0eb61dcccb15058d5b2a572bb3da0cf47fd550, r300015

I raced with rnk on the commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300016 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 01:17:31 +00:00
Derek Schuff
2a0eb61dcc [WebAssembly] Update use of Attributes after r299875
This fixes the failing WebAssemblyLowerEmscriptenEHSjLj tests

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300015 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 01:09:34 +00:00
Derek Schuff
ca5c29bce6 [WebAssembly] Fix -Wcovered-switch-default warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299736 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-06 23:52:01 +00:00
Alexander Kornienko
9544eb39b6 Fix WebAssembly after r299529.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299535 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-05 11:50:43 +00:00
Dan Gohman
546a4623a5 [WebAssembly] Initial linking metadata support
Add support for the new relocations and linking metadata section support in
https://github.com/WebAssembly/tool-conventions/blob/master/Linking.md. In
particular, this allows LLVM to indicate which variable is the stack pointer,
so that it can be linked with other objects.

This also adds support for emitting type relocations for call_indirect
instructions.

Right now, this is mainly tested by using wabt and hexdump to examine the
output on selected testcases. We'll add more tests as the design stablizes
and more of the pieces are in place.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299141 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-30 23:58:19 +00:00
Reid Kleckner
6707770d48 Rename AttributeSet to AttributeList
Summary:
This class is a list of AttributeSetNodes corresponding the function
prototype of a call or function declaration. This class used to be
called ParamAttrListPtr, then AttrListPtr, then AttributeSet. It is
typically accessed by parameter and return value index, so
"AttributeList" seems like a more intuitive name.

Rename AttributeSetImpl to AttributeListImpl to follow suit.

It's useful to rename this class so that we can rename AttributeSetNode
to AttributeSet later. AttributeSet is the set of attributes that apply
to a single function, argument, or return value.

Reviewers: sanjoy, javed.absar, chandlerc, pete

Reviewed By: pete

Subscribers: pete, jholewinski, arsenm, dschuff, mehdi_amini, jfb, nhaehnle, sbc100, void, llvm-commits

Differential Revision: https://reviews.llvm.org/D31102

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298393 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-21 16:57:19 +00:00
Reid Kleckner
63994176b4 Fix wasm build after arg_begin iterator type change
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298106 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-17 17:24:03 +00:00
Derek Schuff
d289ddded8 [WebAssembly] Fix some broken type encodings in wasm binary
A recent change switch the in-memory wasm value types
to be signed integers, but I missing a few cases where
these were being writing to the binary.

Differential Revision: https://reviews.llvm.org/D31014

Patch by Sam Clegg

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297991 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-16 20:49:48 +00:00
Derek Schuff
25754c1409 [WebAssembly] Use LEB encoding for value types
Previously we were using the encoded LEB hex values
for the value types.  This change uses the decoded
negative value and the LEB encoder to write them out.

Differential Revision: https://reviews.llvm.org/D30847

Patch by Sam Clegg

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297777 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 20:23:22 +00:00
Dan Gohman
c9f889fcc0 [WebAssembly] Fix the opcode numbers for floating-point le and gt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297420 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-09 23:08:21 +00:00
Dan Gohman
24efa5d42e [WebAssembly] Convert the remaining unit tests to the new wasm-object-file target.
To facilitate this, add a new hidden command-line option to disable
the explicit-locals pass. That causes llc to emit invalid code that doesn't
have all locals converted to get_local/set_local, however it simplifies
testwriting in many cases.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296540 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-28 23:37:04 +00:00
Dan Gohman
6d8f20c219 [WebAssembly] Add some comments and tidy up whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296402 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 22:41:39 +00:00
Dan Gohman
a746da8ffc [WebAssembly] Split CFG-sorting into its own pass. NFC.
CFG sorting was already an independent algorithm from block/loop insertion;
this change makes it more convenient to debug.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296399 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 22:38:58 +00:00
Dan Gohman
8f5a7d69cc [WebAssembly] Add support for using a wasm global for the stack pointer.
This replaces the __stack_pointer variable which was allocated in linear
memory.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296201 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-24 23:46:05 +00:00
Dan Gohman
53ff96ab08 [WebAssembly] Basic support for Wasm object file encoding.
With the "wasm32-unknown-unknown-wasm" triple, this allows writing out
simple wasm object files, and is another step in a larger series toward
migrating from ELF to general wasm object support. Note that this code
and the binary format itself is still experimental.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296190 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-24 23:18:00 +00:00
Dan Gohman
3d2ef31552 [WebAssembly] Handle f16 in fast-isel.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296172 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-24 21:05:35 +00:00
Dan Gohman
b1d145173f [WebAssembly] Add a README.txt entry for mergeable sections.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296095 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-24 07:33:55 +00:00
Dan Gohman
2be1878c67 [WebAssembly] Define a table of function signatures for runtime library calls.
LLVM CodeGen emits references to external symbols that are never declared in
LLVM IR level, so they have no declared signature. However, WebAssembly requires
all functions be declared with signatures. This patch adds a table for providing
signatures for known runtime libcalls that will be used in subsequent patches to
emit declarations for such functions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295857 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-22 18:34:16 +00:00
Dan Gohman
61ce026358 [WebAssembly] Configure codegen to legalize f16 values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295850 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-22 16:28:00 +00:00
Dan Gohman
d660a5d68c [WebAssembly] Add skeleton MC support for the Wasm container format
This just adds the basic skeleton for supporting a new object file format.
All of the actual encoding will be implemented in followup patches.

Differential Revision: https://reviews.llvm.org/D26722


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295803 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-22 01:23:18 +00:00
Dan Gohman
8073df7f9a [WebAssembly] Add a cast to void to fix an unused private member warning, for now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295327 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-16 15:21:37 +00:00
Dan Gohman
ab20565a82 [WebAssembly] Remove old experimental disassemler code.
Remove support for disassembling an old experimental wasm binary format, which
is no longer in use anywhere.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294809 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-11 00:02:23 +00:00
Dan Gohman
897444660d [WebAssembly] Pass an MCContext to WebAssemblyMCCodeEmitter. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294679 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-10 00:14:42 +00:00
Dan Gohman
629186061b [WebAssembly] Refactor void return peephole using MaybeRewriteToFallthrough. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294652 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 23:19:03 +00:00
Dan Gohman
e56a9ab847 [WebAssembly] Add instruction definitions for drop and get/set_global.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293922 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-02 19:29:44 +00:00
Richard Trieu
d12101aa01 [WebAssembly] Use print instead of dump method.
This fixes non-debug non-assert builds after r293359.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293368 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-28 03:23:49 +00:00
Derek Schuff
e5f6421c94 [WebAssembly] Update LibFunc::Func -> LibFunc
Fixes compile failures after r292848

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292857 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-24 00:01:18 +00:00
Dan Gohman
0d4e33d211 [WebAssembly] Don't create bitcast-wrappers for varargs.
WebAssembly varargs functions use a significantly different ABI than
non-varargs functions, and the current code in
WebAssemblyFixFunctionBitcasts doesn't handle that difference. For now,
just avoid creating wrapper functions in the presence of varargs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292645 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-20 20:50:29 +00:00
Dan Gohman
97c35d16c6 [WebAssembly] Update grow_memory's return type.
The grow_memory instruction now returns the previous memory size. Add the
return type to the LLVM intrinsic.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292322 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-18 01:02:45 +00:00
Diana Picus
8a47810cd6 [CodeGen] Rename MachineInstrBuilder::addOperand. NFC
Rename from addOperand to just add, to match the other method that has been
added to MachineInstrBuilder for adding more than just 1 operand.

See https://reviews.llvm.org/D28057 for the whole discussion.

Differential Revision: https://reviews.llvm.org/D28556

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291891 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-13 09:58:52 +00:00
Mohammed Agabaria
9c6b24cc3a [X86] updating TTI costs for arithmetic instructions on X86\SLM arch.
updated instructions:
pmulld, pmullw, pmulhw, mulsd, mulps, mulpd, divss, divps, divsd, divpd, addpd and subpd.

special optimization case which replaces pmulld with pmullw\pmulhw\pshuf seq. 
In case if the real operands bitwidth <= 16.

Differential Revision: https://reviews.llvm.org/D28104 



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291657 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-11 08:23:37 +00:00
Derek Schuff
aca5f1663a [WebAssembly] Only RAUW a constant once in FixFunctionBitcasts
When we collect 2 uses of a function in FindUses and then RAUW when we
visit the first, we end up visiting the wrapper (because the second was
RAUW'd).  We still want to use RAUW instead of just Use->set() because
it has special handling for Constants, so this patch just ensures that
only one use of each constant is added to the work list.

Differential Revision: https://reviews.llvm.org/D28504

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291603 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-10 21:59:53 +00:00
Dan Gohman
3494169e90 [WebAssembly] Add return type annotations in fast isel.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291498 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-09 23:09:38 +00:00
Dan Gohman
a72cf1129d [WebAssembly] Fix the opcode values for i64.eq and i64.ne.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291424 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-09 06:21:28 +00:00
Dan Gohman
e877be12b2 [WebAssembly] Don't abort on code with UB.
Gracefully leave code that performs function-pointer bitcasts implying
non-trivial pointer conversions alone, rather than aborting, since it's
just undefined behavior.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291326 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-07 01:50:01 +00:00
Dan Gohman
45b889b776 [WebAssembly] Move a SmallVector to a more specific scope. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291324 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-07 01:31:18 +00:00
Dan Gohman
91f4652a9e [WebAssembly] Add a pass to create wrappers for function bitcasts.
WebAssembly requires caller and callee signatures to match exactly. In LLVM,
there are a variety of circumstances where signatures may be mismatched in
practice, and one can bitcast a function address to another type to call it
as that type. This patch adds a pass which replaces bitcasted function
addresses with wrappers to replace the bitcasts.

This doesn't catch everything, but it does match many common cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291315 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-07 00:34:54 +00:00
Dan Gohman
66b35bd23b [WebAssembly] Annotate call and load/store immediates.
These will be used to guide the binary encoding of these immediates.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290412 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 03:23:52 +00:00
Dan Gohman
474281748f [WebAssembly] Add an "explicit" keyword to a constructor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290345 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-22 16:03:02 +00:00