Lines Matching defs:IB

36 void IRMutationStrategy::mutate(Module &M, RandomIRBuilder &IB) {
37 auto RS = makeSampler<Function *>(IB.Rand);
42 while (RS.totalWeight() < IB.MinFunctionNum) {
43 Function *F = IB.createFunctionDefinition(M);
46 mutate(*RS.getSelection(), IB);
49 void IRMutationStrategy::mutate(Function &F, RandomIRBuilder &IB) {
53 mutate(*makeSampler(IB.Rand, Range).getSelection(), IB);
56 void IRMutationStrategy::mutate(BasicBlock &BB, RandomIRBuilder &IB) {
57 mutate(*makeSampler(IB.Rand, make_pointer_range(BB)).getSelection(), IB);
68 RandomIRBuilder IB(Seed, Types);
71 auto RS = makeSampler<IRMutationStrategy *>(IB.Rand);
79 Strategy->mutate(M, IB);
91 void InjectorIRStrategy::mutate(Function &F, RandomIRBuilder &IB) {
92 IRMutationStrategy::mutate(F, IB);
108 InjectorIRStrategy::chooseOperation(Value *Src, RandomIRBuilder &IB) {
112 auto RS = makeSampler(IB.Rand, make_filter_range(Operations, OpMatchesPred));
124 void InjectorIRStrategy::mutate(BasicBlock &BB, RandomIRBuilder &IB) {
132 size_t IP = uniform<size_t>(IB.Rand, 0, Insts.size() - 1);
139 Srcs.push_back(IB.findOrCreateSource(BB, InstsBefore));
143 auto OpDesc = chooseOperation(Srcs[0], IB);
149 Srcs.push_back(IB.findOrCreateSource(BB, InstsBefore, Srcs, Pred));
153 IB.connectToSink(BB, InstsAfter, Op);
174 void InstDeleterIRStrategy::mutate(Function &F, RandomIRBuilder &IB) {
175 auto RS = makeSampler<Instruction *>(IB.Rand);
188 mutate(*RS.getSelection(), IB);
193 void InstDeleterIRStrategy::mutate(Instruction &Inst, RandomIRBuilder &IB) {
206 auto RS = makeSampler<Value *>(IB.Rand);
216 RS.sample(IB.newSource(*BB, InstsBefore, {}, Pred), /*Weight=*/1);
223 RandomIRBuilder &IB) {
343 auto RS = makeSampler(IB.Rand, Modifications);
351 uint64_t MaxValue, RandomIRBuilder &IB) {
354 tmp = uniform<uint64_t>(IB.Rand, 0, MaxValue);
360 void InsertFunctionStrategy::mutate(BasicBlock &BB, RandomIRBuilder &IB) {
368 auto RS = makeSampler(IB.Rand, Functions);
379 F = IB.createFunctionDeclaration(*M);
405 uint64_t IP = uniform<uint64_t>(IB.Rand, 0, Insts.size() - 1);
414 Srcs.push_back(IB.findOrCreateSource(BB, InstsBefore, Srcs, Pred));
419 IB.connectToSink(BB, InstsAfter, Op);
423 void InsertCFGStrategy::mutate(BasicBlock &BB, RandomIRBuilder &IB) {
431 uint64_t IP = uniform<uint64_t>(IB.Rand, 0, Insts.size() - 1);
444 if (uniform<uint64_t>(IB.Rand, 0, 1)) {
449 IB.findOrCreateSource(*Source, InstsBeforeSplit, {},
455 connectBlocksToSink({IfTrue, IfFalse}, Sink, IB);
460 makeSampler(IB.Rand, make_filter_range(IB.KnownTypes, [](Type *Ty) {
472 Value *Cond = IB.findOrCreateSource(*Source, InstsBeforeSplit, {},
475 uint64_t NumCases = uniform<uint64_t>(IB.Rand, 1, MaxNumCases);
485 uint64_t CaseVal = getUniqueCaseValue(CasesTaken, MaxCaseVal, IB);
493 connectBlocksToSink(Blocks, Sink, IB);
501 RandomIRBuilder &IB) {
502 uint64_t DirectSinkIdx = uniform<uint64_t>(IB.Rand, 0, Blocks.size() - 1);
508 IB.Rand, 0, CFGToSink::EndOfCFGToLink - 1));
518 IB.findOrCreateSource(*BB, {}, {}, fuzzerop::onlyType(RetTy));
529 uint64_t coin = uniform<uint64_t>(IB.Rand, 0, 1);
530 Value *Cond = IB.findOrCreateSource(
541 void InsertPHIStrategy::mutate(BasicBlock &BB, RandomIRBuilder &IB) {
545 Type *Ty = IB.randomType();
557 // There is no need to inform IB what previously used values are if we are
559 Src = IB.findOrCreateSource(*Pred, Insts, {}, fuzzerop::onlyType(Ty));
567 IB.connectToSink(BB, InstsAfter, PHI);
570 void SinkInstructionStrategy::mutate(Function &F, RandomIRBuilder &IB) {
572 this->mutate(BB, IB);
575 void SinkInstructionStrategy::mutate(BasicBlock &BB, RandomIRBuilder &IB) {
582 uint64_t Idx = uniform<uint64_t>(IB.Rand, 0, Insts.size() - 1);
590 IB.connectToSink(BB, InstsAfter, Inst);
593 void ShuffleBlockStrategy::mutate(BasicBlock &BB, RandomIRBuilder &IB) {
642 auto RS = makeSampler<size_t>(IB.Rand);