LLVM 20.0.0git
Public Member Functions | List of all members
llvm::IRMutationStrategy Class Referenceabstract

Base class for describing how to mutate a module. More...

#include "llvm/FuzzMutate/IRMutator.h"

Inheritance diagram for llvm::IRMutationStrategy:
Inheritance graph
[legend]

Public Member Functions

virtual ~IRMutationStrategy ()=default
 
virtual uint64_t getWeight (size_t CurrentSize, size_t MaxSize, uint64_t CurrentWeight)=0
 Provide a weight to bias towards choosing this strategy for a mutation.
 
virtual void mutate (Module &M, RandomIRBuilder &IB)
 
virtual void mutate (Function &F, RandomIRBuilder &IB)
 
virtual void mutate (BasicBlock &BB, RandomIRBuilder &IB)
 
virtual void mutate (Instruction &I, RandomIRBuilder &IB)
 

Detailed Description

Base class for describing how to mutate a module.

mutation functions for each IR unit forward to the contained unit.

Definition at line 35 of file IRMutator.h.

Constructor & Destructor Documentation

◆ ~IRMutationStrategy()

virtual llvm::IRMutationStrategy::~IRMutationStrategy ( )
virtualdefault

Member Function Documentation

◆ getWeight()

virtual uint64_t llvm::IRMutationStrategy::getWeight ( size_t  CurrentSize,
size_t  MaxSize,
uint64_t  CurrentWeight 
)
pure virtual

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.

Implemented in llvm::InjectorIRStrategy, llvm::InstDeleterIRStrategy, llvm::InstModificationIRStrategy, llvm::InsertFunctionStrategy, llvm::InsertCFGStrategy, llvm::InsertPHIStrategy, llvm::SinkInstructionStrategy, and llvm::ShuffleBlockStrategy.

◆ mutate() [1/4]

void IRMutationStrategy::mutate ( BasicBlock BB,
RandomIRBuilder IB 
)
virtual

◆ mutate() [2/4]

void IRMutationStrategy::mutate ( Function F,
RandomIRBuilder IB 
)
virtual

◆ mutate() [3/4]

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

◆ 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 in llvm::InjectorIRStrategy, llvm::InstDeleterIRStrategy, llvm::InstModificationIRStrategy, and llvm::InsertFunctionStrategy.

Definition at line 36 of file IRMutator.cpp.

References F, and mutate().

Referenced by llvm::InjectorIRStrategy::mutate(), and mutate().


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