[llvm] 3ea1422 - [CodeGen] Add back setOperationAction/setLoadExtAction/setLibcallName single opcode variants
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 18 05:02:17 PDT 2022
Author: Simon Pilgrim
Date: 2022-06-18T13:02:05+01:00
New Revision: 3ea1422362c619c8ea7cba3e92aa716fa0c0cc5e
URL: https://github.com/llvm/llvm-project/commit/3ea1422362c619c8ea7cba3e92aa716fa0c0cc5e
DIFF: https://github.com/llvm/llvm-project/commit/3ea1422362c619c8ea7cba3e92aa716fa0c0cc5e.diff
LOG: [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.
Added:
Modified:
llvm/include/llvm/CodeGen/TargetLowering.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/CodeGen/TargetLowering.h b/llvm/include/llvm/CodeGen/TargetLowering.h
index c974d96db34d7..cbfd284b31ca2 100644
--- a/llvm/include/llvm/CodeGen/TargetLowering.h
+++ b/llvm/include/llvm/CodeGen/TargetLowering.h
@@ -2286,12 +2286,14 @@ class TargetLoweringBase {
/// 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<unsigned> 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<unsigned> Ops, ArrayRef<MVT> VTs,
LegalizeAction Action) {
@@ -2301,20 +2303,20 @@ class TargetLoweringBase {
/// 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<unsigned> 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<unsigned> ExtTypes, MVT ValVT,
ArrayRef<MVT> MemVTs, LegalizeAction Action) {
for (auto MemVT : MemVTs)
@@ -3054,9 +3056,12 @@ class TargetLoweringBase {
//
/// Rename the default libcall routine name for the specified libcall.
+ void setLibcallName(RTLIB::Libcall Call, const char *Name) {
+ LibcallRoutineNames[Call] = Name;
+ }
void setLibcallName(ArrayRef<RTLIB::Libcall> Calls, const char *Name) {
for (auto Call : Calls)
- LibcallRoutineNames[Call] = Name;
+ setLibcallName(Call, Name);
}
/// Get the libcall routine name for the specified libcall.
More information about the llvm-commits
mailing list