Lines Matching +full:push +full:- +full:ci +full:- +full:container
1 //=== unittests/CodeGen/IRMatchers.h - Match on the LLVM IR -----*- C++ -*-===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
31 //===----------------------------------------------------------------------===//
48 /// use queries like "this operand is the same as n-th operand", which are
78 void push(const T *V, unsigned N = ~0) {
97 return MatchStack[MatchStack.size() - 1 - Offset]; in getQuery()
165 bool Result = Next->match(C); in matchEntity()
174 /// same container.
186 if (OpNo < MT->getNumOperands()) in match()
187 return C.top<Metadata>() == MT->getOperand(OpNo).get(); in match()
190 llvm_unreachable("Unknown metadata container"); in match()
194 if (OpNo < Insn->getNumOperands()) in match()
195 return C.top<Value>() == Insn->getOperand(OpNo); in match()
198 llvm_unreachable("Unknown value container"); in match()
200 llvm_unreachable("Unknown type container"); in match()
216 if (const auto *CI = dyn_cast<ConstantInt>(V)) in match() local
217 return (Width == 0 || CI->getBitWidth() == Width) && in match()
218 CI->getLimitedValue() == IntValue; in match()
222 if (const auto *C = dyn_cast<ConstantInt>(MT->getValue())) in match()
223 return (Width == 0 || C->getBitWidth() == Width) && in match()
224 C->getLimitedValue() == IntValue; in match()
240 void push(std::shared_ptr<EntityMatcher<Metadata>> M) { in push() function
244 void push(std::shared_ptr<Matcher> V) { OperandMatchers.push_back(V); } in push() function
246 void push(std::shared_ptr<Matcher> V, Args... A) { in push() function
247 push(V); in push()
248 push(A...); in push()
259 if (OperandMatchers.size() > I->getNumOperands()) in matchEntity()
262 C.push(I->getOperand(N), N); in matchEntity()
263 if (!OperandMatchers[N]->match(C)) { in matchEntity()
271 I->getAllMetadata(MDs); in matchEntity()
274 C.push(Item.second); in matchEntity()
275 if (MetaMatcher->match(C)) { in matchEntity()
299 : TyM(new CondMatcher<Type>([T](const Type &Ty) -> bool { in ValueTypeMatcher()
304 Ctx.push(Ty); in matchEntity()
305 bool Res = TyM->match(Ctx); in matchEntity()
320 return MDS->getString() == Name; in matchEntity()
331 void push(std::shared_ptr<Matcher> M) { Operands.push_back(M); } in push() function
333 void push(std::shared_ptr<Matcher> M, Args... A) { in push() function
334 push(M); in push()
335 push(A...); in push()
339 if (MT->getNumOperands() != Operands.size()) in matchEntity()
341 for (unsigned I = 0, E = MT->getNumOperands(); I != E; ++I) { in matchEntity()
342 const MDOperand &Op = MT->getOperand(I); in matchEntity()
343 C.push(Op.get(), I); in matchEntity()
344 if (!Operands[I]->match(C)) { in matchEntity()
366 Result->push(Args...); in MInstruction()
405 Res->push(Args...); in MMTuple()
419 MC.push(&I); in match()
420 if (M->match(MC)) in match()
437 const BasicBlock *BB = I->getParent(); in matchNext()
440 for (auto P = ++BasicBlock::const_iterator(I), E = BB->end(); P != E; ++P) { in matchNext()
441 MC.push(&*P); in matchNext()
442 if (M->match(MC)) in matchNext()