mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-02 07:32:52 +00:00
SelectNodeTo now returns its result, we must pay attention to it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24552 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b19b899181
commit
d5acfb4153
@ -148,8 +148,8 @@ SDOperand AlphaDAGToDAGISel::Select(SDOperand Op) {
|
|||||||
SDOperand CC = Select(N->getOperand(1));
|
SDOperand CC = Select(N->getOperand(1));
|
||||||
MachineBasicBlock *Dest =
|
MachineBasicBlock *Dest =
|
||||||
cast<BasicBlockSDNode>(N->getOperand(2))->getBasicBlock();
|
cast<BasicBlockSDNode>(N->getOperand(2))->getBasicBlock();
|
||||||
CurDAG->SelectNodeTo(N, Alpha::BNE, MVT::Other, CC, CurDAG->getBasicBlock(Dest), Chain);
|
return CurDAG->SelectNodeTo(N, Alpha::BNE, MVT::Other, CC,
|
||||||
return SDOperand(N, 0);
|
CurDAG->getBasicBlock(Dest), Chain);
|
||||||
}
|
}
|
||||||
case ISD::LOAD:
|
case ISD::LOAD:
|
||||||
case ISD::EXTLOAD:
|
case ISD::EXTLOAD:
|
||||||
@ -178,9 +178,9 @@ SDOperand AlphaDAGToDAGISel::Select(SDOperand Op) {
|
|||||||
assert(opcode != ISD::SEXTLOAD && "Not zext"); break;
|
assert(opcode != ISD::SEXTLOAD && "Not zext"); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
CurDAG->SelectNodeTo(N, Opc, N->getValueType(0), MVT::Other,
|
return CurDAG->SelectNodeTo(N, Opc, N->getValueType(0), MVT::Other,
|
||||||
getI64Imm(0), Address, Chain);
|
getI64Imm(0), Address,
|
||||||
return SDOperand(N, Op.ResNo);
|
Chain).getValue(Op.ResNo);
|
||||||
}
|
}
|
||||||
case ISD::STORE:
|
case ISD::STORE:
|
||||||
case ISD::TRUNCSTORE: {
|
case ISD::TRUNCSTORE: {
|
||||||
@ -205,51 +205,44 @@ SDOperand AlphaDAGToDAGISel::Select(SDOperand Op) {
|
|||||||
default: assert(0 && "Bad truncstore!");
|
default: assert(0 && "Bad truncstore!");
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
CurDAG->SelectNodeTo(N, Opc, MVT::Other, Value, getI64Imm(0), Address,
|
return CurDAG->SelectNodeTo(N, Opc, MVT::Other, Value, getI64Imm(0),
|
||||||
Chain);
|
Address, Chain);
|
||||||
return SDOperand(N, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case ISD::BR: {
|
case ISD::BR:
|
||||||
CurDAG->SelectNodeTo(N, Alpha::BR_DAG, MVT::Other, N->getOperand(1),
|
return CurDAG->SelectNodeTo(N, Alpha::BR_DAG, MVT::Other, N->getOperand(1),
|
||||||
Select(N->getOperand(0)));
|
Select(N->getOperand(0)));
|
||||||
return SDOperand(N, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
case ISD::FrameIndex: {
|
case ISD::FrameIndex: {
|
||||||
int FI = cast<FrameIndexSDNode>(N)->getIndex();
|
int FI = cast<FrameIndexSDNode>(N)->getIndex();
|
||||||
CurDAG->SelectNodeTo(N, Alpha::LDA, MVT::i64,
|
return CurDAG->SelectNodeTo(N, Alpha::LDA, MVT::i64,
|
||||||
CurDAG->getTargetFrameIndex(FI, MVT::i32),
|
CurDAG->getTargetFrameIndex(FI, MVT::i32),
|
||||||
getI64Imm(0));
|
getI64Imm(0));
|
||||||
return SDOperand(N, 0);
|
|
||||||
}
|
}
|
||||||
case ISD::ConstantPool: {
|
case ISD::ConstantPool: {
|
||||||
Constant *C = cast<ConstantPoolSDNode>(N)->get();
|
Constant *C = cast<ConstantPoolSDNode>(N)->get();
|
||||||
SDOperand Tmp, CPI = CurDAG->getTargetConstantPool(C, MVT::i64);
|
SDOperand Tmp, CPI = CurDAG->getTargetConstantPool(C, MVT::i64);
|
||||||
Tmp = CurDAG->getTargetNode(Alpha::LDAHr, MVT::i64, CPI, getGlobalBaseReg());
|
Tmp = CurDAG->getTargetNode(Alpha::LDAHr, MVT::i64, CPI, getGlobalBaseReg());
|
||||||
CurDAG->SelectNodeTo(N, Alpha::LDAr, MVT::i64, CPI, Tmp);
|
return CurDAG->SelectNodeTo(N, Alpha::LDAr, MVT::i64, CPI, Tmp);
|
||||||
return SDOperand(N, 0);
|
|
||||||
}
|
}
|
||||||
case ISD::GlobalAddress: {
|
case ISD::GlobalAddress: {
|
||||||
GlobalValue *GV = cast<GlobalAddressSDNode>(N)->getGlobal();
|
GlobalValue *GV = cast<GlobalAddressSDNode>(N)->getGlobal();
|
||||||
SDOperand GA = CurDAG->getTargetGlobalAddress(GV, MVT::i64);
|
SDOperand GA = CurDAG->getTargetGlobalAddress(GV, MVT::i64);
|
||||||
CurDAG->SelectNodeTo(N, Alpha::LDQl, MVT::i64, GA, getGlobalBaseReg());
|
return CurDAG->SelectNodeTo(N, Alpha::LDQl, MVT::i64, GA,
|
||||||
return SDOperand(N, 0);
|
getGlobalBaseReg());
|
||||||
}
|
}
|
||||||
case ISD::ExternalSymbol:
|
case ISD::ExternalSymbol:
|
||||||
CurDAG->SelectNodeTo(N, Alpha::LDQl, MVT::i64,
|
return CurDAG->SelectNodeTo(N, Alpha::LDQl, MVT::i64,
|
||||||
CurDAG->getTargetExternalSymbol(cast<ExternalSymbolSDNode>(N)->getSymbol(), MVT::i64),
|
CurDAG->getTargetExternalSymbol(cast<ExternalSymbolSDNode>(N)->getSymbol(), MVT::i64),
|
||||||
CurDAG->getRegister(AlphaLowering.getVRegGP(), MVT::i64));
|
CurDAG->getRegister(AlphaLowering.getVRegGP(), MVT::i64));
|
||||||
return SDOperand(N, 0);
|
|
||||||
|
|
||||||
case ISD::CALLSEQ_START:
|
case ISD::CALLSEQ_START:
|
||||||
case ISD::CALLSEQ_END: {
|
case ISD::CALLSEQ_END: {
|
||||||
unsigned Amt = cast<ConstantSDNode>(N->getOperand(1))->getValue();
|
unsigned Amt = cast<ConstantSDNode>(N->getOperand(1))->getValue();
|
||||||
unsigned Opc = N->getOpcode() == ISD::CALLSEQ_START ?
|
unsigned Opc = N->getOpcode() == ISD::CALLSEQ_START ?
|
||||||
Alpha::ADJUSTSTACKDOWN : Alpha::ADJUSTSTACKUP;
|
Alpha::ADJUSTSTACKDOWN : Alpha::ADJUSTSTACKUP;
|
||||||
CurDAG->SelectNodeTo(N, Opc, MVT::Other,
|
return CurDAG->SelectNodeTo(N, Opc, MVT::Other,
|
||||||
getI64Imm(Amt), Select(N->getOperand(0)));
|
getI64Imm(Amt), Select(N->getOperand(0)));
|
||||||
return SDOperand(N, 0);
|
|
||||||
}
|
}
|
||||||
case ISD::RET: {
|
case ISD::RET: {
|
||||||
SDOperand Chain = Select(N->getOperand(0)); // Token chain.
|
SDOperand Chain = Select(N->getOperand(0)); // Token chain.
|
||||||
@ -264,8 +257,7 @@ SDOperand AlphaDAGToDAGISel::Select(SDOperand Op) {
|
|||||||
|
|
||||||
// FIXME: add restoring of the RA to R26 to the chain
|
// FIXME: add restoring of the RA to R26 to the chain
|
||||||
// Finally, select this to a ret instruction.
|
// Finally, select this to a ret instruction.
|
||||||
CurDAG->SelectNodeTo(N, Alpha::RETDAG, MVT::Other, Chain);
|
return CurDAG->SelectNodeTo(N, Alpha::RETDAG, MVT::Other, Chain);
|
||||||
return SDOperand(N, 0);
|
|
||||||
}
|
}
|
||||||
case ISD::Constant: {
|
case ISD::Constant: {
|
||||||
int64_t val = (int64_t)cast<ConstantSDNode>(N)->getValue();
|
int64_t val = (int64_t)cast<ConstantSDNode>(N)->getValue();
|
||||||
@ -276,8 +268,7 @@ SDOperand AlphaDAGToDAGISel::Select(SDOperand Op) {
|
|||||||
ConstantUInt::get(Type::getPrimitiveType(Type::ULongTyID) , val);
|
ConstantUInt::get(Type::getPrimitiveType(Type::ULongTyID) , val);
|
||||||
SDOperand Tmp, CPI = CurDAG->getTargetConstantPool(C, MVT::i64);
|
SDOperand Tmp, CPI = CurDAG->getTargetConstantPool(C, MVT::i64);
|
||||||
Tmp = CurDAG->getTargetNode(Alpha::LDAHr, MVT::i64, CPI, getGlobalBaseReg());
|
Tmp = CurDAG->getTargetNode(Alpha::LDAHr, MVT::i64, CPI, getGlobalBaseReg());
|
||||||
CurDAG->SelectNodeTo(N, Alpha::LDAr, MVT::i64, CPI, Tmp);
|
return CurDAG->SelectNodeTo(N, Alpha::LDAr, MVT::i64, CPI, Tmp);
|
||||||
return SDOperand(N, 0);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -286,15 +277,13 @@ SDOperand AlphaDAGToDAGISel::Select(SDOperand Op) {
|
|||||||
bool isDouble = N->getValueType(0) == MVT::f64;
|
bool isDouble = N->getValueType(0) == MVT::f64;
|
||||||
MVT::ValueType T = isDouble ? MVT::f64 : MVT::f32;
|
MVT::ValueType T = isDouble ? MVT::f64 : MVT::f32;
|
||||||
if (CN->isExactlyValue(+0.0)) {
|
if (CN->isExactlyValue(+0.0)) {
|
||||||
CurDAG->SelectNodeTo(N, isDouble ? Alpha::CPYST : Alpha::CPYSS, T,
|
return CurDAG->SelectNodeTo(N, isDouble ? Alpha::CPYST : Alpha::CPYSS,
|
||||||
CurDAG->getRegister(Alpha::F31, T),
|
T, CurDAG->getRegister(Alpha::F31, T),
|
||||||
CurDAG->getRegister(Alpha::F31, T));
|
CurDAG->getRegister(Alpha::F31, T));
|
||||||
return SDOperand(N, 0);
|
|
||||||
} else if ( CN->isExactlyValue(-0.0)) {
|
} else if ( CN->isExactlyValue(-0.0)) {
|
||||||
CurDAG->SelectNodeTo(N, isDouble ? Alpha::CPYSNT : Alpha::CPYSNS, T,
|
return CurDAG->SelectNodeTo(N, isDouble ? Alpha::CPYSNT : Alpha::CPYSNS,
|
||||||
CurDAG->getRegister(Alpha::F31, T),
|
T, CurDAG->getRegister(Alpha::F31, T),
|
||||||
CurDAG->getRegister(Alpha::F31, T));
|
CurDAG->getRegister(Alpha::F31, T));
|
||||||
return SDOperand(N, 0);
|
|
||||||
} else {
|
} else {
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user