15 #ifndef LLVM_LIB_CODEGEN_SELECTIONDAG_LEGALIZETYPES_H 16 #define LLVM_LIB_CODEGEN_SELECTIONDAG_LEGALIZETYPES_H 59 TargetLowering::ValueTypeActionImpl ValueTypeActions;
63 return TLI.getTypeAction(*DAG.
getContext(), VT);
67 bool isTypeLegal(
EVT VT)
const {
72 bool isSimpleLegalType(
EVT VT)
const {
73 return VT.
isSimple() && TLI.isTypeLegal(VT);
76 EVT getSetCCResultType(
EVT VT)
const {
81 bool IgnoreNodeResults(
SDNode *
N)
const {
91 TableId NextValueId = 1;
136 TableId getTableId(
SDValue V) {
139 auto I = ValueToIdMap.
find(V);
140 if (I != ValueToIdMap.
end()) {
143 assert(I->second &&
"All Ids should be nonzero");
147 ValueToIdMap.
insert(std::make_pair(V, NextValueId));
148 IdToValueMap.
insert(std::make_pair(NextValueId, V));
150 assert(NextValueId != 0 &&
151 "Ran out of Ids. Increase id type size or add compactification");
152 return NextValueId - 1;
157 assert(Id &&
"TableId should be non-zero");
158 return IdToValueMap[
Id];
163 : TLI(dag.getTargetLoweringInfo()), DAG(dag),
164 ValueTypeActions(TLI.getValueTypeActions()) {
166 "Too many value types for ValueTypeActions to hold!");
176 TableId NewId = getTableId(
SDValue(New, i));
177 TableId OldId = getTableId(
SDValue(Old, i));
180 ReplacedValues[OldId] = NewId;
184 IdToValueMap.
erase(OldId);
185 PromotedIntegers.
erase(OldId);
186 ExpandedIntegers.
erase(OldId);
187 SoftenedFloats.
erase(OldId);
188 PromotedFloats.
erase(OldId);
189 ExpandedFloats.
erase(OldId);
190 ScalarizedVectors.
erase(OldId);
191 SplitVectors.
erase(OldId);
192 WidenedVectors.
erase(OldId);
200 void AnalyzeNewValue(
SDValue &Val);
201 void PerformExpensiveChecks();
202 void RemapId(TableId &Id);
209 bool CustomLowerNode(
SDNode *N,
EVT VT,
bool LegalizeResult);
210 bool CustomWidenLowerNode(
SDNode *N,
EVT VT);
219 std::pair<SDValue, SDValue> ExpandAtomic(
SDNode *
Node);
242 TableId &PromotedId = PromotedIntegers[getTableId(Op)];
243 SDValue PromotedOp = getSDValue(PromotedId);
253 Op = GetPromotedInteger(Op);
262 Op = GetPromotedInteger(Op);
273 Op = GetPromotedInteger(Op);
274 if (TLI.isSExtCheaperThanZExt(OldVT, Op.
getValueType()))
281 void PromoteIntegerResult(
SDNode *N,
unsigned ResNo);
282 SDValue PromoteIntRes_MERGE_VALUES(
SDNode *N,
unsigned ResNo);
326 SDValue PromoteIntRes_ADDSUBCARRY(
SDNode *N,
unsigned ResNo);
338 bool PromoteIntegerOperand(
SDNode *N,
unsigned OpNo);
346 SDValue PromoteIntOp_INSERT_VECTOR_ELT(
SDNode *N,
unsigned OpNo);
391 void ExpandIntegerResult(
SDNode *N,
unsigned ResNo);
437 void ExpandShiftByConstant(
SDNode *N,
const APInt &Amt,
443 bool ExpandIntegerOperand(
SDNode *N,
unsigned OpNo);
469 TableId Id = getTableId(Op);
470 auto Iter = SoftenedFloats.
find(Id);
471 if (Iter == SoftenedFloats.
end()) {
473 "Operand wasn't converted to integer?");
476 SDValue SoftenedOp = getSDValue(Iter->second);
477 assert(SoftenedOp.
getNode() &&
"Unconverted op in SoftenedFloats?");
483 void SoftenFloatResult(
SDNode *N,
unsigned ResNo);
486 SDValue SoftenFloatRes_MERGE_VALUES(
SDNode *N,
unsigned ResNo);
490 SDValue SoftenFloatRes_EXTRACT_VECTOR_ELT(
SDNode *N,
unsigned ResNo);
530 bool SoftenFloatOperand(
SDNode *N,
unsigned OpNo);
559 void ExpandFloatResult(
SDNode *N,
unsigned ResNo);
598 bool ExpandFloatOperand(
SDNode *N,
unsigned OpNo);
620 TableId &PromotedId = PromotedFloats[getTableId(Op)];
621 SDValue PromotedOp = getSDValue(PromotedId);
627 void PromoteFloatResult(
SDNode *N,
unsigned ResNo);
644 bool PromoteFloatOperand(
SDNode *N,
unsigned OpNo);
661 TableId &ScalarizedId = ScalarizedVectors[getTableId(Op)];
662 SDValue ScalarizedOp = getSDValue(ScalarizedId);
663 assert(ScalarizedOp.
getNode() &&
"Operand wasn't scalarized?");
669 void ScalarizeVectorResult(
SDNode *N,
unsigned ResNo);
670 SDValue ScalarizeVecRes_MERGE_VALUES(
SDNode *N,
unsigned ResNo);
675 SDValue ScalarizeVecRes_OverflowOp(
SDNode *N,
unsigned ResNo);
697 bool ScalarizeVectorOperand(
SDNode *N,
unsigned OpNo);
707 SDValue ScalarizeVecOp_STRICT_FP_ROUND(
SDNode *N,
unsigned OpNo);
725 void SplitVectorResult(
SDNode *N,
unsigned ResNo);
733 void SplitVecRes_OverflowOp(
SDNode *N,
unsigned ResNo,
756 bool SplitVectorOperand(
SDNode *N,
unsigned OpNo);
786 TableId &WidenedId = WidenedVectors[getTableId(Op)];
787 SDValue WidenedOp = getSDValue(WidenedId);
794 void WidenVectorResult(
SDNode *N,
unsigned ResNo);
829 bool WidenVectorOperand(
SDNode *N,
unsigned OpNo);
904 GetSplitVector(Op, Lo, Hi);
906 GetExpandedInteger(Op, Lo, Hi);
908 GetExpandedFloat(Op, Lo, Hi);
916 void SplitRes_MERGE_VALUES(
SDNode *N,
unsigned ResNo,
922 void SplitVSETCC(
const SDNode *N);
935 GetExpandedInteger(Op, Lo, Hi);
937 GetExpandedFloat(Op, Lo, Hi);
943 void IntegerToVector(
SDValue Op,
unsigned NumElements,
947 void ExpandRes_MERGE_VALUES (
SDNode *N,
unsigned ResNo,
EVT getValueType() const
Return the ValueType of the referenced return value.
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
This class represents lattice values for constants.
EVT getScalarType() const
If this is a vector type, return the element type, otherwise return this.
Libcall
RTLIB::Libcall enum - This enum defines all of the runtime library calls the backend can emit...
bool isInteger() const
Return true if this is an integer or a vector integer type.
This takes an arbitrary SelectionDAG as input and hacks on it until only value types the target machi...
SDNode * getNode() const
get the SDNode which holds the desired result
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
This SDNode is used to implement the code generator support for the llvm IR shufflevector instruction...
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
const DataLayout & getDataLayout() const
This is an SDNode representing atomic operations.
SelectionDAG & getDAG() const
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
This class is used to represent an MSTORE node.
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out...
TargetConstant* - Like Constant*, but the DAG does not do any folding, simplification, or lowering of the constant.
This class is used to represent ISD::STORE nodes.
iterator find(const_arg_type_t< KeyT > Val)
unsigned getNumValues() const
Return the number of values defined/returned by this operator.
bool erase(const KeyT &Val)
LoadExtType
LoadExtType enum - This enum defines the three variants of LOADEXT (load with extension).
#define LLVM_LIBRARY_VISIBILITY
LLVM_LIBRARY_VISIBILITY - If a class marked with this attribute is linked into a shared library...
NodeIdFlags
This pass uses the NodeId on the SDNodes to hold information about the state of the node...
SDValue getZeroExtendInReg(SDValue Op, const SDLoc &DL, EVT VT)
Return the expression required to zero extend the Op value assuming it was the smaller SrcTy value...
void NoteDeletion(SDNode *Old, SDNode *New)
BlockVerifier::State From
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Represents one node in the SelectionDAG.
Class for arbitrary precision integers.
bool isVector() const
Return true if this is a vector value type.
SIGN_EXTEND_INREG - This operator atomically performs a SHL/SRA pair to sign extend a small value in ...
This class is used to represent an MSCATTER node.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LegalizeTypeAction
This enum indicates whether a types are legal for a target, and if not, what action should be used to...
This class is used to represent an MLOAD node.
This class is used to represent an MGATHER node.
SDValue getValueType(EVT)
bool isSimple() const
Test if the given EVT is simple (as opposed to being extended).
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation...
LLVMContext * getContext() const
This file describes how to lower LLVM code to machine code.
DAGTypeLegalizer(SelectionDAG &dag)
This class is used to represent ISD::LOAD nodes.