1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00

Some code clean up.

llvm-svn: 60850
This commit is contained in:
Evan Cheng 2008-12-10 21:49:05 +00:00
parent 417d88be16
commit 487c9ff802

View File

@ -1532,22 +1532,24 @@ SDNode *X86DAGToDAGISel::Select(SDValue N) {
SDValue Chain = Node->getOperand(0);
SDValue N1 = Node->getOperand(1);
SDValue N2 = Node->getOperand(2);
if (!isa<FrameIndexSDNode>(N1))
FrameIndexSDNode *FINode = dyn_cast<FrameIndexSDNode>(N1);
if (!FINode)
break;
int FI = cast<FrameIndexSDNode>(N1)->getIndex();
if (N2.getOpcode() == ISD::ADD &&
N2.getOperand(0).getOpcode() == X86ISD::GlobalBaseReg)
N2 = N2.getOperand(1);
if (N2.getOpcode() == X86ISD::Wrapper &&
isa<GlobalAddressSDNode>(N2.getOperand(0))) {
GlobalValue *GV =
cast<GlobalAddressSDNode>(N2.getOperand(0))->getGlobal();
SDValue Tmp1 = CurDAG->getTargetFrameIndex(FI, TLI.getPointerTy());
SDValue Tmp2 = CurDAG->getTargetGlobalAddress(GV, TLI.getPointerTy());
SDValue Ops[] = { Tmp1, Tmp2, Chain };
return CurDAG->getTargetNode(TargetInstrInfo::DECLARE,
MVT::Other, Ops, 3);
}
if (N2.getOpcode() != X86ISD::Wrapper)
break;
GlobalAddressSDNode *GVNode = dyn_cast<GlobalAddressSDNode>(N2.getOperand(0));
if (!GVNode)
break;
SDValue Tmp1 = CurDAG->getTargetFrameIndex(FINode->getIndex(),
TLI.getPointerTy());
SDValue Tmp2 = CurDAG->getTargetGlobalAddress(GVNode->getGlobal(),
TLI.getPointerTy());
SDValue Ops[] = { Tmp1, Tmp2, Chain };
return CurDAG->getTargetNode(TargetInstrInfo::DECLARE,
MVT::Other, Ops, 3);
break;
}
}