15 #ifndef LLVM_FUZZMUTATE_OPDESCRIPTOR_H 16 #define LLVM_FUZZMUTATE_OPDESCRIPTOR_H 48 using PredT = std::function<bool(ArrayRef<Value *> Cur,
const Value *New)>;
52 using MakeT = std::function<std::vector<Constant *>(
65 std::vector<Constant *> Result;
66 for (
Type *T : BaseTypes) {
79 return Pred(Cur, New);
85 return Make(Cur, BaseTypes);
93 std::function<Value *(ArrayRef<Value *>,
Instruction *)> BuilderFunc;
98 return V->getType() == Only;
108 return !V->getType()->isVoidTy();
116 return V->getType()->isIntegerTy();
124 return V->getType()->isFloatingPointTy();
132 return V->getType()->isPointerTy() && !V->isSwiftError();
135 std::vector<Constant *> Result;
146 if (V->isSwiftError())
149 if (
const auto *PtrT = dyn_cast<PointerType>(V->getType()))
150 return PtrT->getElementType()->isSized();
154 std::vector<Constant *> Result;
168 if (isa<ArrayType>(V->getType()))
169 return V->getType()->getArrayNumElements() > 0;
172 if (isa<StructType>(V->getType()))
173 return V->getType()->getStructNumElements() > 0;
175 return V->getType()->isAggregateType();
185 return V->getType()->isVectorTy();
198 return V->getType() == Cur[0]->getType();
211 return V->getType() == Cur[0]->getType()->getScalarType();
223 #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 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.
static const SubtargetFeatureKV * Find(StringRef S, ArrayRef< SubtargetFeatureKV > A)
Find KV in array using binary search.
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()