LLVM 20.0.0git
Public Member Functions | List of all members
llvm::InsertFunctionStrategy Class Reference

Strategy that generates new function calls and inserts function signatures to the modules. More...

#include "llvm/FuzzMutate/IRMutator.h"

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

Public Member Functions

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 (BasicBlock &BB, RandomIRBuilder &IB) override
 
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)
 
- Public Member Functions inherited from llvm::IRMutationStrategy
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.
 

Detailed Description

Strategy that generates new function calls and inserts function signatures to the modules.

If any signatures are present in the module it will be called.

Definition at line 137 of file IRMutator.h.

Member Function Documentation

◆ getWeight()

uint64_t llvm::InsertFunctionStrategy::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 139 of file IRMutator.h.

◆ mutate() [1/5]

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

Reimplemented from llvm::IRMutationStrategy.

Definition at line 53 of file IRMutator.cpp.

◆ mutate() [2/5]

void InsertFunctionStrategy::mutate ( BasicBlock BB,
RandomIRBuilder IB 
)
overridevirtual

◆ mutate() [3/5]

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

Reimplemented from llvm::IRMutationStrategy.

Definition at line 52 of file IRMutator.cpp.

◆ mutate() [4/5]

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

Reimplemented from llvm::IRMutationStrategy.

Definition at line 54 of file IRMutator.h.

◆ mutate() [5/5]

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 51 of file IRMutator.cpp.


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