diff options
author | Tim Northover <tnorthover@apple.com> | 2017-03-03 23:05:47 +0000 |
---|---|---|
committer | Tim Northover <tnorthover@apple.com> | 2017-03-03 23:05:47 +0000 |
commit | 3e6a7afd8195d5d8ac28fb1b7e1c28f763d73a2e (patch) | |
tree | 3f7fa9ab5b9610ab6d07e28d1f2477c11f6ed53f /llvm/lib | |
parent | 5ba962706f6ccd36fce7660314f34809685eee9c (diff) | |
download | bcm5719-llvm-3e6a7afd8195d5d8ac28fb1b7e1c28f763d73a2e.tar.gz bcm5719-llvm-3e6a7afd8195d5d8ac28fb1b7e1c28f763d73a2e.zip |
GlobalISel: constrain G_INSERT to inserting just one value per instruction.
It's much easier to reason about single-value inserts and no-one was actually
using the variadic variants before.
llvm-svn: 296923
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp | 9 | ||||
-rw-r--r-- | llvm/lib/Target/AArch64/AArch64LegalizerInfo.cpp | 5 |
2 files changed, 11 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp b/llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp index 41985e3a328..5eea7268c5e 100644 --- a/llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp +++ b/llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp @@ -456,6 +456,15 @@ MachineInstrBuilder MachineIRBuilder::buildUnmerge(ArrayRef<unsigned> Res, return MIB; } +MachineInstrBuilder MachineIRBuilder::buildInsert(unsigned Res, unsigned Src, + unsigned Op, unsigned Index) { + return buildInstr(TargetOpcode::G_INSERT) + .addDef(Res) + .addUse(Src) + .addUse(Op) + .addImm(Index); +} + MachineInstrBuilder MachineIRBuilder::buildIntrinsic(Intrinsic::ID ID, unsigned Res, bool HasSideEffects) { diff --git a/llvm/lib/Target/AArch64/AArch64LegalizerInfo.cpp b/llvm/lib/Target/AArch64/AArch64LegalizerInfo.cpp index 651925e616f..6e6daf81229 100644 --- a/llvm/lib/Target/AArch64/AArch64LegalizerInfo.cpp +++ b/llvm/lib/Target/AArch64/AArch64LegalizerInfo.cpp @@ -88,14 +88,13 @@ AArch64LegalizerInfo::AArch64LegalizerInfo() { setAction({BinOp, s64}, Libcall); } - // FIXME: what should we do about G_INSERTs with more than one source value? - // For now the default of not specifying means we'll fall back. - for (auto Ty : {s32, s64}) { + for (auto Ty : {s32, s64, p0}) { setAction({G_INSERT, Ty}, Legal); setAction({G_INSERT, 1, Ty}, Legal); } for (auto Ty : {s1, s8, s16}) { setAction({G_INSERT, Ty}, WidenScalar); + setAction({G_INSERT, 1, Ty}, Legal); // FIXME: Can't widen the sources because that violates the constraints on // G_INSERT (It seems entirely reasonable that inputs shouldn't overlap). } |