Use less hard coded constants to make the code less brittle.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67846 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2009-03-27 15:45:05 +00:00
parent 76d3838454
commit e4d5d34cfc

View File

@ -1212,8 +1212,9 @@ SDNode *X86DAGToDAGISel::SelectAtomic64(SDNode *Node, unsigned Opc) {
return NULL;
SDValue LSI = Node->getOperand(4); // MemOperand
const SDValue Ops[] = { Tmp0, Tmp1, Tmp2, Tmp3, In2L, In2H, LSI, Chain };
return CurDAG->getTargetNode(Opc, Node->getDebugLoc(),
MVT::i32, MVT::i32, MVT::Other, Ops, 8);
return CurDAG->getTargetNode(Opc, Node->getDebugLoc(),
MVT::i32, MVT::i32, MVT::Other, Ops,
sizeof(Ops)/sizeof(SDValue));
}
SDNode *X86DAGToDAGISel::Select(SDValue N) {
@ -1307,7 +1308,8 @@ SDNode *X86DAGToDAGISel::Select(SDValue N) {
if (foldedLoad) {
SDValue Ops[] = { Tmp0, Tmp1, Tmp2, Tmp3, N1.getOperand(0), InFlag };
SDNode *CNode =
CurDAG->getTargetNode(MOpc, dl, MVT::Other, MVT::Flag, Ops, 6);
CurDAG->getTargetNode(MOpc, dl, MVT::Other, MVT::Flag, Ops,
sizeof(Ops)/sizeof(SDValue));
InFlag = SDValue(CNode, 1);
// Update the chain.
ReplaceUses(N1.getValue(1), SDValue(CNode, 0));
@ -1426,7 +1428,8 @@ SDNode *X86DAGToDAGISel::Select(SDValue N) {
SDValue Ops[] = { Tmp0, Tmp1, Tmp2, Tmp3, N0.getOperand(0) };
Move =
SDValue(CurDAG->getTargetNode(X86::MOVZX16rm8, dl, MVT::i16,
MVT::Other, Ops, 5), 0);
MVT::Other, Ops,
sizeof(Ops)/sizeof(SDValue)), 0);
Chain = Move.getValue(1);
ReplaceUses(N0.getValue(1), Chain);
} else {
@ -1456,7 +1459,8 @@ SDNode *X86DAGToDAGISel::Select(SDValue N) {
if (foldedLoad) {
SDValue Ops[] = { Tmp0, Tmp1, Tmp2, Tmp3, N1.getOperand(0), InFlag };
SDNode *CNode =
CurDAG->getTargetNode(MOpc, dl, MVT::Other, MVT::Flag, Ops, 6);
CurDAG->getTargetNode(MOpc, dl, MVT::Other, MVT::Flag, Ops,
sizeof(Ops)/sizeof(SDValue));
InFlag = SDValue(CNode, 1);
// Update the chain.
ReplaceUses(N1.getValue(1), SDValue(CNode, 0));
@ -1599,7 +1603,8 @@ SDNode *X86DAGToDAGISel::Select(SDValue N) {
TLI.getPointerTy());
SDValue Ops[] = { Tmp1, Tmp2, Chain };
return CurDAG->getTargetNode(TargetInstrInfo::DECLARE, dl,
MVT::Other, Ops, 3);
MVT::Other, Ops,
sizeof(Ops)/sizeof(SDValue));
}
}