Change a parameter of TargetLowering::getVectorTypeBreakdown to MVT,

from EVT.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169849 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Patrik Hagglund
2012-12-11 10:16:19 +00:00
parent 2d916231ff
commit 1d367e9bcc
3 changed files with 25 additions and 18 deletions

View File

@ -339,7 +339,7 @@ public:
unsigned getVectorTypeBreakdown(LLVMContext &Context, EVT VT, unsigned getVectorTypeBreakdown(LLVMContext &Context, EVT VT,
EVT &IntermediateVT, EVT &IntermediateVT,
unsigned &NumIntermediates, unsigned &NumIntermediates,
EVT &RegisterVT) const; MVT &RegisterVT) const;
/// getTgtMemIntrinsic: Given an intrinsic, checks if on the target the /// getTgtMemIntrinsic: Given an intrinsic, checks if on the target the
/// intrinsic will need to map to a MemIntrinsicNode (touches memory). If /// intrinsic will need to map to a MemIntrinsicNode (touches memory). If
@ -609,11 +609,12 @@ public:
return RegisterTypeForVT[VT.getSimpleVT().SimpleTy]; return RegisterTypeForVT[VT.getSimpleVT().SimpleTy];
} }
if (VT.isVector()) { if (VT.isVector()) {
EVT VT1, RegisterVT; EVT VT1;
MVT RegisterVT;
unsigned NumIntermediates; unsigned NumIntermediates;
(void)getVectorTypeBreakdown(Context, VT, VT1, (void)getVectorTypeBreakdown(Context, VT, VT1,
NumIntermediates, RegisterVT); NumIntermediates, RegisterVT);
return RegisterVT.getSimpleVT(); return RegisterVT;
} }
if (VT.isInteger()) { if (VT.isInteger()) {
return getRegisterType(Context, getTypeToTransformTo(Context, VT)); return getRegisterType(Context, getTypeToTransformTo(Context, VT));
@ -634,7 +635,8 @@ public:
return NumRegistersForVT[VT.getSimpleVT().SimpleTy]; return NumRegistersForVT[VT.getSimpleVT().SimpleTy];
} }
if (VT.isVector()) { if (VT.isVector()) {
EVT VT1, VT2; EVT VT1;
MVT VT2;
unsigned NumIntermediates; unsigned NumIntermediates;
return getVectorTypeBreakdown(Context, VT, VT1, NumIntermediates, VT2); return getVectorTypeBreakdown(Context, VT, VT1, NumIntermediates, VT2);
} }

View File

@ -227,15 +227,17 @@ static SDValue getCopyFromPartsVector(SelectionDAG &DAG, DebugLoc DL,
// Handle a multi-element vector. // Handle a multi-element vector.
if (NumParts > 1) { if (NumParts > 1) {
EVT IntermediateVT, RegisterVT; EVT IntermediateVT;
MVT RegisterVT;
unsigned NumIntermediates; unsigned NumIntermediates;
unsigned NumRegs = unsigned NumRegs =
TLI.getVectorTypeBreakdown(*DAG.getContext(), ValueVT, IntermediateVT, TLI.getVectorTypeBreakdown(*DAG.getContext(), ValueVT, IntermediateVT,
NumIntermediates, RegisterVT); NumIntermediates, RegisterVT);
assert(NumRegs == NumParts && "Part count doesn't match vector breakdown!"); assert(NumRegs == NumParts && "Part count doesn't match vector breakdown!");
NumParts = NumRegs; // Silence a compiler warning. NumParts = NumRegs; // Silence a compiler warning.
assert(RegisterVT == PartVT && "Part type doesn't match vector breakdown!"); assert(RegisterVT == PartVT.getSimpleVT() &&
assert(RegisterVT == Parts[0].getValueType() && "Part type doesn't match vector breakdown!");
assert(RegisterVT == Parts[0].getSimpleValueType() &&
"Part type doesn't match part!"); "Part type doesn't match part!");
// Assemble the parts into intermediate operands. // Assemble the parts into intermediate operands.
@ -524,7 +526,8 @@ static void getCopyToPartsVector(SelectionDAG &DAG, DebugLoc DL,
} }
// Handle a multi-element vector. // Handle a multi-element vector.
EVT IntermediateVT, RegisterVT; EVT IntermediateVT;
MVT RegisterVT;
unsigned NumIntermediates; unsigned NumIntermediates;
unsigned NumRegs = TLI.getVectorTypeBreakdown(*DAG.getContext(), ValueVT, unsigned NumRegs = TLI.getVectorTypeBreakdown(*DAG.getContext(), ValueVT,
IntermediateVT, IntermediateVT,
@ -533,7 +536,8 @@ static void getCopyToPartsVector(SelectionDAG &DAG, DebugLoc DL,
assert(NumRegs == NumParts && "Part count doesn't match vector breakdown!"); assert(NumRegs == NumParts && "Part count doesn't match vector breakdown!");
NumParts = NumRegs; // Silence a compiler warning. NumParts = NumRegs; // Silence a compiler warning.
assert(RegisterVT == PartVT && "Part type doesn't match vector breakdown!"); assert(RegisterVT == PartVT.getSimpleVT() &&
"Part type doesn't match vector breakdown!");
// Split the vector into intermediate operands. // Split the vector into intermediate operands.
SmallVector<SDValue, 8> Ops(NumIntermediates); SmallVector<SDValue, 8> Ops(NumIntermediates);

View File

@ -653,7 +653,7 @@ bool TargetLowering::canOpTrap(unsigned Op, EVT VT) const {
static unsigned getVectorTypeBreakdownMVT(MVT VT, MVT &IntermediateVT, static unsigned getVectorTypeBreakdownMVT(MVT VT, MVT &IntermediateVT,
unsigned &NumIntermediates, unsigned &NumIntermediates,
EVT &RegisterVT, MVT &RegisterVT,
TargetLowering *TLI) { TargetLowering *TLI) {
// Figure out the right, legal destination reg to copy into. // Figure out the right, legal destination reg to copy into.
unsigned NumElts = VT.getVectorNumElements(); unsigned NumElts = VT.getVectorNumElements();
@ -865,12 +865,12 @@ void TargetLowering::computeRegisterProperties() {
} }
MVT IntermediateVT; MVT IntermediateVT;
EVT RegisterVT; MVT RegisterVT;
unsigned NumIntermediates; unsigned NumIntermediates;
NumRegistersForVT[i] = NumRegistersForVT[i] =
getVectorTypeBreakdownMVT(VT, IntermediateVT, NumIntermediates, getVectorTypeBreakdownMVT(VT, IntermediateVT, NumIntermediates,
RegisterVT, this); RegisterVT, this);
RegisterTypeForVT[i] = RegisterVT.getSimpleVT(); RegisterTypeForVT[i] = RegisterVT;
MVT NVT = VT.getPow2VectorType(); MVT NVT = VT.getPow2VectorType();
if (NVT == VT) { if (NVT == VT) {
@ -924,7 +924,7 @@ MVT::SimpleValueType TargetLowering::getCmpLibcallReturnType() const {
unsigned TargetLowering::getVectorTypeBreakdown(LLVMContext &Context, EVT VT, unsigned TargetLowering::getVectorTypeBreakdown(LLVMContext &Context, EVT VT,
EVT &IntermediateVT, EVT &IntermediateVT,
unsigned &NumIntermediates, unsigned &NumIntermediates,
EVT &RegisterVT) const { MVT &RegisterVT) const {
unsigned NumElts = VT.getVectorNumElements(); unsigned NumElts = VT.getVectorNumElements();
// If there is a wider vector type with the same element type as this one, // If there is a wider vector type with the same element type as this one,
@ -934,9 +934,10 @@ unsigned TargetLowering::getVectorTypeBreakdown(LLVMContext &Context, EVT VT,
// <4 x i1> -> <4 x i32>. // <4 x i1> -> <4 x i32>.
LegalizeTypeAction TA = getTypeAction(Context, VT); LegalizeTypeAction TA = getTypeAction(Context, VT);
if (NumElts != 1 && (TA == TypeWidenVector || TA == TypePromoteInteger)) { if (NumElts != 1 && (TA == TypeWidenVector || TA == TypePromoteInteger)) {
RegisterVT = getTypeToTransformTo(Context, VT); EVT RegisterEVT = getTypeToTransformTo(Context, VT);
if (isTypeLegal(RegisterVT)) { if (isTypeLegal(RegisterEVT)) {
IntermediateVT = RegisterVT; IntermediateVT = RegisterEVT;
RegisterVT = RegisterEVT.getSimpleVT();
NumIntermediates = 1; NumIntermediates = 1;
return 1; return 1;
} }
@ -969,7 +970,7 @@ unsigned TargetLowering::getVectorTypeBreakdown(LLVMContext &Context, EVT VT,
NewVT = EltTy; NewVT = EltTy;
IntermediateVT = NewVT; IntermediateVT = NewVT;
EVT DestVT = getRegisterType(Context, NewVT); MVT DestVT = getRegisterType(Context, NewVT);
RegisterVT = DestVT; RegisterVT = DestVT;
unsigned NewVTSize = NewVT.getSizeInBits(); unsigned NewVTSize = NewVT.getSizeInBits();
@ -977,7 +978,7 @@ unsigned TargetLowering::getVectorTypeBreakdown(LLVMContext &Context, EVT VT,
if (!isPowerOf2_32(NewVTSize)) if (!isPowerOf2_32(NewVTSize))
NewVTSize = NextPowerOf2(NewVTSize); NewVTSize = NextPowerOf2(NewVTSize);
if (DestVT.bitsLT(NewVT)) // Value is expanded, e.g. i64 -> i16. if (EVT(DestVT).bitsLT(NewVT)) // Value is expanded, e.g. i64 -> i16.
return NumVectorRegs*(NewVTSize/DestVT.getSizeInBits()); return NumVectorRegs*(NewVTSize/DestVT.getSizeInBits());
// Otherwise, promotion or legal types use the same number of registers as // Otherwise, promotion or legal types use the same number of registers as