mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-20 20:38:48 +00:00
Teach LegalizeTypes how to expand the operands of
br_cc. This fixes 5 "make check" failures. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47212 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
17bcde9f9b
commit
051bb7b075
@ -238,14 +238,15 @@ private:
|
||||
|
||||
// Operand Expansion.
|
||||
bool ExpandOperand(SDNode *N, unsigned OperandNo);
|
||||
SDOperand ExpandOperand_TRUNCATE(SDNode *N);
|
||||
SDOperand ExpandOperand_BIT_CONVERT(SDNode *N);
|
||||
SDOperand ExpandOperand_UINT_TO_FP(SDOperand Source, MVT::ValueType DestTy);
|
||||
SDOperand ExpandOperand_SINT_TO_FP(SDOperand Source, MVT::ValueType DestTy);
|
||||
SDOperand ExpandOperand_BR_CC(SDNode *N);
|
||||
SDOperand ExpandOperand_EXTRACT_ELEMENT(SDNode *N);
|
||||
SDOperand ExpandOperand_SETCC(SDNode *N);
|
||||
SDOperand ExpandOperand_SINT_TO_FP(SDOperand Source, MVT::ValueType DestTy);
|
||||
SDOperand ExpandOperand_STORE(StoreSDNode *N, unsigned OpNo);
|
||||
|
||||
SDOperand ExpandOperand_TRUNCATE(SDNode *N);
|
||||
SDOperand ExpandOperand_UINT_TO_FP(SDOperand Source, MVT::ValueType DestTy);
|
||||
|
||||
void ExpandSetCCOperands(SDOperand &NewLHS, SDOperand &NewRHS,
|
||||
ISD::CondCode &CCCode);
|
||||
|
||||
|
@ -850,6 +850,8 @@ bool DAGTypeLegalizer::ExpandOperand(SDNode *N, unsigned OpNo) {
|
||||
Res = ExpandOperand_UINT_TO_FP(N->getOperand(0), N->getValueType(0));
|
||||
break;
|
||||
case ISD::EXTRACT_ELEMENT: Res = ExpandOperand_EXTRACT_ELEMENT(N); break;
|
||||
|
||||
case ISD::BR_CC: Res = ExpandOperand_BR_CC(N); break;
|
||||
case ISD::SETCC: Res = ExpandOperand_SETCC(N); break;
|
||||
|
||||
case ISD::STORE:
|
||||
@ -976,6 +978,24 @@ SDOperand DAGTypeLegalizer::ExpandOperand_EXTRACT_ELEMENT(SDNode *N) {
|
||||
return cast<ConstantSDNode>(N->getOperand(1))->getValue() ? Hi : Lo;
|
||||
}
|
||||
|
||||
SDOperand DAGTypeLegalizer::ExpandOperand_BR_CC(SDNode *N) {
|
||||
SDOperand NewLHS = N->getOperand(2), NewRHS = N->getOperand(3);
|
||||
ISD::CondCode CCCode = cast<CondCodeSDNode>(N->getOperand(1))->get();
|
||||
ExpandSetCCOperands(NewLHS, NewRHS, CCCode);
|
||||
|
||||
// If ExpandSetCCOperands returned a scalar, we need to compare the result
|
||||
// against zero to select between true and false values.
|
||||
if (NewRHS.Val == 0) {
|
||||
NewRHS = DAG.getConstant(0, NewLHS.getValueType());
|
||||
CCCode = ISD::SETNE;
|
||||
}
|
||||
|
||||
// Update N to have the operands specified.
|
||||
return DAG.UpdateNodeOperands(SDOperand(N, 0), N->getOperand(0),
|
||||
DAG.getCondCode(CCCode), NewLHS, NewRHS,
|
||||
N->getOperand(4));
|
||||
}
|
||||
|
||||
SDOperand DAGTypeLegalizer::ExpandOperand_SETCC(SDNode *N) {
|
||||
SDOperand NewLHS = N->getOperand(0), NewRHS = N->getOperand(1);
|
||||
ISD::CondCode CCCode = cast<CondCodeSDNode>(N->getOperand(2))->get();
|
||||
|
Loading…
x
Reference in New Issue
Block a user