From a01bece1dcbc95cb7e99421e050e27e231f6e995 Mon Sep 17 00:00:00 2001 From: Tim Northover Date: Tue, 23 Aug 2016 19:30:42 +0000 Subject: 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. llvm-svn: 279554 --- .../lib/Target/AArch64/AArch64MachineLegalizer.cpp | 35 +++++++++++++--------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'llvm/lib/Target') diff --git a/llvm/lib/Target/AArch64/AArch64MachineLegalizer.cpp b/llvm/lib/Target/AArch64/AArch64MachineLegalizer.cpp index 2a56ecd6b5b..901bbf1b9b9 100644 --- a/llvm/lib/Target/AArch64/AArch64MachineLegalizer.cpp +++ b/llvm/lib/Target/AArch64/AArch64MachineLegalizer.cpp @@ -26,6 +26,7 @@ using namespace llvm; AArch64MachineLegalizer::AArch64MachineLegalizer() { using namespace TargetOpcode; + const LLT p0 = LLT::pointer(0); const LLT s1 = LLT::scalar(1); const LLT s8 = LLT::scalar(8); const LLT s16 = LLT::scalar(16); @@ -37,43 +38,49 @@ AArch64MachineLegalizer::AArch64MachineLegalizer() { for (auto BinOp : {G_ADD, G_SUB, G_MUL, G_AND, G_OR, G_XOR}) { for (auto Ty : {s32, s64, v2s32, v4s32, v2s64}) - setAction(BinOp, Ty, Legal); + setAction({BinOp, Ty}, Legal); for (auto Ty : {s8, s16}) - setAction(BinOp, Ty, WidenScalar); + setAction({BinOp, Ty}, WidenScalar); } for (auto BinOp : {G_SHL, G_LSHR, G_ASHR, G_SDIV, G_UDIV}) for (auto Ty : {s32, s64}) - setAction(BinOp, Ty, Legal); + setAction({BinOp, Ty}, Legal); for (auto BinOp : {G_FADD, G_FSUB, G_FMUL, G_FDIV}) for (auto Ty : {s32, s64}) - setAction(BinOp, Ty, Legal); + setAction({BinOp, Ty}, Legal); for (auto MemOp : {G_LOAD, G_STORE}) { for (auto Ty : {s8, s16, s32, s64}) - setAction(MemOp, Ty, Legal); + setAction({MemOp, Ty}, Legal); - setAction(MemOp, s1, WidenScalar); + setAction({MemOp, s1}, WidenScalar); + + // And everything's fine in addrspace 0. + setAction({MemOp, 1, p0}, Legal); } for (auto Ty : {s32, s64}) { - setAction(TargetOpcode::G_CONSTANT, Ty, Legal); - setAction(TargetOpcode::G_FCONSTANT, Ty, Legal); + setAction({TargetOpcode::G_CONSTANT, Ty}, Legal); + setAction({TargetOpcode::G_FCONSTANT, Ty}, Legal); } for (auto Ty : {s1, s8, s16}) - setAction(TargetOpcode::G_CONSTANT, Ty, WidenScalar); + setAction({TargetOpcode::G_CONSTANT, Ty}, WidenScalar); + + setAction({TargetOpcode::G_FCONSTANT, s16}, WidenScalar); - setAction(TargetOpcode::G_FCONSTANT, s16, WidenScalar); + setAction({G_BR, LLT::unsized()}, Legal); - setAction(G_BR, LLT::unsized(), Legal); + setAction({G_FRAME_INDEX, p0}, Legal); - setAction(G_FRAME_INDEX, LLT::pointer(0), Legal); + setAction({G_PTRTOINT, 0, s64}, Legal); + setAction({G_PTRTOINT, 1, p0}, Legal); - setAction(G_PTRTOINT, s64, Legal); - setAction(G_INTTOPTR, LLT::pointer(0), Legal); + setAction({G_INTTOPTR, 0, p0}, Legal); + setAction({G_INTTOPTR, 1, s64}, Legal); computeTables(); } -- cgit v1.2.3