Refactor function that checks that __builtin_returnaddress's argument is constant.
[oota-llvm.git] / lib / Target / Mips / MipsISelLowering.cpp
index 220b1c4a3507766395ec3ca6c4ac934904abd5d6..40d385e46b251e0d92a0f0849488c8c58698fc24 100644 (file)
@@ -1845,11 +1845,8 @@ lowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const {
 
 SDValue MipsTargetLowering::lowerRETURNADDR(SDValue Op,
                                             SelectionDAG &DAG) const {
-  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();
-  }
 
   // check the depth
   assert((cast<ConstantSDNode>(Op.getOperand(0))->getZExtValue() == 0) &&