From 3ea1422362c619c8ea7cba3e92aa716fa0c0cc5e Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Sat, 18 Jun 2022 13:01:59 +0100 Subject: [PATCH] [CodeGen] Add back setOperationAction/setLoadExtAction/setLibcallName single opcode variants The work to add ArrayRef helpers (D122557, D123467 etc.) to the TargetLowering::set* methods resulted in all the single opcode calls to these methods being cast to single element ArrayRef on the fly - resulting in a scary >5x increase in build time (identified with vcperf) on MSVC release builds of most of the TargetLowering/ISelLowering files. This patch adds the back the single opcode variants to various set*Action calls to avoid this issue for now, and updates the ArrayRef helpers to wrap them - I'm still investigating whether the single element ArrayRef build times can be improved. --- llvm/include/llvm/CodeGen/TargetLowering.h | 37 +++++++++++++++++------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/llvm/include/llvm/CodeGen/TargetLowering.h b/llvm/include/llvm/CodeGen/TargetLowering.h index c974d96..cbfd284 100644 --- a/llvm/include/llvm/CodeGen/TargetLowering.h +++ b/llvm/include/llvm/CodeGen/TargetLowering.h @@ -2286,12 +2286,14 @@ protected: /// Indicate that the specified operation does not work with the specified /// type and indicate what to do about it. Note that VT may refer to either /// the type of a result or that of an operand of Op. + void setOperationAction(unsigned Op, MVT VT, LegalizeAction Action) { + assert(Op < array_lengthof(OpActions[0]) && "Table isn't big enough!"); + OpActions[(unsigned)VT.SimpleTy][Op] = Action; + } void setOperationAction(ArrayRef Ops, MVT VT, LegalizeAction Action) { - for (auto Op : Ops) { - assert(Op < array_lengthof(OpActions[0]) && "Table isn't big enough!"); - OpActions[(unsigned)VT.SimpleTy][Op] = Action; - } + for (auto Op : Ops) + setOperationAction(Op, VT, Action); } void setOperationAction(ArrayRef Ops, ArrayRef VTs, LegalizeAction Action) { @@ -2301,20 +2303,20 @@ protected: /// Indicate that the specified load with extension does not work with the /// specified type and indicate what to do about it. + void setLoadExtAction(unsigned ExtType, MVT ValVT, MVT MemVT, + LegalizeAction Action) { + assert(ExtType < ISD::LAST_LOADEXT_TYPE && ValVT.isValid() && + MemVT.isValid() && "Table isn't big enough!"); + assert((unsigned)Action < 0x10 && "too many bits for bitfield array"); + unsigned Shift = 4 * ExtType; + LoadExtActions[ValVT.SimpleTy][MemVT.SimpleTy] &= ~((uint16_t)0xF << Shift); + LoadExtActions[ValVT.SimpleTy][MemVT.SimpleTy] |= (uint16_t)Action << Shift; + } void setLoadExtAction(ArrayRef ExtTypes, MVT ValVT, MVT MemVT, LegalizeAction Action) { - for (auto ExtType : ExtTypes) { - assert(ExtType < ISD::LAST_LOADEXT_TYPE && ValVT.isValid() && - MemVT.isValid() && "Table isn't big enough!"); - assert((unsigned)Action < 0x10 && "too many bits for bitfield array"); - unsigned Shift = 4 * ExtType; - LoadExtActions[ValVT.SimpleTy][MemVT.SimpleTy] &= - ~((uint16_t)0xF << Shift); - LoadExtActions[ValVT.SimpleTy][MemVT.SimpleTy] |= (uint16_t)Action - << Shift; - } + for (auto ExtType : ExtTypes) + setLoadExtAction(ExtType, ValVT, MemVT, Action); } - void setLoadExtAction(ArrayRef ExtTypes, MVT ValVT, ArrayRef MemVTs, LegalizeAction Action) { for (auto MemVT : MemVTs) @@ -3054,9 +3056,12 @@ public: // /// Rename the default libcall routine name for the specified libcall. + void setLibcallName(RTLIB::Libcall Call, const char *Name) { + LibcallRoutineNames[Call] = Name; + } void setLibcallName(ArrayRef Calls, const char *Name) { for (auto Call : Calls) - LibcallRoutineNames[Call] = Name; + setLibcallName(Call, Name); } /// Get the libcall routine name for the specified libcall. -- 2.7.4