mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-07 14:33:15 +00:00
Small cleanups. No functionality change intended!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58992 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a29c13086a
commit
6959b2bb65
@ -272,6 +272,11 @@ namespace llvm {
|
|||||||
return BitSize >= 8 && !(BitSize & (BitSize - 1));
|
return BitSize >= 8 && !(BitSize & (BitSize - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// bitsEq - Return true if this has the same number of bits as VT.
|
||||||
|
bool bitsEq(MVT VT) const {
|
||||||
|
return getSizeInBits() == VT.getSizeInBits();
|
||||||
|
}
|
||||||
|
|
||||||
/// bitsGT - Return true if this has more bits than VT.
|
/// bitsGT - Return true if this has more bits than VT.
|
||||||
bool bitsGT(MVT VT) const {
|
bool bitsGT(MVT VT) const {
|
||||||
return getSizeInBits() > VT.getSizeInBits();
|
return getSizeInBits() > VT.getSizeInBits();
|
||||||
|
@ -206,7 +206,7 @@ SDValue DAGTypeLegalizer::PromoteIntRes_BIT_CONVERT(SDNode *N) {
|
|||||||
case Legal:
|
case Legal:
|
||||||
break;
|
break;
|
||||||
case PromoteInteger:
|
case PromoteInteger:
|
||||||
if (OutVT.getSizeInBits() == NInVT.getSizeInBits())
|
if (OutVT.bitsEq(NInVT))
|
||||||
// The input promotes to the same size. Convert the promoted value.
|
// The input promotes to the same size. Convert the promoted value.
|
||||||
return DAG.getNode(ISD::BIT_CONVERT, OutVT, GetPromotedInteger(InOp));
|
return DAG.getNode(ISD::BIT_CONVERT, OutVT, GetPromotedInteger(InOp));
|
||||||
break;
|
break;
|
||||||
@ -340,8 +340,8 @@ SDValue DAGTypeLegalizer::PromoteIntRes_EXTRACT_VECTOR_ELT(SDNode *N) {
|
|||||||
// Hi if it was odd.
|
// Hi if it was odd.
|
||||||
SDValue Lo = Elt;
|
SDValue Lo = Elt;
|
||||||
SDValue Hi = DAG.getNode(ISD::SRL, NewVT, Elt,
|
SDValue Hi = DAG.getNode(ISD::SRL, NewVT, Elt,
|
||||||
DAG.getConstant(OldVT.getSizeInBits(),
|
DAG.getConstant(OldVT.getSizeInBits(),
|
||||||
TLI.getShiftAmountTy()));
|
TLI.getShiftAmountTy()));
|
||||||
if (TLI.isBigEndian())
|
if (TLI.isBigEndian())
|
||||||
std::swap(Lo, Hi);
|
std::swap(Lo, Hi);
|
||||||
|
|
||||||
@ -378,8 +378,7 @@ SDValue DAGTypeLegalizer::PromoteIntRes_INT_EXTEND(SDNode *N) {
|
|||||||
|
|
||||||
if (getTypeAction(N->getOperand(0).getValueType()) == PromoteInteger) {
|
if (getTypeAction(N->getOperand(0).getValueType()) == PromoteInteger) {
|
||||||
SDValue Res = GetPromotedInteger(N->getOperand(0));
|
SDValue Res = GetPromotedInteger(N->getOperand(0));
|
||||||
assert(Res.getValueType().getSizeInBits() <= NVT.getSizeInBits() &&
|
assert(Res.getValueType().bitsLE(NVT) && "Extension doesn't make sense!");
|
||||||
"Extension doesn't make sense!");
|
|
||||||
|
|
||||||
// If the result and operand types are the same after promotion, simplify
|
// If the result and operand types are the same after promotion, simplify
|
||||||
// to an in-register extension.
|
// to an in-register extension.
|
||||||
@ -451,8 +450,7 @@ SDValue DAGTypeLegalizer::PromoteIntRes_SETCC(SDNode *N) {
|
|||||||
|
|
||||||
// Convert to the expected type.
|
// Convert to the expected type.
|
||||||
MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0));
|
MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0));
|
||||||
assert(NVT.getSizeInBits() <= SVT.getSizeInBits() &&
|
assert(NVT.bitsLE(SVT) && "Integer type overpromoted?");
|
||||||
"Integer type overpromoted?");
|
|
||||||
return DAG.getNode(ISD::TRUNCATE, NVT, SetCC);
|
return DAG.getNode(ISD::TRUNCATE, NVT, SetCC);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -494,6 +492,7 @@ SDValue DAGTypeLegalizer::PromoteIntRes_SRL(SDNode *N) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SDValue DAGTypeLegalizer::PromoteIntRes_TRUNCATE(SDNode *N) {
|
SDValue DAGTypeLegalizer::PromoteIntRes_TRUNCATE(SDNode *N) {
|
||||||
|
MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0));
|
||||||
SDValue Res;
|
SDValue Res;
|
||||||
|
|
||||||
switch (getTypeAction(N->getOperand(0).getValueType())) {
|
switch (getTypeAction(N->getOperand(0).getValueType())) {
|
||||||
@ -507,12 +506,6 @@ SDValue DAGTypeLegalizer::PromoteIntRes_TRUNCATE(SDNode *N) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0));
|
|
||||||
assert(Res.getValueType().getSizeInBits() >= NVT.getSizeInBits() &&
|
|
||||||
"Truncation doesn't make sense!");
|
|
||||||
if (Res.getValueType() == NVT)
|
|
||||||
return Res;
|
|
||||||
|
|
||||||
// Truncate to NVT instead of VT
|
// Truncate to NVT instead of VT
|
||||||
return DAG.getNode(ISD::TRUNCATE, NVT, Res);
|
return DAG.getNode(ISD::TRUNCATE, NVT, Res);
|
||||||
}
|
}
|
||||||
@ -845,8 +838,7 @@ SDValue DAGTypeLegalizer::PromoteIntOp_SELECT(SDNode *N, unsigned OpNo) {
|
|||||||
// around the problem.
|
// around the problem.
|
||||||
MVT SVT = TLI.getSetCCResultType(N->getOperand(1));
|
MVT SVT = TLI.getSetCCResultType(N->getOperand(1));
|
||||||
assert(isTypeLegal(SVT) && "Illegal SetCC type!");
|
assert(isTypeLegal(SVT) && "Illegal SetCC type!");
|
||||||
assert(Cond.getValueSizeInBits() <= SVT.getSizeInBits() &&
|
assert(Cond.getValueType().bitsLE(SVT) && "Unexpected SetCC type!");
|
||||||
"Unexpected SetCC type!");
|
|
||||||
|
|
||||||
// Make sure the extra bits conform to getSetCCResultContents. There are
|
// Make sure the extra bits conform to getSetCCResultContents. There are
|
||||||
// two sets of extra bits: those in Cond, which come from type promotion,
|
// two sets of extra bits: those in Cond, which come from type promotion,
|
||||||
|
@ -191,7 +191,7 @@ SDValue DAGTypeLegalizer::ScalarizeVecRes_VSETCC(SDNode *N) {
|
|||||||
|
|
||||||
// VSETCC always returns a sign-extended value, while SETCC may not. The
|
// VSETCC always returns a sign-extended value, while SETCC may not. The
|
||||||
// SETCC result type may not match the vector element type. Correct these.
|
// SETCC result type may not match the vector element type. Correct these.
|
||||||
if (NVT.getSizeInBits() <= SVT.getSizeInBits()) {
|
if (NVT.bitsLE(SVT)) {
|
||||||
// The SETCC result type is bigger than the vector element type.
|
// The SETCC result type is bigger than the vector element type.
|
||||||
// Ensure the SETCC result is sign-extended.
|
// Ensure the SETCC result is sign-extended.
|
||||||
if (TLI.getSetCCResultContents() !=
|
if (TLI.getSetCCResultContents() !=
|
||||||
|
Loading…
x
Reference in New Issue
Block a user