simplify code a bit and add a more explanatory assert for cases that

previously would result in 'cannot yet select' errors.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106199 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jim Grosbach 2010-06-17 01:37:00 +00:00
parent f7a503e6bb
commit c73993b678

View File

@ -1857,22 +1857,18 @@ static SDValue LowerMEMBARRIER(SDValue Op, SelectionDAG &DAG,
const ARMSubtarget *Subtarget) { const ARMSubtarget *Subtarget) {
DebugLoc dl = Op.getDebugLoc(); DebugLoc dl = Op.getDebugLoc();
SDValue Op5 = Op.getOperand(5); SDValue Op5 = Op.getOperand(5);
SDValue Res;
unsigned isDeviceBarrier = cast<ConstantSDNode>(Op5)->getZExtValue(); unsigned isDeviceBarrier = cast<ConstantSDNode>(Op5)->getZExtValue();
if (isDeviceBarrier) { // v6 and v7 can both handle barriers directly, but need handled a bit
if (Subtarget->hasV7Ops()) // differently. Thumb1 and pre-v6 ARM mode use a libcall instead and should
Res = DAG.getNode(ARMISD::SYNCBARRIER, dl, MVT::Other, Op.getOperand(0)); // never get here.
else unsigned Opc = isDeviceBarrier ? ARMISD::SYNCBARRIER : ARMISD::MEMBARRIER;
Res = DAG.getNode(ARMISD::SYNCBARRIER, dl, MVT::Other, Op.getOperand(0), if (Subtarget->hasV7Ops())
DAG.getConstant(0, MVT::i32)); return DAG.getNode(Opc, dl, MVT::Other, Op.getOperand(0));
} else { else if (Subtarget->hasV6Ops() && !Subtarget->isThumb1Only())
if (Subtarget->hasV7Ops()) return DAG.getNode(Opc, dl, MVT::Other, Op.getOperand(0),
Res = DAG.getNode(ARMISD::MEMBARRIER, dl, MVT::Other, Op.getOperand(0)); DAG.getConstant(0, MVT::i32));
else assert(0 && "Unexpected ISD::MEMBARRIER encountered. Should be libcall!");
Res = DAG.getNode(ARMISD::MEMBARRIER, dl, MVT::Other, Op.getOperand(0), return SDValue();
DAG.getConstant(0, MVT::i32));
}
return Res;
} }
static SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG) { static SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG) {