LLVM
15.0.0git
|
#include "llvm/FuzzMutate/RandomIRBuilder.h"
Public Member Functions | |
RandomIRBuilder (int Seed, ArrayRef< Type * > AllowedTypes) | |
Value * | findOrCreateSource (BasicBlock &BB, ArrayRef< Instruction * > Insts) |
Find a "source" for some operation, which will be used in one of the operation's operands. More... | |
Value * | findOrCreateSource (BasicBlock &BB, ArrayRef< Instruction * > Insts, ArrayRef< Value * > Srcs, fuzzerop::SourcePred Pred) |
Find a "source" for some operation, which will be used in one of the operation's operands. More... | |
Value * | newSource (BasicBlock &BB, ArrayRef< Instruction * > Insts, ArrayRef< Value * > Srcs, fuzzerop::SourcePred Pred) |
Create some Value suitable as a source for some operation. More... | |
void | connectToSink (BasicBlock &BB, ArrayRef< Instruction * > Insts, Value *V) |
Find a viable user for V in Insts , which should all be contained in BB . More... | |
void | newSink (BasicBlock &BB, ArrayRef< Instruction * > Insts, Value *V) |
Create a user for V in BB . More... | |
Value * | findPointer (BasicBlock &BB, ArrayRef< Instruction * > Insts, ArrayRef< Value * > Srcs, fuzzerop::SourcePred Pred) |
Type * | chooseType (LLVMContext &Context, ArrayRef< Value * > Srcs, fuzzerop::SourcePred Pred) |
Public Attributes | |
RandomEngine | Rand |
SmallVector< Type *, 16 > | KnownTypes |
Definition at line 32 of file RandomIRBuilder.h.
Definition at line 36 of file RandomIRBuilder.h.
Type* llvm::RandomIRBuilder::chooseType | ( | LLVMContext & | Context, |
ArrayRef< Value * > | Srcs, | ||
fuzzerop::SourcePred | Pred | ||
) |
void RandomIRBuilder::connectToSink | ( | BasicBlock & | BB, |
ArrayRef< Instruction * > | Insts, | ||
Value * | V | ||
) |
Find a viable user for V
in Insts
, which should all be contained in BB
.
This may also create some new instruction in BB
and use that.
Definition at line 98 of file RandomIRBuilder.cpp.
References BB, I, isCompatibleReplacement(), llvm::User::setOperand(), and llvm::cl::Sink.
Referenced by llvm::InjectorIRStrategy::mutate().
Value * RandomIRBuilder::findOrCreateSource | ( | BasicBlock & | BB, |
ArrayRef< Instruction * > | Insts | ||
) |
Find a "source" for some operation, which will be used in one of the operation's operands.
This either selects an instruction in Insts
or returns some new arbitrary Value.
Definition at line 21 of file RandomIRBuilder.cpp.
References llvm::fuzzerop::anyType(), and BB.
Referenced by llvm::InjectorIRStrategy::mutate().
Value * RandomIRBuilder::findOrCreateSource | ( | BasicBlock & | BB, |
ArrayRef< Instruction * > | Insts, | ||
ArrayRef< Value * > | Srcs, | ||
fuzzerop::SourcePred | Pred | ||
) |
Find a "source" for some operation, which will be used in one of the operation's operands.
This either selects an instruction in Insts
that matches Pred
, or returns some new Value that matches Pred
. The values in Srcs
should be source operands that have already been selected.
Definition at line 26 of file RandomIRBuilder.cpp.
References BB, llvm::make_filter_range(), llvm::makeSampler(), and llvm::fuzzerop::SourcePred::matches().
Value * RandomIRBuilder::findPointer | ( | BasicBlock & | BB, |
ArrayRef< Instruction * > | Insts, | ||
ArrayRef< Value * > | Srcs, | ||
fuzzerop::SourcePred | Pred | ||
) |
Definition at line 136 of file RandomIRBuilder.cpp.
References llvm::UndefValue::get(), llvm::Type::getNonOpaquePointerElementType(), llvm::Type::isFirstClassType(), llvm::Type::isSized(), llvm::make_filter_range(), llvm::makeSampler(), and llvm::fuzzerop::SourcePred::matches().
void RandomIRBuilder::newSink | ( | BasicBlock & | BB, |
ArrayRef< Instruction * > | Insts, | ||
Value * | V | ||
) |
Create a user for V
in BB
.
Definition at line 123 of file RandomIRBuilder.cpp.
References llvm::ArrayRef< T >::back(), BB, llvm::PointerType::get(), llvm::UndefValue::get(), llvm::Value::getType(), llvm::fuzzerop::matchFirstType(), and llvm::uniform().
Value * RandomIRBuilder::newSource | ( | BasicBlock & | BB, |
ArrayRef< Instruction * > | Insts, | ||
ArrayRef< Value * > | Srcs, | ||
fuzzerop::SourcePred | Pred | ||
) |
Create some Value suitable as a source for some operation.
Definition at line 41 of file RandomIRBuilder.cpp.
References assert(), BB, llvm::fuzzerop::SourcePred::generate(), llvm::Type::getNonOpaquePointerElementType(), llvm::Value::getType(), I, llvm::Type::isOpaquePointerTy(), and llvm::fuzzerop::SourcePred::matches().
Referenced by llvm::InstDeleterIRStrategy::mutate().
SmallVector<Type *, 16> llvm::RandomIRBuilder::KnownTypes |
Definition at line 34 of file RandomIRBuilder.h.
RandomEngine llvm::RandomIRBuilder::Rand |
Definition at line 33 of file RandomIRBuilder.h.
Referenced by llvm::IRMutationStrategy::mutate(), llvm::InjectorIRStrategy::mutate(), llvm::InstDeleterIRStrategy::mutate(), llvm::InstModificationIRStrategy::mutate(), and llvm::IRMutator::mutateModule().