16 Commits

Author SHA1 Message Date
Tim Northover
3c6f3f0961 GlobalISel: remove G_TYPE and G_PHI
These instructions were only necessary when type information was stored in the
MachineInstr (because only generic MachineInstrs possessed a type). Now that
it's in MachineRegisterInfo, COPY and PHI work fine.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281037 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-09 11:47:31 +00:00
Tim Northover
59282d3fd2 GlobalISel: move type information to MachineRegisterInfo.
We want each register to have a canonical type, which means the best place to
store this is in MachineRegisterInfo rather than on every MachineInstr that
happens to use or define that register.

Most changes following from this are pretty simple (you need an MRI anyway if
you're going to be doing any transformations, so just check the type there).
But legalization doesn't really want to check redundant operands (when, for
example, a G_ADD only ever has one type) so I've made use of MCInstrDesc's
operand type field to encode these constraints and limit legalization's work.

As an added bonus, more validation is possible, both in MachineVerifier and
MachineIRBuilder (coming soon).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281035 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-09 11:46:34 +00:00
Tim Northover
3b190749fe GlobalISel: add a G_PHI instruction to give phis a type.
They're another source of generic vregs, which are going to need a type on the
definition when we remove the register width from MachineRegisterInfo.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280412 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-01 20:45:41 +00:00
Tim Northover
d3b78e0fb6 GlobalISel: use G_TYPE to annotate physregs with a type.
More preparation for dropping source types from MachineInstrs: regsters coming
out of already-selected code (i.e. non-generic instructions) don't have a type,
but that information is needed so we must add it manually.

This is done via a new G_TYPE instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280292 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-31 21:24:02 +00:00
Tim Northover
7c20af79ca GlobalISel: use multi-dimensional arrays for legalize actions.
Instead of putting all possible requests into a single table, we can perform
the extremely dense lookup based on opcode and type-index in constant time
using multi-dimensional array-like things.

This roughly halves the time spent doing legalization, which was dominated by
queries against the Actions table.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280011 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-29 21:00:00 +00:00
Tim Northover
b3b5a54d16 GlobalISel: legalize frem to a libcall on AArch64.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279988 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-29 19:07:16 +00:00
Tim Northover
b04cf870a6 GlobalISel: legalize sdiv and srem operations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279842 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-26 17:46:13 +00:00
Richard Smith
0f97be8885 Don't use "return {...}" to initialize a std::tuple. This has only been valid
since 2015 (n4387), though it's allowed by a library DR so new implementations
accept it in their C++11 modes...

This should unbreak the build with libstdc++ 4.9.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279583 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-23 22:21:58 +00:00
Tim Northover
2a105605e3 GlobalISel: make truncate/extend casts uniform
They really should have both types represented, but early variants were created
before MachineInstrs could have multiple types so they're rather ambiguous.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279567 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-23 21:01:33 +00:00
Tim Northover
29562575f9 GlobalISel: legalize conditional branches on AArch64.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279565 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-23 21:01:20 +00:00
Tim Northover
585ed95521 GlobalISel: extend legalizer interface to handle multiple types.
Instructions like G_ICMP have multiple types that may need to be legalized (the
boolean output and nearly arbitrary inputs in this case). So the legalizer must
be capable of deciding what to do for each of them separately.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279554 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-23 19:30:42 +00:00
Tim Northover
077e6b76e8 GlobalISel: teach legalizer how to handle integer constants.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279340 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 22:40:00 +00:00
Tim Northover
143570a5a5 GlobalISel: add code to widen scalar G_ADD
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277747 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-04 18:35:11 +00:00
Ahmed Bougacha
99853c1c1d [GlobalISel] Const-ify MachineInstrs passed to MachineLegalizer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277445 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 11:41:03 +00:00
Tim Northover
ea26cb1f48 GlobalISel: implement legalization pass, with just one transformation.
This adds the actual MachineLegalizeHelper to do the work and a trivial pass
wrapper that legalizes all instructions in a MachineFunction. Currently the
only transformation supported is splitting up a vector G_ADD into one acting on
smaller vectors.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276461 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-22 20:03:43 +00:00
Tim Northover
6f08925c54 GlobalISel: implement Legalization querying framework.
This adds an (incomplete, inefficient) framework for deciding what to do with
some operation on a given type.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276184 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-20 21:13:29 +00:00