[llvm] 0f2af15 - GlobalISel: Make default implementation of legalizeCustom unreachable
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 10 08:06:09 PDT 2020
Author: Matt Arsenault
Date: 2020-06-10T11:05:59-04:00
New Revision: 0f2af15c1b00a08b84b780143001e04a25994628
URL: https://github.com/llvm/llvm-project/commit/0f2af15c1b00a08b84b780143001e04a25994628
DIFF: https://github.com/llvm/llvm-project/commit/0f2af15c1b00a08b84b780143001e04a25994628.diff
LOG: GlobalISel: Make default implementation of legalizeCustom unreachable
If the target explicitly requested custom legalization, it should be
required to implement this. Also move default legalizeIntrinsic
implementation into the header so it's next to the related
legalizeCustom.
Added:
Modified:
llvm/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h
llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h b/llvm/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h
index cc549c4e9440..8185cd5221d3 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h
@@ -1210,14 +1210,19 @@ class LegalizerInfo {
bool isLegalOrCustom(const MachineInstr &MI,
const MachineRegisterInfo &MRI) const;
+ /// Called for instructions with the Custom LegalizationAction.
virtual bool legalizeCustom(MachineInstr &MI, MachineRegisterInfo &MRI,
MachineIRBuilder &MIRBuilder,
- GISelChangeObserver &Observer) const;
+ GISelChangeObserver &Observer) const {
+ llvm_unreachable("must implement this if custom action is used");
+ }
- /// Return true if MI is either legal or has been legalized and false
- /// if not legal.
+ /// \returns true if MI is either legal or has been legalized and false if not
+ /// legal.
virtual bool legalizeIntrinsic(MachineInstr &MI, MachineIRBuilder &MIRBuilder,
- GISelChangeObserver &Observer) const;
+ GISelChangeObserver &Observer) const {
+ return true;
+ }
/// Return the opcode (SEXT/ZEXT/ANYEXT) that should be performed while
/// widening a constant of type SmallTy which targets can override.
diff --git a/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp b/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp
index 5a8f8fd6a698..4abd0c4df97a 100644
--- a/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp
@@ -524,12 +524,6 @@ bool LegalizerInfo::isLegalOrCustom(const MachineInstr &MI,
return Action == Legal || Action == Custom;
}
-bool LegalizerInfo::legalizeCustom(MachineInstr &MI, MachineRegisterInfo &MRI,
- MachineIRBuilder &MIRBuilder,
- GISelChangeObserver &Observer) const {
- return false;
-}
-
LegalizerInfo::SizeAndActionsVec
LegalizerInfo::increaseToLargerTypesAndDecreaseToLargest(
const SizeAndActionsVec &v, LegalizeAction IncreaseAction,
@@ -687,12 +681,6 @@ LegalizerInfo::findVectorLegalAction(const InstrAspect &Aspect) const {
IntermediateType.getScalarSizeInBits())};
}
-bool LegalizerInfo::legalizeIntrinsic(MachineInstr &MI,
- MachineIRBuilder &MIRBuilder,
- GISelChangeObserver &Observer) const {
- return true;
-}
-
unsigned LegalizerInfo::getExtOpcodeForWideningConstant(LLT SmallTy) const {
return SmallTy.isByteSized() ? TargetOpcode::G_SEXT : TargetOpcode::G_ZEXT;
}
More information about the llvm-commits
mailing list