16 #ifndef LLVM_FUZZMUTATE_IRMUTATOR_H 17 #define LLVM_FUZZMUTATE_IRMUTATOR_H 29 struct RandomIRBuilder;
43 virtual uint64_t
getWeight(
size_t CurrentSize,
size_t MaxSize,
44 uint64_t CurrentWeight) = 0;
62 std::vector<TypeGetter> AllowedTypes;
63 std::vector<std::unique_ptr<IRMutationStrategy>> Strategies;
67 std::vector<std::unique_ptr<IRMutationStrategy>> &&Strategies)
68 : AllowedTypes(
std::move(AllowedTypes)),
69 Strategies(
std::move(Strategies)) {}
71 void mutateModule(
Module &M,
int Seed,
size_t CurSize,
size_t MaxSize);
76 std::vector<fuzzerop::OpDescriptor> Operations;
83 : Operations(
std::move(Operations)) {}
84 static std::vector<fuzzerop::OpDescriptor> getDefaultOps();
86 uint64_t
getWeight(
size_t CurrentSize,
size_t MaxSize,
87 uint64_t CurrentWeight)
override {
88 return Operations.size();
98 uint64_t
getWeight(
size_t CurrentSize,
size_t MaxSize,
99 uint64_t CurrentWeight)
override;
108 #endif // LLVM_FUZZMUTATE_IRMUTATOR_H This class represents lattice values for constants.
virtual ~IRMutationStrategy()=default
A Module instance is used to store all the information related to an LLVM module. ...
Base class for describing how to mutate a module.
Entry point for configuring and running IR mutations.
IRMutator(std::vector< TypeGetter > &&AllowedTypes, std::vector< std::unique_ptr< IRMutationStrategy >> &&Strategies)
InjectorIRStrategy(std::vector< fuzzerop::OpDescriptor > &&Operations)
LLVM Basic Block Representation.
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.
virtual void mutate(Instruction &I, RandomIRBuilder &IB)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
virtual void mutate(Module &M, RandomIRBuilder &IB)
Strategy that injects operations into the function.
LLVM Value Representation.
static cl::opt< unsigned long long > Seed("rng-seed", cl::value_desc("seed"), cl::Hidden, cl::desc("Seed for the random number generator"), cl::init(0))
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.
std::function< Type *(LLVMContext &)> TypeGetter