LLVM
8.0.1
|
#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 26 of file RandomIRBuilder.h.
Definition at line 30 of file RandomIRBuilder.h.
References chooseType(), connectToSink(), Context, findOrCreateSource(), findPointer(), newSink(), and newSource().
Type* llvm::RandomIRBuilder::chooseType | ( | LLVMContext & | Context, |
ArrayRef< Value *> | Srcs, | ||
fuzzerop::SourcePred | Pred | ||
) |
Referenced by RandomIRBuilder().
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 95 of file RandomIRBuilder.cpp.
References I, isCompatibleReplacement(), llvm::User::setOperand(), and llvm::cl::Sink.
Referenced by llvm::InjectorIRStrategy::mutate(), and RandomIRBuilder().
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 22 of file RandomIRBuilder.cpp.
References llvm::fuzzerop::anyType().
Referenced by llvm::InjectorIRStrategy::mutate(), and RandomIRBuilder().
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 27 of file RandomIRBuilder.cpp.
References 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 133 of file RandomIRBuilder.cpp.
References llvm::UndefValue::get(), llvm::make_filter_range(), llvm::makeSampler(), and llvm::fuzzerop::SourcePred::matches().
Referenced by RandomIRBuilder().
void RandomIRBuilder::newSink | ( | BasicBlock & | BB, |
ArrayRef< Instruction *> | Insts, | ||
Value * | V | ||
) |
Create a user for V
in BB
.
Definition at line 120 of file RandomIRBuilder.cpp.
References llvm::ArrayRef< T >::back(), llvm::PointerType::get(), llvm::UndefValue::get(), llvm::BasicBlock::getFirstInsertionPt(), llvm::Value::getType(), llvm::fuzzerop::matchFirstType(), and llvm::uniform().
Referenced by RandomIRBuilder().
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 42 of file RandomIRBuilder.cpp.
References assert(), llvm::BasicBlock::end(), llvm::fuzzerop::SourcePred::generate(), llvm::BasicBlock::getFirstInsertionPt(), I, and llvm::fuzzerop::SourcePred::matches().
Referenced by llvm::InstDeleterIRStrategy::mutate(), and RandomIRBuilder().
SmallVector<Type *, 16> llvm::RandomIRBuilder::KnownTypes |
Definition at line 28 of file RandomIRBuilder.h.
RandomEngine llvm::RandomIRBuilder::Rand |
Definition at line 27 of file RandomIRBuilder.h.
Referenced by llvm::InjectorIRStrategy::getDefaultOps(), llvm::IRMutationStrategy::mutate(), llvm::InjectorIRStrategy::mutate(), llvm::InstDeleterIRStrategy::mutate(), and llvm::IRMutator::mutateModule().