diff options
author | Artur Pilipenko <apilipenko@azulsystems.com> | 2016-06-24 14:47:27 +0000 |
---|---|---|
committer | Artur Pilipenko <apilipenko@azulsystems.com> | 2016-06-24 14:47:27 +0000 |
commit | b68b82117ab6777074ab344574ccdc93e7a1b36c (patch) | |
tree | 96fb37af9dedd428adf3faf4c8784f97a65508fd /llvm/lib/IR/Function.cpp | |
parent | e705074c397d50e995f73dcc8c75174bbee13673 (diff) | |
download | llvm-b68b82117ab6777074ab344574ccdc93e7a1b36c.zip llvm-b68b82117ab6777074ab344574ccdc93e7a1b36c.tar.gz llvm-b68b82117ab6777074ab344574ccdc93e7a1b36c.tar.bz2 |
NFC. Move verifyIntrinsicIsVarArg from verifier to Intrinsic::matchIntrinsicVarArg since it will be reused for intrinsic remangling code
llvm-svn: 273685
Diffstat (limited to 'llvm/lib/IR/Function.cpp')
-rw-r--r-- | llvm/lib/IR/Function.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp index dbe8125b..29ed68a 100644 --- a/llvm/lib/IR/Function.cpp +++ b/llvm/lib/IR/Function.cpp @@ -1060,6 +1060,26 @@ bool Intrinsic::matchIntrinsicType(Type *Ty, ArrayRef<Intrinsic::IITDescriptor> llvm_unreachable("unhandled"); } +bool +Intrinsic::matchIntrinsicVarArg(bool isVarArg, + ArrayRef<Intrinsic::IITDescriptor> &Infos) { + // If there are no descriptors left, then it can't be a vararg. + if (Infos.empty()) + return isVarArg; + + // There should be only one descriptor remaining at this point. + if (Infos.size() != 1) + return true; + + // Check and verify the descriptor. + IITDescriptor D = Infos.front(); + Infos = Infos.slice(1); + if (D.Kind == IITDescriptor::VarArg) + return !isVarArg; + + return true; +} + /// hasAddressTaken - returns true if there are any uses of this function /// other than direct calls or invokes to it. bool Function::hasAddressTaken(const User* *PutOffender) const { |