Refactor function that checks that __builtin_returnaddress's argument is constant.
[oota-llvm.git] / lib / Target / PowerPC / PPCISelLowering.cpp
index 630385cc7c0c564ee46fb1c668f504852233031d..2e87681ab919c09bd947c0e1cfbf7828f6d81c0e 100644 (file)
@@ -7796,11 +7796,8 @@ SDValue PPCTargetLowering::LowerRETURNADDR(SDValue Op,
   MachineFrameInfo *MFI = MF.getFrameInfo();
   MFI->setReturnAddressIsTaken(true);
 
-  if (!isa<ConstantSDNode>(Op.getOperand(0))) {
-    DAG.getContext()->emitError("argument to '__builtin_return_address' must "
-                                "be a constant integer");
+  if (verifyReturnAddressArgumentIsConstant(Op, DAG))
     return SDValue();
-  }
 
   SDLoc dl(Op);
   unsigned Depth = cast<ConstantSDNode>(Op.getOperand(0))->getZExtValue();