14#ifndef LLVM_FUZZMUTATE_OPDESCRIPTOR_H
15#define LLVM_FUZZMUTATE_OPDESCRIPTOR_H
51 using MakeT = std::function<std::vector<Constant *>(
64 std::vector<Constant *> Result;
65 for (
Type *
T : BaseTypes) {
78 return Pred(Cur, New);
84 return Make(Cur, BaseTypes);
97 return V->getType() == Only;
107 return !V->getType()->isVoidTy();
109 auto Make = std::nullopt;
115 return V->getType()->isIntegerTy();
117 auto Make = std::nullopt;
123 return V->getType()->isIntOrIntVectorTy();
125 return {Pred, std::nullopt};
130 return V->getType()->isIntOrIntVectorTy(1);
132 return {Pred, std::nullopt};
137 return V->getType()->isFloatingPointTy();
139 auto Make = std::nullopt;
145 return V->getType()->isFPOrFPVectorTy();
147 return {Pred, std::nullopt};
152 return V->getType()->isPointerTy() && !V->isSwiftError();
155 std::vector<Constant *> Result;
166 if (V->isSwiftError())
169 return V->getType()->isPointerTy();
172 std::vector<Constant *> Result;
188 Type *This = V->getType(), *
First = Cur[0]->getType();
189 VectorType *ThisVec = dyn_cast<VectorType>(This);
191 if (ThisVec && FirstVec) {
194 return (ThisVec ==
nullptr) && (FirstVec ==
nullptr) && (!This->isVoidTy());
198 std::vector<Constant *> Result;
202 EC = VecTy->getElementCount();
205 for (
Type *
T : BaseTypes) {
214 assert(!Result.empty() &&
"No potential constants.");
223 assert((Cur.
size() > 1) &&
"No second source yet");
224 return V->getType() == Cur[1]->getType();
227 assert((Cur.
size() > 1) &&
"No second source yet");
236 if (isa<ArrayType>(V->getType()))
237 return V->getType()->getArrayNumElements() > 0;
240 if (isa<StructType>(V->getType()))
241 return V->getType()->getStructNumElements() > 0;
243 return V->getType()->isAggregateType();
247 auto Find = std::nullopt;
253 return V->getType()->isVectorTy();
258 auto Make = std::nullopt;
266 return V->getType() == Cur[0]->getType();
279 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),...
size_t size() const
size - Get the array size.
bool empty() const
empty - Check if the array is empty.
InstListType::iterator iterator
Instruction iterators...
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.
Base class of all SIMD vector types.
static bool isValidElementType(Type *ElemTy)
Return true if the specified type is valid as a element type.
ElementCount getElementCount() const
Return an ElementCount instance to represent the (possibly scalable) number of elements in the vector...
static VectorType * get(Type *ElementType, ElementCount EC)
This static method is the primary way to construct an VectorType.
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 matchFirstLengthWAnyType()
static SourcePred anyFloatOrVecFloatType()
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 anyIntOrVecIntType()
static SourcePred anyVectorType()
static SourcePred boolOrVecBoolType()
static SourcePred anyFloatType()
static SourcePred matchFirstType()
Match values that have the same type as the first source.
static SourcePred anyPtrType()
static SourcePred anyType()
static SourcePred matchSecondType()
Match values that have the same type as the first source.
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.
@ First
Helpers to iterate all locations in the MemoryEffectsBase class.
A description of some operation we can build while fuzzing IR.
std::function< Value *(ArrayRef< Value * >, BasicBlock::iterator)> BuilderFunc
SmallVector< SourcePred, 2 > SourcePreds