Go to the documentation of this file.
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();
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
This class represents lattice values for constants.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
void makeConstantsWithType(Type *T, std::vector< Constant * > &Cs)
The instances of the Type class are immutable: once they are created, they are never changed.
static SourcePred anyFloatType()
static wasm::ValType getType(const TargetRegisterClass *RC)
static SourcePred matchFirstType()
Match values that have the same type as the first source.
bool empty() const
empty - Check if the array is empty.
static SourcePred anyIntType()
std::function< Value *(ArrayRef< Value * >, Instruction *)> BuilderFunc
static SourcePred anyType()
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()
A description of some operation we can build while fuzzing IR.
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
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 generic address space (address sp...
NoneType
A simple null object to allow implicit construction of Optional<T> and similar types without having t...
SourcePred(PredT Pred, MakeT Make)
Create a fully general source predicate.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
print Print MemDeps of function
static const T * Find(StringRef S, ArrayRef< T > A)
Find KV in array using binary search.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
SmallVector< SourcePred, 2 > SourcePreds
bool matches(ArrayRef< Value * > Cur, const Value *New)
Returns true if New is compatible for the argument after Cur.
A matcher/generator for finding suitable values for the next source in an operation's partially compl...
static SourcePred onlyType(Type *Only)
static SourcePred anyPtrType()
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,...
std::vector< Constant * > generate(ArrayRef< Value * > Cur, ArrayRef< Type * > BaseTypes)
Generates a list of potential values for the argument after Cur.
static SourcePred anyAggregateType()
LLVM Value Representation.
static SourcePred anyVectorType()
static SourcePred matchScalarOfFirstType()
Match values that have the first source's scalar type.
SourcePred(PredT Pred, NoneType)