More 80 violations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101330 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng
2010-04-15 01:25:27 +00:00
parent 44398693e7
commit adf979900c
5 changed files with 54 additions and 29 deletions

View File

@ -407,7 +407,9 @@ SDValue ExpandUnalignedStore(StoreSDNode *ST, SelectionDAG &DAG,
// to the final destination using (unaligned) integer loads and stores. // to the final destination using (unaligned) integer loads and stores.
EVT StoredVT = ST->getMemoryVT(); EVT StoredVT = ST->getMemoryVT();
EVT RegVT = EVT RegVT =
TLI.getRegisterType(*DAG.getContext(), EVT::getIntegerVT(*DAG.getContext(), StoredVT.getSizeInBits())); TLI.getRegisterType(*DAG.getContext(),
EVT::getIntegerVT(*DAG.getContext(),
StoredVT.getSizeInBits()));
unsigned StoredBytes = StoredVT.getSizeInBits() / 8; unsigned StoredBytes = StoredVT.getSizeInBits() / 8;
unsigned RegBytes = RegVT.getSizeInBits() / 8; unsigned RegBytes = RegVT.getSizeInBits() / 8;
unsigned NumRegs = (StoredBytes + RegBytes - 1) / RegBytes; unsigned NumRegs = (StoredBytes + RegBytes - 1) / RegBytes;
@ -443,7 +445,8 @@ SDValue ExpandUnalignedStore(StoreSDNode *ST, SelectionDAG &DAG,
// The last store may be partial. Do a truncating store. On big-endian // The last store may be partial. Do a truncating store. On big-endian
// machines this requires an extending load from the stack slot to ensure // machines this requires an extending load from the stack slot to ensure
// that the bits are in the right place. // that the bits are in the right place.
EVT MemVT = EVT::getIntegerVT(*DAG.getContext(), 8 * (StoredBytes - Offset)); EVT MemVT = EVT::getIntegerVT(*DAG.getContext(),
8 * (StoredBytes - Offset));
// Load from the stack slot. // Load from the stack slot.
SDValue Load = DAG.getExtLoad(ISD::EXTLOAD, dl, RegVT, Store, StackPtr, SDValue Load = DAG.getExtLoad(ISD::EXTLOAD, dl, RegVT, Store, StackPtr,
@ -546,7 +549,8 @@ SDValue ExpandUnalignedLoad(LoadSDNode *LD, SelectionDAG &DAG,
} }
// The last copy may be partial. Do an extending load. // The last copy may be partial. Do an extending load.
EVT MemVT = EVT::getIntegerVT(*DAG.getContext(), 8 * (LoadedBytes - Offset)); EVT MemVT = EVT::getIntegerVT(*DAG.getContext(),
8 * (LoadedBytes - Offset));
SDValue Load = DAG.getExtLoad(ISD::EXTLOAD, dl, RegVT, Chain, Ptr, SDValue Load = DAG.getExtLoad(ISD::EXTLOAD, dl, RegVT, Chain, Ptr,
LD->getSrcValue(), SVOffset + Offset, LD->getSrcValue(), SVOffset + Offset,
MemVT, LD->isVolatile(), MemVT, LD->isVolatile(),
@ -1392,7 +1396,8 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
// Promote to a byte-sized store with upper bits zero if not // Promote to a byte-sized store with upper bits zero if not
// storing an integral number of bytes. For example, promote // storing an integral number of bytes. For example, promote
// TRUNCSTORE:i1 X -> TRUNCSTORE:i8 (and X, 1) // TRUNCSTORE:i1 X -> TRUNCSTORE:i8 (and X, 1)
EVT NVT = EVT::getIntegerVT(*DAG.getContext(), StVT.getStoreSizeInBits()); EVT NVT = EVT::getIntegerVT(*DAG.getContext(),
StVT.getStoreSizeInBits());
Tmp3 = DAG.getZeroExtendInReg(Tmp3, dl, StVT); Tmp3 = DAG.getZeroExtendInReg(Tmp3, dl, StVT);
Result = DAG.getTruncStore(Tmp1, dl, Tmp3, Tmp2, ST->getSrcValue(), Result = DAG.getTruncStore(Tmp1, dl, Tmp3, Tmp2, ST->getSrcValue(),
SVOffset, NVT, isVolatile, isNonTemporal, SVOffset, NVT, isVolatile, isNonTemporal,
@ -1736,8 +1741,8 @@ SDValue SelectionDAGLegalize::EmitStackConvert(SDValue SrcOp,
unsigned SrcSize = SrcOp.getValueType().getSizeInBits(); unsigned SrcSize = SrcOp.getValueType().getSizeInBits();
unsigned SlotSize = SlotVT.getSizeInBits(); unsigned SlotSize = SlotVT.getSizeInBits();
unsigned DestSize = DestVT.getSizeInBits(); unsigned DestSize = DestVT.getSizeInBits();
unsigned DestAlign = const Type *DestType = DestVT.getTypeForEVT(*DAG.getContext());
TLI.getTargetData()->getPrefTypeAlignment(DestVT.getTypeForEVT(*DAG.getContext())); unsigned DestAlign = TLI.getTargetData()->getPrefTypeAlignment(DestType);
// Emit a store to the stack slot. Use a truncstore if the input value is // Emit a store to the stack slot. Use a truncstore if the input value is
// later than DestVT. // later than DestVT.

View File

@ -109,14 +109,16 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_BIT_CONVERT(SDNode *N) {
SDValue DAGTypeLegalizer::SoftenFloatRes_BUILD_PAIR(SDNode *N) { SDValue DAGTypeLegalizer::SoftenFloatRes_BUILD_PAIR(SDNode *N) {
// Convert the inputs to integers, and build a new pair out of them. // Convert the inputs to integers, and build a new pair out of them.
return DAG.getNode(ISD::BUILD_PAIR, N->getDebugLoc(), return DAG.getNode(ISD::BUILD_PAIR, N->getDebugLoc(),
TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0)), TLI.getTypeToTransformTo(*DAG.getContext(),
N->getValueType(0)),
BitConvertToInteger(N->getOperand(0)), BitConvertToInteger(N->getOperand(0)),
BitConvertToInteger(N->getOperand(1))); BitConvertToInteger(N->getOperand(1)));
} }
SDValue DAGTypeLegalizer::SoftenFloatRes_ConstantFP(ConstantFPSDNode *N) { SDValue DAGTypeLegalizer::SoftenFloatRes_ConstantFP(ConstantFPSDNode *N) {
return DAG.getConstant(N->getValueAPF().bitcastToAPInt(), return DAG.getConstant(N->getValueAPF().bitcastToAPInt(),
TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0))); TLI.getTypeToTransformTo(*DAG.getContext(),
N->getValueType(0)));
} }
SDValue DAGTypeLegalizer::SoftenFloatRes_EXTRACT_VECTOR_ELT(SDNode *N) { SDValue DAGTypeLegalizer::SoftenFloatRes_EXTRACT_VECTOR_ELT(SDNode *N) {
@ -338,7 +340,8 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_FP_EXTEND(SDNode *N) {
SDValue DAGTypeLegalizer::SoftenFloatRes_FP16_TO_FP32(SDNode *N) { SDValue DAGTypeLegalizer::SoftenFloatRes_FP16_TO_FP32(SDNode *N) {
EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0)); EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0));
SDValue Op = N->getOperand(0); SDValue Op = N->getOperand(0);
return MakeLibCall(RTLIB::FPEXT_F16_F32, NVT, &Op, 1, false, N->getDebugLoc()); return MakeLibCall(RTLIB::FPEXT_F16_F32, NVT, &Op, 1, false,
N->getDebugLoc());
} }
SDValue DAGTypeLegalizer::SoftenFloatRes_FP_ROUND(SDNode *N) { SDValue DAGTypeLegalizer::SoftenFloatRes_FP_ROUND(SDNode *N) {
@ -489,7 +492,8 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_SELECT_CC(SDNode *N) {
} }
SDValue DAGTypeLegalizer::SoftenFloatRes_UNDEF(SDNode *N) { SDValue DAGTypeLegalizer::SoftenFloatRes_UNDEF(SDNode *N) {
return DAG.getUNDEF(TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0))); return DAG.getUNDEF(TLI.getTypeToTransformTo(*DAG.getContext(),
N->getValueType(0)));
} }
SDValue DAGTypeLegalizer::SoftenFloatRes_VAARG(SDNode *N) { SDValue DAGTypeLegalizer::SoftenFloatRes_VAARG(SDNode *N) {
@ -531,7 +535,8 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_XINT_TO_FP(SDNode *N) {
// Sign/zero extend the argument if the libcall takes a larger type. // Sign/zero extend the argument if the libcall takes a larger type.
SDValue Op = DAG.getNode(Signed ? ISD::SIGN_EXTEND : ISD::ZERO_EXTEND, dl, SDValue Op = DAG.getNode(Signed ? ISD::SIGN_EXTEND : ISD::ZERO_EXTEND, dl,
NVT, N->getOperand(0)); NVT, N->getOperand(0));
return MakeLibCall(LC, TLI.getTypeToTransformTo(*DAG.getContext(), RVT), &Op, 1, false, dl); return MakeLibCall(LC, TLI.getTypeToTransformTo(*DAG.getContext(), RVT),
&Op, 1, false, dl);
} }
@ -1403,7 +1408,8 @@ SDValue DAGTypeLegalizer::ExpandFloatOp_STORE(SDNode *N, unsigned OpNo) {
SDValue Chain = ST->getChain(); SDValue Chain = ST->getChain();
SDValue Ptr = ST->getBasePtr(); SDValue Ptr = ST->getBasePtr();
EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), ST->getValue().getValueType()); EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(),
ST->getValue().getValueType());
assert(NVT.isByteSized() && "Expanded type not byte sized!"); assert(NVT.isByteSized() && "Expanded type not byte sized!");
assert(ST->getMemoryVT().bitsLE(NVT) && "Float type not round?"); assert(ST->getMemoryVT().bitsLE(NVT) && "Float type not round?");

View File

@ -204,7 +204,8 @@ SDValue DAGTypeLegalizer::PromoteIntRes_BIT_CONVERT(SDNode *N) {
std::swap(Lo, Hi); std::swap(Lo, Hi);
InOp = DAG.getNode(ISD::ANY_EXTEND, dl, InOp = DAG.getNode(ISD::ANY_EXTEND, dl,
EVT::getIntegerVT(*DAG.getContext(), NOutVT.getSizeInBits()), EVT::getIntegerVT(*DAG.getContext(),
NOutVT.getSizeInBits()),
JoinIntegers(Lo, Hi)); JoinIntegers(Lo, Hi));
return DAG.getNode(ISD::BIT_CONVERT, dl, NOutVT, InOp); return DAG.getNode(ISD::BIT_CONVERT, dl, NOutVT, InOp);
} }
@ -1968,7 +1969,8 @@ void DAGTypeLegalizer::ExpandIntRes_ZERO_EXTEND(SDNode *N,
SplitInteger(Res, Lo, Hi); SplitInteger(Res, Lo, Hi);
unsigned ExcessBits = unsigned ExcessBits =
Op.getValueType().getSizeInBits() - NVT.getSizeInBits(); Op.getValueType().getSizeInBits() - NVT.getSizeInBits();
Hi = DAG.getZeroExtendInReg(Hi, dl, EVT::getIntegerVT(*DAG.getContext(), ExcessBits)); Hi = DAG.getZeroExtendInReg(Hi, dl,
EVT::getIntegerVT(*DAG.getContext(), ExcessBits));
} }
} }
@ -2269,7 +2271,8 @@ SDValue DAGTypeLegalizer::ExpandIntOp_STORE(StoreSDNode *N, unsigned OpNo) {
unsigned EBytes = ExtVT.getStoreSize(); unsigned EBytes = ExtVT.getStoreSize();
unsigned IncrementSize = NVT.getSizeInBits()/8; unsigned IncrementSize = NVT.getSizeInBits()/8;
unsigned ExcessBits = (EBytes - IncrementSize)*8; unsigned ExcessBits = (EBytes - IncrementSize)*8;
EVT HiVT = EVT::getIntegerVT(*DAG.getContext(), ExtVT.getSizeInBits() - ExcessBits); EVT HiVT = EVT::getIntegerVT(*DAG.getContext(),
ExtVT.getSizeInBits() - ExcessBits);
if (ExcessBits < NVT.getSizeInBits()) { if (ExcessBits < NVT.getSizeInBits()) {
// Transfer high bits from the top of Lo to the bottom of Hi. // Transfer high bits from the top of Lo to the bottom of Hi.

View File

@ -173,7 +173,8 @@ void DAGTypeLegalizer::ExpandRes_EXTRACT_VECTOR_ELT(SDNode *N, SDValue &Lo,
EVT NewVT = TLI.getTypeToTransformTo(*DAG.getContext(), OldVT); EVT NewVT = TLI.getTypeToTransformTo(*DAG.getContext(), OldVT);
SDValue NewVec = DAG.getNode(ISD::BIT_CONVERT, dl, SDValue NewVec = DAG.getNode(ISD::BIT_CONVERT, dl,
EVT::getVectorVT(*DAG.getContext(), NewVT, 2*OldElts), EVT::getVectorVT(*DAG.getContext(),
NewVT, 2*OldElts),
OldVec); OldVec);
// Extract the elements at 2 * Idx and 2 * Idx + 1 from the new vector. // Extract the elements at 2 * Idx and 2 * Idx + 1 from the new vector.
@ -268,7 +269,9 @@ SDValue DAGTypeLegalizer::ExpandOp_BIT_CONVERT(SDNode *N) {
// is no point, and it might create expansion loops). For example, on // is no point, and it might create expansion loops). For example, on
// x86 this turns v1i64 = BIT_CONVERT i64 into v1i64 = BIT_CONVERT v2i32. // x86 this turns v1i64 = BIT_CONVERT i64 into v1i64 = BIT_CONVERT v2i32.
EVT OVT = N->getOperand(0).getValueType(); EVT OVT = N->getOperand(0).getValueType();
EVT NVT = EVT::getVectorVT(*DAG.getContext(), TLI.getTypeToTransformTo(*DAG.getContext(), OVT), 2); EVT NVT = EVT::getVectorVT(*DAG.getContext(),
TLI.getTypeToTransformTo(*DAG.getContext(), OVT),
2);
if (isTypeLegal(NVT)) { if (isTypeLegal(NVT)) {
SDValue Parts[2]; SDValue Parts[2];
@ -312,7 +315,8 @@ SDValue DAGTypeLegalizer::ExpandOp_BUILD_VECTOR(SDNode *N) {
} }
SDValue NewVec = DAG.getNode(ISD::BUILD_VECTOR, dl, SDValue NewVec = DAG.getNode(ISD::BUILD_VECTOR, dl,
EVT::getVectorVT(*DAG.getContext(), NewVT, NewElts.size()), EVT::getVectorVT(*DAG.getContext(),
NewVT, NewElts.size()),
&NewElts[0], NewElts.size()); &NewElts[0], NewElts.size());
// Convert the new vector to the old vector type. // Convert the new vector to the old vector type.
@ -380,7 +384,8 @@ SDValue DAGTypeLegalizer::ExpandOp_NormalStore(SDNode *N, unsigned OpNo) {
DebugLoc dl = N->getDebugLoc(); DebugLoc dl = N->getDebugLoc();
StoreSDNode *St = cast<StoreSDNode>(N); StoreSDNode *St = cast<StoreSDNode>(N);
EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), St->getValue().getValueType()); EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(),
St->getValue().getValueType());
SDValue Chain = St->getChain(); SDValue Chain = St->getChain();
SDValue Ptr = St->getBasePtr(); SDValue Ptr = St->getBasePtr();
int SVOffset = St->getSrcValueOffset(); int SVOffset = St->getSrcValueOffset();

View File

@ -705,8 +705,9 @@ void DAGTypeLegalizer::SplitVecRes_INSERT_VECTOR_ELT(SDNode *N, SDValue &Lo,
// Store the new element. This may be larger than the vector element type, // Store the new element. This may be larger than the vector element type,
// so use a truncating store. // so use a truncating store.
SDValue EltPtr = GetVectorElementPointer(StackPtr, EltVT, Idx); SDValue EltPtr = GetVectorElementPointer(StackPtr, EltVT, Idx);
const Type *VecType = VecVT.getTypeForEVT(*DAG.getContext());
unsigned Alignment = unsigned Alignment =
TLI.getTargetData()->getPrefTypeAlignment(VecVT.getTypeForEVT(*DAG.getContext())); TLI.getTargetData()->getPrefTypeAlignment(VecType);
Store = DAG.getTruncStore(Store, dl, Elt, EltPtr, NULL, 0, EltVT, Store = DAG.getTruncStore(Store, dl, Elt, EltPtr, NULL, 0, EltVT,
false, false, 0); false, false, 0);
@ -1419,7 +1420,8 @@ SDValue DAGTypeLegalizer::WidenVecRes_Shift(SDNode *N) {
ShOp = GetWidenedVector(ShOp); ShOp = GetWidenedVector(ShOp);
ShVT = ShOp.getValueType(); ShVT = ShOp.getValueType();
} }
EVT ShWidenVT = EVT::getVectorVT(*DAG.getContext(), ShVT.getVectorElementType(), EVT ShWidenVT = EVT::getVectorVT(*DAG.getContext(),
ShVT.getVectorElementType(),
WidenVT.getVectorNumElements()); WidenVT.getVectorNumElements());
if (ShVT != ShWidenVT) if (ShVT != ShWidenVT)
ShOp = ModifyToType(ShOp, ShWidenVT); ShOp = ModifyToType(ShOp, ShWidenVT);
@ -1493,7 +1495,8 @@ SDValue DAGTypeLegalizer::WidenVecRes_BIT_CONVERT(SDNode *N) {
unsigned NewNumElts = WidenSize / InSize; unsigned NewNumElts = WidenSize / InSize;
if (InVT.isVector()) { if (InVT.isVector()) {
EVT InEltVT = InVT.getVectorElementType(); EVT InEltVT = InVT.getVectorElementType();
NewInVT= EVT::getVectorVT(*DAG.getContext(), InEltVT, WidenSize / InEltVT.getSizeInBits()); NewInVT= EVT::getVectorVT(*DAG.getContext(), InEltVT,
WidenSize / InEltVT.getSizeInBits());
} else { } else {
NewInVT = EVT::getVectorVT(*DAG.getContext(), InVT, NewNumElts); NewInVT = EVT::getVectorVT(*DAG.getContext(), InVT, NewNumElts);
} }
@ -1617,7 +1620,8 @@ SDValue DAGTypeLegalizer::WidenVecRes_CONVERT_RNDSAT(SDNode *N) {
SDValue RndOp = N->getOperand(3); SDValue RndOp = N->getOperand(3);
SDValue SatOp = N->getOperand(4); SDValue SatOp = N->getOperand(4);
EVT WidenVT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0)); EVT WidenVT = TLI.getTypeToTransformTo(*DAG.getContext(),
N->getValueType(0));
unsigned WidenNumElts = WidenVT.getVectorNumElements(); unsigned WidenNumElts = WidenVT.getVectorNumElements();
EVT InVT = InOp.getValueType(); EVT InVT = InOp.getValueType();
@ -1791,7 +1795,8 @@ SDValue DAGTypeLegalizer::WidenVecRes_SELECT(SDNode *N) {
EVT CondVT = Cond1.getValueType(); EVT CondVT = Cond1.getValueType();
if (CondVT.isVector()) { if (CondVT.isVector()) {
EVT CondEltVT = CondVT.getVectorElementType(); EVT CondEltVT = CondVT.getVectorElementType();
EVT CondWidenVT = EVT::getVectorVT(*DAG.getContext(), CondEltVT, WidenNumElts); EVT CondWidenVT = EVT::getVectorVT(*DAG.getContext(),
CondEltVT, WidenNumElts);
if (getTypeAction(CondVT) == WidenVector) if (getTypeAction(CondVT) == WidenVector)
Cond1 = GetWidenedVector(Cond1); Cond1 = GetWidenedVector(Cond1);
@ -1859,7 +1864,8 @@ SDValue DAGTypeLegalizer::WidenVecRes_VSETCC(SDNode *N) {
SDValue InOp1 = N->getOperand(0); SDValue InOp1 = N->getOperand(0);
EVT InVT = InOp1.getValueType(); EVT InVT = InOp1.getValueType();
assert(InVT.isVector() && "can not widen non vector type"); assert(InVT.isVector() && "can not widen non vector type");
EVT WidenInVT = EVT::getVectorVT(*DAG.getContext(), InVT.getVectorElementType(), WidenNumElts); EVT WidenInVT = EVT::getVectorVT(*DAG.getContext(),
InVT.getVectorElementType(), WidenNumElts);
InOp1 = GetWidenedVector(InOp1); InOp1 = GetWidenedVector(InOp1);
SDValue InOp2 = GetWidenedVector(N->getOperand(1)); SDValue InOp2 = GetWidenedVector(N->getOperand(1));
@ -2124,7 +2130,7 @@ SDValue DAGTypeLegalizer::GenWidenVectorLoads(SmallVector<SDValue, 16>& LdChain,
// The routines chops the vector into the largest vector loads with the same // The routines chops the vector into the largest vector loads with the same
// element type or scalar loads and then recombines it to the widen vector // element type or scalar loads and then recombines it to the widen vector
// type. // type.
EVT WidenVT = TLI.getTypeToTransformTo(*DAG.getContext(), LD->getValueType(0)); EVT WidenVT = TLI.getTypeToTransformTo(*DAG.getContext(),LD->getValueType(0));
unsigned WidenWidth = WidenVT.getSizeInBits(); unsigned WidenWidth = WidenVT.getSizeInBits();
EVT LdVT = LD->getMemoryVT(); EVT LdVT = LD->getMemoryVT();
DebugLoc dl = LD->getDebugLoc(); DebugLoc dl = LD->getDebugLoc();