1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 11:33:24 +02:00
Commit Graph

374 Commits

Author SHA1 Message Date
Dan Gohman
fe6a0cf238 [WebAssembly] Implement the rotate instructions.
llvm-svn: 264076
2016-03-22 18:01:49 +00:00
Dan Gohman
b9243a7523 [WebAssembly] Implement the eqz instructions.
llvm-svn: 263976
2016-03-21 19:54:41 +00:00
Derek Schuff
cd46ca19fb [WebAssembly] Stackify code emitted by eliminateFrameIndex and SP writeback
Summary:
MRI::eliminateFrameIndex can emit several instructions to do address
calculations; these can usually be stackified. Because instructions with
FI operands can have subsequent operands which may be expression trees,
find the top of the leftmost tree and insert the code before it, to keep
the LIFO property.

Also use stackified registers when writing back the SP value to memory
in the epilog; it's unnecessary because SP will not be used after the
epilog, and it results in better code.

Differential Revision: http://reviews.llvm.org/D18234

llvm-svn: 263725
2016-03-17 17:00:29 +00:00
Hans Wennborg
3b13eb7175 Try to fix build of WebAssemblyRegStackify.cpp on Windows
It's failing to build on VS2015 with:

C:\b\build\slave\ClangToTWin\build\src\third_party\llvm\lib\Target\WebAssembly\WebAssemblyRegStackify.cpp(520):
error C2668: 'llvm::make_reverse_iterator': ambiguous call to overloaded function
C:\b\build\slave\ClangToTWin\build\src\third_party\llvm\include\llvm/ADT/STLExtras.h(217):
note: could be 'std::reverse_iterator<llvm::MachineBasicBlock::iterator>
llvm::make_reverse_iterator<llvm::MachineInstrBundleIterator<llvm::MachineInstr>>(IteratorTy)'
        with
        [
            IteratorTy=llvm::MachineInstrBundleIterator<llvm::MachineInstr>
        ]
C:\b\depot_tools\win_toolchain\vs_files\391bbf1220d3edcd3cc3fccdb56224181e3b13a7\win_sdk\bin\..\..\VC\include\xutility(1217):
note: or 'std::reverse_iterator<llvm::MachineBasicBlock::iterator>
std::make_reverse_iterator<llvm::MachineInstrBundleIterator<llvm::MachineInstr>>(_RanIt)' [found using argument-dependent lookup]
        with
        [
            _RanIt=llvm::MachineInstrBundleIterator<llvm::MachineInstr>
        ]

I don't have VS2015 locally at the moment, but hopefully this will help.

llvm-svn: 263418
2016-03-14 11:04:15 +00:00
Dan Gohman
0b3d2a0666 [WebAssembly] Add final keywords to a few more subclasses, for consistency.
llvm-svn: 263287
2016-03-11 19:45:37 +00:00
Derek Schuff
20858215d6 [WebAssembly] Update known gcc test failures
llvm-svn: 263068
2016-03-09 22:14:33 +00:00
Dan Gohman
3d44e033f7 [WebAssembly] Update comments about irreducible control flow.
llvm-svn: 262995
2016-03-09 04:17:36 +00:00
Dan Gohman
639ae6b08b [WebAssembly] Implement irreducible control flow.
This implements a very simple conservative transformation that doesn't
require more than linear code size growth. There's room for much more
optimization in this space.

llvm-svn: 262982
2016-03-09 02:01:14 +00:00
Dan Gohman
8e7d4c3823 [WebAssembly] Update for spec change from tableswitch to br_table.
Also note that the operand order changed; the default label is now listed
after the regular labels.

llvm-svn: 262903
2016-03-08 03:18:12 +00:00
Dan Gohman
6d636cd56e [WebAssembly] Add another possible code-size optimization to README.txt
llvm-svn: 262740
2016-03-04 20:09:57 +00:00
JF Bastien
b69a1061f6 WebAssembly: fix build
More API churn, experimental target got sad.

llvm-svn: 262179
2016-02-28 15:33:53 +00:00
JF Bastien
58b3415c80 WebAssembly: fix build
It was broken by the work for PR26753.

llvm-svn: 262140
2016-02-27 16:38:23 +00:00
Derek Schuff
c81038d2b7 Revert "[WebAssembly] Stackify code emitted by eliminateFrameIndex"
This reverts r261685 due to wasm test breakage.

llvm-svn: 261702
2016-02-23 22:13:21 +00:00
Derek Schuff
74080913f6 [WebAssembly] Stackify code emitted by eliminateFrameIndex
llvm-svn: 261685
2016-02-23 21:25:17 +00:00
Derek Schuff
313b544b12 [WebAssembly] Add TODO comment to revisit red zone size
llvm-svn: 261664
2016-02-23 18:17:46 +00:00
Derek Schuff
7fa1e4425f [WebAssembly] Implement red zone for user stack
Implements a mostly-conventional redzone for the userspace
stack. Because we have unsigned load/store offsets we continue to use a
local SP subtracted from the incoming SP but do not write it back to
memory.

Differential Revision: http://reviews.llvm.org/D17525

llvm-svn: 261662
2016-02-23 18:13:07 +00:00
Derek Schuff
5fd7c2542e [WebAssembly] Fix writeback of stack pointer with dynamic alloca
Previously the stack pointer was only written back to memory in the
prolog. But this is wrong for dynamic allocas, for which
target-independent codegen handles SP updates after the prolog (and
possibly even in another BB). Instead update the SP global in
ADJCALLSTACKDOWN which is generated after the SP update sequence.
This will have further refinements when we add red zone support.

llvm-svn: 261579
2016-02-22 21:57:17 +00:00
Dan Gohman
eb0777680f [WebAssembly] Re-enable the TailDuplicate pass.
llvm-svn: 261566
2016-02-22 20:47:12 +00:00
JF Bastien
f05f3f0c3e WebAssembly: update expected failures
clang r261557 lowers va_arg in clang.

llvm-svn: 261564
2016-02-22 20:37:34 +00:00
Dan Gohman
c71fd3c15c [WebAssembly] Teach address folding to fold bitwise-or nodes.
LLVM converts adds into ors when it can prove that the operands don't share
any non-zero bits. Teach address folding to recognize or instructions with
constant operands with this property that can be folded into addresses as
if they were adds.

llvm-svn: 261562
2016-02-22 20:04:02 +00:00
Dan Gohman
6cd6f419ab [WebAssembly] Properly ignore llvm.dbg.value instructions.
llvm-svn: 261538
2016-02-22 17:45:20 +00:00
JF Bastien
d168b044b1 WebAssembly: update expected torture test failures
r261457 handles CopyToReg nodes with flag results in LowerCopyToReg, which was causing the SelectionDAGNodes assert.

llvm-svn: 261479
2016-02-21 16:52:00 +00:00
Dan Gohman
c3f23ceef3 [WebAssembly] Support physical registers in the rewrite-to-discard optimization.
llvm-svn: 261465
2016-02-21 03:27:22 +00:00
Dan Gohman
9d09f603ef [WebAssembly] Refine a README.txt entry.
The register coloring pass may also need to be involved in order to
optimally sort registers.

llvm-svn: 261458
2016-02-20 23:11:14 +00:00
Dan Gohman
3f10ef519d [WebAssembly] Handle CopyToReg nodes with flag results in LowerCopyToReg.
llvm-svn: 261457
2016-02-20 23:09:44 +00:00
Derek Schuff
ee2bcbc1d2 [WebAssembly] Write stack pointer back to memory when FP is used
The stack pointer is bumped when there is a frame pointer or when there
are static-size objects, but was only getting written back when there
were static-size objects.

llvm-svn: 261453
2016-02-20 22:18:47 +00:00
Derek Schuff
5cc4608440 [WebAssembly] Stackify function prologs and epilogs
The instructions are the same, but fewer locals are used.

Differential Revision: http://reviews.llvm.org/D17428

llvm-svn: 261452
2016-02-20 21:46:50 +00:00
Dan Gohman
3d596becbf [WebAssembly] Add another optimization idea to README.txt.
llvm-svn: 261354
2016-02-19 19:22:44 +00:00
Dan Gohman
32f3e081a8 [WebAssembly] Don't use setRequiresStructuredCFG(true).
While we still do want reducible control flow, the RequiresStructuredCFG
flag imposes more strict structure constraints than WebAssembly wants.
Unsetting this flag enables critical edge splitting and tail merging.

Also, disable TailDuplication explicitly, as it doesn't support virtual
registers, and was previously only disabled by the RequiresStructuredCFG
flag.

llvm-svn: 261190
2016-02-18 06:32:53 +00:00
Derek Schuff
1b72e0f1c1 [WebAssembly] Disable register stackification and coloring when not optimizing
These passes are optimizations, and should be disabled when not
optimizing.
Also create an MCCodeGenInfo so the opt level is correctly plumbed to
the backend pass manager.
Also remove the command line flag for disabling register coloring;
running llc with -O0 should now be useful for debugging, so it's not
necessary.

Differential Revision: http://reviews.llvm.org/D17327

llvm-svn: 261176
2016-02-17 23:20:43 +00:00
JF Bastien
08c122fb28 WebAssembly: update expected failures
r261050 seems to inadvertently fix the assertion failure.

llvm-svn: 261051
2016-02-17 01:59:23 +00:00
Dan Gohman
811eb4337e [WebAssembly] Call memcpy for large byval copies.
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
2016-02-17 01:43:37 +00:00
JF Bastien
83e991d52a WebAssembly: update expected test failures
r261032 adds frame address support.

llvm-svn: 261044
2016-02-17 00:34:15 +00:00
Dan Gohman
ea19c3e264 [WebAssembly] Use SDValue::getConstantOperandVal. NFC.
llvm-svn: 261037
2016-02-17 00:14:03 +00:00
Dan Gohman
7699d5ed4b [WebAssembly] Implement __builtin_frame_address.
Differential Revision: http://reviews.llvm.org/D17307

llvm-svn: 261032
2016-02-16 23:48:04 +00:00
Derek Schuff
a5f71b59fb [WebAssembly] Update torture test expectations
These were fixed with r260978

llvm-svn: 261017
2016-02-16 21:52:06 +00:00
Derek Schuff
b9542a8754 [WebAssemly] Don't move calls or stores past intervening loads
The register stackifier currently checks for intervening stores (and
loads that may alias them) but doesn't account for the fact that the
instruction being moved may affect intervening loads.

Differential Revision: http://reviews.llvm.org/D17298

llvm-svn: 261014
2016-02-16 21:44:19 +00:00
Derek Schuff
abc1815dc3 [WebAssembly] Insert COPY_LOCAL between CopyToReg and FrameIndex DAG nodes
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
2016-02-16 18:18:36 +00:00
Dan Gohman
9d4d64722a [WebAssembly] Switch from RPO sorting to topological sorting.
WebAssembly doesn't require full RPO; topological sorting is sufficient and
can preserve more of the MachineBlockPlacement ordering. Unfortunately, this
still depends a lot on heuristics, because while we use the
MachineBlockPlacement ordering as a guide, we can't use it in places where
it isn't topologically ordered. This area will require further attention.

llvm-svn: 260978
2016-02-16 16:22:41 +00:00
Dan Gohman
25ef0b853a [WebAssembly] Create new registers instead of reusing old ones in RegStackify.
This avoids some complications updating LiveIntervals to be aware of the new
register lifetimes, because we can just compute new intervals from scratch
rather than describe how the old ones have been changed.

llvm-svn: 260971
2016-02-16 15:17:21 +00:00
Dan Gohman
8579fc81f5 [WebAssembly] Implement support for custom NaN bit patterns.
llvm-svn: 260968
2016-02-16 15:14:23 +00:00
Derek Schuff
eed189f4ef [WebAssembly] Report more meaningful error messages for some unsupported
ops.

Computed gotos and RETURNADDR may never be supported; we can do
FRAMEADDR in the future.

llvm-svn: 260759
2016-02-12 22:56:03 +00:00
Derek Schuff
6f279569a2 [WebAssembly] Update test expectations after r260737
llvm-svn: 260750
2016-02-12 22:05:08 +00:00
Dan Gohman
25721173a7 [WebAssembly] Fix byval for empty types.
llvm-svn: 260740
2016-02-12 21:30:18 +00:00
Dan Gohman
3aceffcf65 [WebAssembly] Fix insertion of a BLOCK in a loop header that also ends a BLOCK.
llvm-svn: 260737
2016-02-12 21:19:25 +00:00
Derek Schuff
c7a1a0c125 [WebAssembly] Reformat WebAssemblyFrameLowering and WebAssemblyISelLowering
Reviewers: sunfish, jfb

Subscribers: jfb, dschuff

Differential Revision: http://reviews.llvm.org/D17156

llvm-svn: 260585
2016-02-11 20:57:09 +00:00
Derek Schuff
41d067a08e [WebAssembly] Re-triage list of compilation failures for torture tests
llvm-svn: 260438
2016-02-10 21:43:16 +00:00
Derek Schuff
5c2592b245 [WebAssembly] Address comments left over from r260421
llvm-svn: 260429
2016-02-10 20:14:15 +00:00
Derek Schuff
08898bef47 [WebAssembly] Switch varags calling convention to use a register
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
2016-02-10 19:51:04 +00:00
Dan Gohman
32a15ba966 [WebAssembly] Update the br_if instructions' operand orders to match the spec.
llvm-svn: 260152
2016-02-08 21:50:13 +00:00