14 #ifndef LLVM_FUZZMUTATE_OPDESCRIPTOR_H 15 #define LLVM_FUZZMUTATE_OPDESCRIPTOR_H 47 using PredT = std::function<bool(ArrayRef<Value *> Cur,
const Value *New)>;
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);
92 std::function<Value *(ArrayRef<Value *>,
Instruction *)> BuilderFunc;
97 return V->getType() == Only;
107 return !V->getType()->isVoidTy();
115 return V->getType()->isIntegerTy();
123 return V->getType()->isFloatingPointTy();
131 return V->getType()->isPointerTy() && !V->isSwiftError();
134 std::vector<Constant *> Result;
145 if (V->isSwiftError())
148 if (
const auto *PtrT = dyn_cast<PointerType>(V->getType()))
149 return PtrT->getElementType()->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();
184 return V->getType()->isVectorTy();
197 return V->getType() == Cur[0]->getType();
210 return V->getType() == Cur[0]->getType()->getScalarType();
222 #endif // LLVM_FUZZMUTATE_OPDESCRIPTOR_H
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
This class represents lattice values for constants.
bool isSized(SmallPtrSetImpl< Type *> *Visited=nullptr) const
Return true if it makes sense to take the size of this type.
NoneType
A simple null object to allow implicit construction of Optional<T> and similar types without having t...
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, generates a list of constants that could be used for the next operand.
static SourcePred sizedPtrType()
static SourcePred matchFirstType()
Match values that have the same type as the first source.
static const T * Find(StringRef S, ArrayRef< T > A)
Find KV in array using binary search.
static SourcePred anyFloatType()
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
static SourcePred anyType()
static SourcePred anyVectorType()
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...
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important base class in LLVM.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
bool matches(ArrayRef< Value *> Cur, const Value *New)
Returns true if New is compatible for the argument after Cur.
void makeConstantsWithType(Type *T, std::vector< Constant *> &Cs)
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
static wasm::ValType getType(const TargetRegisterClass *RC)
SourcePred(PredT Pred, MakeT Make)
Create a fully general source predicate.
std::vector< Constant * > generate(ArrayRef< Value *> Cur, ArrayRef< Type *> BaseTypes)
Generates a list of potential values for the argument after Cur.
static PointerType * getUnqual(Type *ElementType)
This constructs a pointer to an object of the specified type in the generic address space (address sp...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
static SourcePred onlyType(Type *Only)
A matcher/generator for finding suitable values for the next source in an operation's partially compl...
static SourcePred anyPtrType()
static SourcePred anyAggregateType()
A description of some operation we can build while fuzzing IR.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
static SourcePred matchScalarOfFirstType()
Match values that have the first source's scalar type.
SmallVector< SourcePred, 2 > SourcePreds
SourcePred(PredT Pred, NoneType)
bool empty() const
empty - Check if the array is empty.
static SourcePred anyIntType()