LLVM 22.0.0git
llvm::InjectorIRStrategy Class Reference

Strategy that injects operations into the function. More...

#include "llvm/FuzzMutate/IRMutator.h"

Inheritance diagram for llvm::InjectorIRStrategy:
[legend]

Public Member Functions

 InjectorIRStrategy ()
 InjectorIRStrategy (std::vector< fuzzerop::OpDescriptor > &&Operations)
uint64_t getWeight (size_t CurrentSize, size_t MaxSize, uint64_t CurrentWeight) override
 Provide a weight to bias towards choosing this strategy for a mutation.
void mutate (Function &F, RandomIRBuilder &IB) override
void mutate (BasicBlock &BB, RandomIRBuilder &IB) override
virtual void mutate (Module &M, RandomIRBuilder &IB)
virtual void mutate (Instruction &I, RandomIRBuilder &IB)
Public Member Functions inherited from llvm::IRMutationStrategy
virtual ~IRMutationStrategy ()=default

Static Public Member Functions

static std::vector< fuzzerop::OpDescriptorgetDefaultOps ()

Detailed Description

Strategy that injects operations into the function.

Definition at line 90 of file IRMutator.h.

Constructor & Destructor Documentation

◆ InjectorIRStrategy() [1/2]

llvm::InjectorIRStrategy::InjectorIRStrategy ( )
inline

Definition at line 97 of file IRMutator.h.

References getDefaultOps().

◆ InjectorIRStrategy() [2/2]

llvm::InjectorIRStrategy::InjectorIRStrategy ( std::vector< fuzzerop::OpDescriptor > && Operations)
inline

Definition at line 98 of file IRMutator.h.

References llvm::move().

Member Function Documentation

◆ getDefaultOps()

◆ getWeight()

uint64_t llvm::InjectorIRStrategy::getWeight ( size_t CurrentSize,
size_t MaxSize,
uint64_t CurrentWeight )
inlineoverridevirtual

Provide a weight to bias towards choosing this strategy for a mutation.

The value of the weight is arbitrary, but a good default is "the number of distinct ways in which this strategy can mutate a unit". This can also be used to prefer strategies that shrink the overall size of the result when we start getting close to MaxSize.

Implements llvm::IRMutationStrategy.

Definition at line 102 of file IRMutator.h.

◆ mutate() [1/4]

◆ mutate() [2/4]

void InjectorIRStrategy::mutate ( Function & F,
RandomIRBuilder & IB )
overridevirtual

Reimplemented from llvm::IRMutationStrategy.

Definition at line 93 of file IRMutator.cpp.

References eliminateDeadCode(), F, and llvm::IRMutationStrategy::mutate().

◆ mutate() [3/4]

virtual void llvm::IRMutationStrategy::mutate ( Instruction & I,
RandomIRBuilder & IB )
inlinevirtual

Reimplemented from llvm::IRMutationStrategy.

Definition at line 55 of file IRMutator.h.

◆ mutate() [4/4]

void IRMutationStrategy::mutate ( Module & M,
RandomIRBuilder & IB )
virtual

Mutators for each IR unit. By default these forward to a contained instance of the next smaller unit.

Reimplemented from llvm::IRMutationStrategy.

Definition at line 52 of file IRMutator.cpp.

References F, and Range.


The documentation for this class was generated from the following files: