diff options
author | Bill Wendling <isanbard@gmail.com> | 2014-01-06 00:43:20 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2014-01-06 00:43:20 +0000 |
commit | 908bf814e7ffdeaf857bf03b6f3d26bced4e7ea8 (patch) | |
tree | 19cdb6e3cc37c77b2e8b05903780a8d547f72a5b /llvm/lib/CodeGen/SelectionDAG | |
parent | f7fa730e616c3411cb43a4432a8db5c56d4d9668 (diff) | |
download | bcm5719-llvm-908bf814e7ffdeaf857bf03b6f3d26bced4e7ea8.tar.gz bcm5719-llvm-908bf814e7ffdeaf857bf03b6f3d26bced4e7ea8.zip |
Refactor function that checks that __builtin_returnaddress's argument is constant.
This moves the check up into the parent class so that all targets can use it
without having to copy (and keep in sync) the same error message.
llvm-svn: 198579
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp index 82b068d25c8..96bc044602d 100644 --- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -22,6 +22,7 @@ #include "llvm/IR/DataLayout.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/GlobalVariable.h" +#include "llvm/IR/LLVMContext.h" #include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCExpr.h" #include "llvm/Support/CommandLine.h" @@ -2663,3 +2664,14 @@ BuildUDIV(SDNode *N, SelectionDAG &DAG, bool IsAfterLegalization, DAG.getConstant(magics.s-1, getShiftAmountTy(NPQ.getValueType()))); } } + +bool TargetLowering:: +verifyReturnAddressArgumentIsConstant(SDValue Op, SelectionDAG &DAG) const { + if (!isa<ConstantSDNode>(Op.getOperand(0))) { + DAG.getContext()->emitError("argument to '__builtin_return_address' must " + "be a constant integer"); + return true; + } + + return false; +} |