LLVM  8.0.1
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. More...
 
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 33 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::InstDeleterIRStrategy, and llvm::InjectorIRStrategy.

◆ mutate() [1/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.

Definition at line 36 of file IRMutator.cpp.

References createEmptyFunction(), llvm::Module::empty(), F(), and llvm::RandomIRBuilder::Rand.

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

◆ mutate() [2/4]

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

◆ mutate() [3/4]

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

◆ mutate() [4/4]

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

Reimplemented in llvm::InstDeleterIRStrategy.

Definition at line 52 of file IRMutator.h.

References llvm_unreachable.


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