}
// Currently only support lowering frame address for current frame.
- unsigned Depth = cast<ConstantSDNode>(Op.getOperand(0))->getZExtValue();
- assert((Depth == 0) &&
- "Frame address can only be determined for current frame.");
- if (Depth != 0)
+ if (cast<ConstantSDNode>(Op.getOperand(0))->getZExtValue() != 0) {
+ DAG.getContext()->emitError(
+ "frame address can only be determined for the current frame");
return SDValue();
+ }
MachineFunction &MF = DAG.getMachineFunction();
MF.getFrameInfo().setFrameAddressIsTaken(true);
return SDValue();
// Currently only support lowering return address for current frame.
- unsigned Depth = cast<ConstantSDNode>(Op.getOperand(0))->getZExtValue();
- assert((Depth == 0) &&
- "Return address can only be determined for current frame.");
- if (Depth != 0)
+ if (cast<ConstantSDNode>(Op.getOperand(0))->getZExtValue() != 0) {
+ DAG.getContext()->emitError(
+ "return address can only be determined for the current frame");
return SDValue();
+ }
MachineFunction &MF = DAG.getMachineFunction();
MF.getFrameInfo().setReturnAddressIsTaken(true);
ret ptr %1
}
+define ptr @non_zero_frameaddress() nounwind {
+; CHECK: frame address can only be determined for the current frame
+ %1 = call ptr @llvm.frameaddress(i32 1)
+ ret ptr %1
+}
+
+
+define ptr @non_zero_returnaddress() nounwind {
+; CHECK: return address can only be determined for the current frame
+ %1 = call ptr @llvm.returnaddress(i32 1)
+ ret ptr %1
+}
+