From b68b82117ab6777074ab344574ccdc93e7a1b36c Mon Sep 17 00:00:00 2001 From: Artur Pilipenko Date: Fri, 24 Jun 2016 14:47:27 +0000 Subject: NFC. Move verifyIntrinsicIsVarArg from verifier to Intrinsic::matchIntrinsicVarArg since it will be reused for intrinsic remangling code llvm-svn: 273685 --- llvm/lib/IR/Function.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'llvm/lib/IR/Function.cpp') diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp index dbe8125b402..29ed68a2c5e 100644 --- a/llvm/lib/IR/Function.cpp +++ b/llvm/lib/IR/Function.cpp @@ -1060,6 +1060,26 @@ bool Intrinsic::matchIntrinsicType(Type *Ty, ArrayRef llvm_unreachable("unhandled"); } +bool +Intrinsic::matchIntrinsicVarArg(bool isVarArg, + ArrayRef &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 { -- cgit v1.2.3