Commit Graph

25 Commits

Author SHA1 Message Date
Rui Ueyama
18f2ff8f8c Fix another -Wunused-variable for non-assert build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281073 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-09 18:37:08 +00:00
Rui Ueyama
8b2faaa82b Fix -Wunused-variable for non-assert build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281069 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-09 18:07:33 +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
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
da2666ce94 GlobalISel: switch to SmallVector for pending legalizations.
std::queue was doing far to many heap allocations to be healthy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279992 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-29 19:27:20 +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
Quentin Colombet
bbef3e060a [MachineLegalize] Do not abort when the target wants to fall back.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279904 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-27 02:38:21 +00:00
Tim Northover
75d2e48802 GlobalISel: simplify G_ICMP legalization regime.
It's unclear how the old

    %res(32) = G_ICMP { s32, s32 } intpred(eq), %0, %1

is actually different from an s1 verison

    %res(1) = G_ICMP { s1, s32 } intpred(eq), %0, %1

so we'll remove it for now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279843 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-26 17:46:17 +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
Tim Northover
e7265c7232 GlobalISel: legalize under-width divisions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279841 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-26 17:46:06 +00:00
Tim Northover
042ca5a33a GlobalISel: perform multi-step legalization
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279758 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-25 17:37:32 +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
4f24b7db0e GlobalISel: legalize integer comparisons on AArch64.
Next step is doing both legalizations at the same time! Marvel at GlobalISel's
cunning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279566 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-23 21:01:26 +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
6df27f96bc GlobalISel: legalize 1-bit load/store and mark 8/16 bit variants legal on AArch64.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279548 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-23 18:20:09 +00:00
Tim Northover
4e4ac88cfa GlobalISel: support legalization of G_FCONSTANTs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279341 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 22:40:08 +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
2c69b1853b GlobalISel: improve representation of G_SEQUENCE and G_EXTRACT
First, make sure all types involved are represented, rather than being implicit
from the register width.

Second, canonicalize all types to scalar. These operations just act in bits and
don't care about vectors.

Also standardize spelling of Indices in the MachineIRBuilder (NFC here).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279294 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 18:32:14 +00:00
Tim Northover
8d29e44d95 GlobalISel: support translation of extractvalue instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279285 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 17:47:05 +00:00
Tim Northover
2fd227abc8 GlobalISel: support overflow arithmetic intrinsics.
Unsigned addition and subtraction can reuse the instructions created to
legalize large width operations (i.e. both produce and consume a carry flag).
Signed operations and multiplies get a dedicated op-with-overflow instruction.

Once this is produced the two values are combined into a struct register (which
will almost always be merged with a corresponding G_EXTRACT as part of
legalization).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279278 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 17:17:06 +00:00
Tim Northover
df7cecc36b GlobalISel: extend add widening to SUB, MUL, OR, AND and XOR.
These are the operations that are trivially identical. Division is omitted for
now because you need to use the correct sign/zero extension.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277775 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-04 21:39:49 +00:00
Tim Northover
6857d7cf47 GlobalISel: implement narrowing for G_ADD.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277769 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-04 20:54:13 +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
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