14#ifndef LLVM_FUZZMUTATE_OPDESCRIPTOR_H
15#define LLVM_FUZZMUTATE_OPDESCRIPTOR_H
50 using MakeT = std::function<std::vector<Constant *>(
63 std::vector<Constant *> Result;
64 for (
Type *
T : BaseTypes) {
77 return Pred(Cur, New);
83 return Make(Cur, BaseTypes);
96 return V->getType() == Only;
106 return !V->getType()->isVoidTy();
108 auto Make = std::nullopt;
114 return V->getType()->isIntegerTy();
116 auto Make = std::nullopt;
122 return V->getType()->isFloatingPointTy();
124 auto Make = std::nullopt;
130 return V->getType()->isPointerTy() && !V->isSwiftError();
133 std::vector<Constant *> Result;
144 if (V->isSwiftError())
147 if (
const auto *PtrT = dyn_cast<PointerType>(V->getType()))
148 return PtrT->isOpaque() ||
149 PtrT->getNonOpaquePointerElementType()->isSized();
153 std::vector<Constant *> Result;
167 if (isa<ArrayType>(V->getType()))
168 return V->getType()->getArrayNumElements() > 0;
171 if (isa<StructType>(V->getType()))
172 return V->getType()->getStructNumElements() > 0;
174 return V->getType()->isAggregateType();
178 auto Find = std::nullopt;
184 return V->getType()->isVectorTy();
189 auto Make = std::nullopt;
197 return V->getType() == Cur[0]->getType();
210 return V->getType() == Cur[0]->getType()->getScalarType();
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static const T * Find(StringRef S, ArrayRef< T > A)
Find KV in array using binary search.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallVector class.
static SymbolRef::Type getType(const Symbol *Sym)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
bool empty() const
empty - Check if the array is empty.
This is an important base class in LLVM.
static PointerType * getUnqual(Type *ElementType)
This constructs a pointer to an object of the specified type in the default address space (address sp...
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.
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
LLVM Value Representation.
A matcher/generator for finding suitable values for the next source in an operation's partially compl...
bool matches(ArrayRef< Value * > Cur, const Value *New)
Returns true if New is compatible for the argument after Cur.
std::function< std::vector< Constant * >(ArrayRef< Value * > Cur, ArrayRef< Type * > BaseTypes)> MakeT
Given a list of already selected operands and a set of valid base types for a fuzzer,...
SourcePred(PredT Pred, MakeT Make)
Create a fully general source predicate.
SourcePred(PredT Pred, std::nullopt_t)
std::vector< Constant * > generate(ArrayRef< Value * > Cur, ArrayRef< Type * > BaseTypes)
Generates a list of potential values for the argument after Cur.
std::function< bool(ArrayRef< Value * > Cur, const Value *New)> PredT
Given a list of already selected operands, returns whether a given new operand is suitable for the ne...
static SourcePred sizedPtrType()
void makeConstantsWithType(Type *T, std::vector< Constant * > &Cs)
static SourcePred anyAggregateType()
static SourcePred anyIntType()
static SourcePred matchScalarOfFirstType()
Match values that have the first source's scalar type.
static SourcePred onlyType(Type *Only)
static SourcePred anyVectorType()
static SourcePred anyFloatType()
static SourcePred matchFirstType()
Match values that have the same type as the first source.
static SourcePred anyPtrType()
static SourcePred anyType()
This is an optimization pass for GlobalISel generic memory operations.
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
A description of some operation we can build while fuzzing IR.
SmallVector< SourcePred, 2 > SourcePreds
std::function< Value *(ArrayRef< Value * >, Instruction *)> BuilderFunc