diff options
author | Tim Northover <tnorthover@apple.com> | 2016-09-15 11:02:19 +0000 |
---|---|---|
committer | Tim Northover <tnorthover@apple.com> | 2016-09-15 11:02:19 +0000 |
commit | 22d82cf1796b6353f3d898e82671d98caede5cd0 (patch) | |
tree | 2579c88246a4bd1aa8ec5fa507e2ae70813486a1 /llvm/lib | |
parent | b293fc783b474cbfdfb4ffe646d5b4afe90e0b79 (diff) | |
download | bcm5719-llvm-22d82cf1796b6353f3d898e82671d98caede5cd0.tar.gz bcm5719-llvm-22d82cf1796b6353f3d898e82671d98caede5cd0.zip |
GlobalISel: legalize GEP instructions with small offsets.
llvm-svn: 281602
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/GlobalISel/MachineLegalizeHelper.cpp | 7 | ||||
-rw-r--r-- | llvm/lib/Target/AArch64/AArch64MachineLegalizer.cpp | 6 |
2 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/MachineLegalizeHelper.cpp b/llvm/lib/CodeGen/GlobalISel/MachineLegalizeHelper.cpp index 7c32cd5314b..6d181396079 100644 --- a/llvm/lib/CodeGen/GlobalISel/MachineLegalizeHelper.cpp +++ b/llvm/lib/CodeGen/GlobalISel/MachineLegalizeHelper.cpp @@ -281,6 +281,13 @@ MachineLegalizeHelper::widenScalar(MachineInstr &MI, unsigned TypeIdx, MI.eraseFromParent(); return Legalized; } + case TargetOpcode::G_GEP: { + assert(TypeIdx == 1 && "unable to legalize pointer of GEP"); + unsigned OffsetExt = MRI.createGenericVirtualRegister(WideTy); + MIRBuilder.buildSExt(OffsetExt, MI.getOperand(2).getReg()); + MI.getOperand(2).setReg(OffsetExt); + return Legalized; + } } } diff --git a/llvm/lib/Target/AArch64/AArch64MachineLegalizer.cpp b/llvm/lib/Target/AArch64/AArch64MachineLegalizer.cpp index a5a7ed60ba1..653c7d53e69 100644 --- a/llvm/lib/Target/AArch64/AArch64MachineLegalizer.cpp +++ b/llvm/lib/Target/AArch64/AArch64MachineLegalizer.cpp @@ -43,6 +43,12 @@ AArch64MachineLegalizer::AArch64MachineLegalizer() { setAction({BinOp, Ty}, Legal); } + setAction({G_GEP, p0}, Legal); + setAction({G_GEP, 1, s64}, Legal); + + for (auto Ty : {s1, s8, s16, s32}) + setAction({G_GEP, 1, Ty}, WidenScalar); + for (auto BinOp : {G_LSHR, G_ASHR, G_SDIV, G_UDIV}) { for (auto Ty : {s32, s64}) setAction({BinOp, Ty}, Legal); |