LLVM: include/llvm/FuzzMutate/RandomIRBuilder.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13#ifndef LLVM_FUZZMUTATE_RANDOMIRBUILDER_H

14#define LLVM_FUZZMUTATE_RANDOMIRBUILDER_H

15

19#include

20

21namespace llvm {

31

34}

35

37

41

45

48

49

50

51

52

55

56

57

58 LLVM_ABI std::pair<GlobalVariable *, bool>

69

70

71

74

75

76

77

78

83 bool allowConstant = true);

84

87 bool allowConstant = true);

88

98

99

102

106

112};

113

114}

115

116#endif

static ManagedStatic< cl::opt< uint64_t >, CreateSeed > Seed

This file defines the SmallVector class.

an instruction to allocate memory on the stack

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

LLVM Basic Block Representation.

This is an important class for using LLVM in a threaded context.

A Module instance is used to store all the information related to an LLVM module.

This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.

The instances of the Type class are immutable: once they are created, they are never changed.

LLVM Value Representation.

A matcher/generator for finding suitable values for the next source in an operation's partially compl...

This is an optimization pass for GlobalISel generic memory operations.

std::mt19937 RandomEngine

Definition RandomIRBuilder.h:36

RandomEngine Rand

Definition RandomIRBuilder.h:39

uint64_t MinFunctionNum

Definition RandomIRBuilder.h:44

LLVM_ABI Function * createFunctionDeclaration(Module &M, uint64_t ArgNum)

SmallVector< Type *, 16 > KnownTypes

Definition RandomIRBuilder.h:40

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

Definition RandomIRBuilder.h:46

LLVM_ABI std::pair< GlobalVariable *, bool > findOrCreateGlobalVariable(Module *M, ArrayRef< Value * > Srcs, fuzzerop::SourcePred Pred)

Find or create a global variable.

LLVM_ABI Value * findOrCreateSource(BasicBlock &BB, ArrayRef< Instruction * > Insts)

Find a "source" for some operation, which will be used in one of the operation's operands.

LLVM_ABI AllocaInst * createStackMemory(Function *F, Type *Ty, Value *Init=nullptr)

Create a stack memory at the head of the function, store Init to the memory if provided.

LLVM_ABI Instruction * newSink(BasicBlock &BB, ArrayRef< Instruction * > Insts, Value *V)

Create a user for V in BB.

LLVM_ABI Function * createFunctionDefinition(Module &M, uint64_t ArgNum)

LLVM_ABI Value * newSource(BasicBlock &BB, ArrayRef< Instruction * > Insts, ArrayRef< Value * > Srcs, fuzzerop::SourcePred Pred, bool allowConstant=true)

Create some Value suitable as a source for some operation.

LLVM_ABI Instruction * connectToSink(BasicBlock &BB, ArrayRef< Instruction * > Insts, Value *V)

Find a viable user for V in Insts, which should all be contained in BB.

SinkType

Definition RandomIRBuilder.h:89

@ EndOfValueSink

Definition RandomIRBuilder.h:96

@ NewStore

Definition RandomIRBuilder.h:94

@ PointersInDominator

Definition RandomIRBuilder.h:92

@ SinkToInstInCurBlock

TODO: Also consider pointers in function argument.

Definition RandomIRBuilder.h:91

@ InstInDominatee

Definition RandomIRBuilder.h:93

@ SinkToGlobalVariable

Definition RandomIRBuilder.h:95

uint64_t MaxArgNum

Definition RandomIRBuilder.h:43

LLVM_ABI Value * findPointer(BasicBlock &BB, ArrayRef< Instruction * > Insts)

uint64_t MinArgNum

Definition RandomIRBuilder.h:42

SourceType

Definition RandomIRBuilder.h:61

@ FunctionArgument

Definition RandomIRBuilder.h:63

@ InstInDominator

Definition RandomIRBuilder.h:64

@ NewConstOrStack

Definition RandomIRBuilder.h:66

@ SrcFromInstInCurBlock

Definition RandomIRBuilder.h:62

@ SrcFromGlobalVariable

Definition RandomIRBuilder.h:65

@ EndOfValueSource

Definition RandomIRBuilder.h:67

LLVM_ABI Type * randomType()

Return a uniformly choosen type from AllowedTypes.