LLVM  14.0.0git
Public Member Functions | Public Attributes | List of all members
llvm::RandomIRBuilder Struct Reference

#include "llvm/FuzzMutate/RandomIRBuilder.h"

Collaboration diagram for llvm::RandomIRBuilder:
Collaboration graph
[legend]

Public Member Functions

 RandomIRBuilder (int Seed, ArrayRef< Type * > AllowedTypes)
 
ValuefindOrCreateSource (BasicBlock &BB, ArrayRef< Instruction * > Insts)
 Find a "source" for some operation, which will be used in one of the operation's operands. More...
 
ValuefindOrCreateSource (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...
 
ValuenewSource (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...
 
ValuefindPointer (BasicBlock &BB, ArrayRef< Instruction * > Insts, ArrayRef< Value * > Srcs, fuzzerop::SourcePred Pred)
 
TypechooseType (LLVMContext &Context, ArrayRef< Value * > Srcs, fuzzerop::SourcePred Pred)
 

Public Attributes

RandomEngine Rand
 
SmallVector< Type *, 16 > KnownTypes
 

Detailed Description

Definition at line 25 of file RandomIRBuilder.h.

Constructor & Destructor Documentation

◆ RandomIRBuilder()

llvm::RandomIRBuilder::RandomIRBuilder ( int  Seed,
ArrayRef< Type * >  AllowedTypes 
)
inline

Definition at line 29 of file RandomIRBuilder.h.

Member Function Documentation

◆ chooseType()

Type* llvm::RandomIRBuilder::chooseType ( LLVMContext Context,
ArrayRef< Value * >  Srcs,
fuzzerop::SourcePred  Pred 
)

◆ connectToSink()

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 BB, I, isCompatibleReplacement(), llvm::User::setOperand(), and llvm::cl::Sink.

Referenced by llvm::InjectorIRStrategy::mutate().

◆ findOrCreateSource() [1/2]

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().

◆ findOrCreateSource() [2/2]

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().

◆ findPointer()

Value * RandomIRBuilder::findPointer ( BasicBlock BB,
ArrayRef< Instruction * >  Insts,
ArrayRef< Value * >  Srcs,
fuzzerop::SourcePred  Pred 
)

◆ newSink()

void RandomIRBuilder::newSink ( BasicBlock BB,
ArrayRef< Instruction * >  Insts,
Value V 
)

◆ newSource()

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::Value::getType(), I, and llvm::fuzzerop::SourcePred::matches().

Referenced by llvm::InstDeleterIRStrategy::mutate().

Member Data Documentation

◆ KnownTypes

SmallVector<Type *, 16> llvm::RandomIRBuilder::KnownTypes

Definition at line 27 of file RandomIRBuilder.h.

◆ Rand

RandomEngine llvm::RandomIRBuilder::Rand

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