17 using namespace fuzzerop;
72 std::vector<fuzzerop::OpDescriptor> &Ops) {
81 std::vector<fuzzerop::OpDescriptor> &Ops) {
99 case Instruction::Sub:
100 case Instruction::Mul:
101 case Instruction::SDiv:
102 case Instruction::UDiv:
103 case Instruction::SRem:
104 case Instruction::URem:
105 case Instruction::Shl:
106 case Instruction::LShr:
107 case Instruction::AShr:
108 case Instruction::And:
109 case Instruction::Or:
110 case Instruction::Xor:
112 case Instruction::FAdd:
113 case Instruction::FSub:
114 case Instruction::FMul:
115 case Instruction::FDiv:
116 case Instruction::FRem:
118 case Instruction::BinaryOpsEnd:
132 case Instruction::ICmp:
134 case Instruction::FCmp:
165 return V->getType()->isIntegerTy(1);
168 return {Weight, {isInt1Ty}, buildSplitBlock};
173 Type *Ty = cast<PointerType>(Srcs[0]->getType())->getElementType();
185 if (isa<StructType>(T))
192 if (
auto *CI = dyn_cast<ConstantInt>(V))
198 std::vector<Constant *> Result;
215 unsigned Idx = cast<ConstantInt>(Srcs[1])->getZExtValue();
224 if (
auto *ArrayT = dyn_cast<ArrayType>(Cur[0]->
getType()))
225 return V->getType() == ArrayT->getElementType();
227 auto *STy = cast<StructType>(Cur[0]->getType());
228 for (
int I = 0,
E = STy->getNumElements();
I <
E; ++
I)
229 if (STy->getTypeAtIndex(
I) == V->getType())
234 if (
auto *ArrayT = dyn_cast<ArrayType>(Cur[0]->
getType()))
237 std::vector<Constant *> Result;
238 auto *STy = cast<StructType>(Cur[0]->getType());
239 for (
int I = 0,
E = STy->getNumElements();
I <
E; ++
I)
248 auto *CTy = cast<CompositeType>(Cur[0]->getType());
249 if (
auto *CI = dyn_cast<ConstantInt>(V))
250 if (CI->getBitWidth() == 32 &&
251 CTy->getTypeAtIndex(CI->getZExtValue()) == Cur[1]->
getType())
256 std::vector<Constant *> Result;
258 auto *CTy = cast<CompositeType>(Cur[0]->getType());
260 if (CTy->getTypeAtIndex(
I) == Cur[1]->getType())
270 unsigned Idx = cast<ConstantInt>(Srcs[2])->getZExtValue();
302 auto *FirstTy = cast<VectorType>(Cur[0]->getType());
306 return std::vector<Constant *>{
SymbolTableList< Instruction >::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
This class represents lattice values for constants.
OpDescriptor insertElementDescriptor(unsigned Weight)
static SourcePred matchScalarInAggregate()
static GetElementPtrInst * Create(Type *PointeeType, Value *Ptr, ArrayRef< Value *> IdxList, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
0 1 0 0 True if ordered and less than
This instruction constructs a fixed permutation of two input vectors.
void describeFuzzerControlFlowOps(std::vector< fuzzerop::OpDescriptor > &Ops)
1 1 1 0 True if unordered or not equal
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
OpDescriptor binOpDescriptor(unsigned Weight, Instruction::BinaryOps Op)
Descriptors for individual operations.
1 0 0 1 True if unordered or equal
static InsertElementInst * Create(Value *Vec, Value *NewElt, Value *Idx, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
1 0 0 0 True if unordered: isnan(X) | isnan(Y)
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
uint64_t getArrayNumElements() const
OpDescriptor extractValueDescriptor(unsigned Weight)
static SourcePred validShuffleVectorIndex()
void describeFuzzerVectorOps(std::vector< fuzzerop::OpDescriptor > &Ops)
static SourcePred sizedPtrType()
0 1 0 1 True if ordered and less than or equal
OpDescriptor extractElementDescriptor(unsigned Weight)
static SourcePred matchFirstType()
Match values that have the same type as the first source.
static bool isValidOperands(const Value *V1, const Value *V2, const Value *Mask)
Return true if a shufflevector instruction can be formed with the specified operands.
OpDescriptor shuffleVectorDescriptor(unsigned Weight)
static SourcePred anyFloatType()
static CmpInst * Create(OtherOps Op, Predicate predicate, Value *S1, Value *S2, const Twine &Name="", Instruction *InsertBefore=nullptr)
Construct a compare instruction, given the opcode, the predicate and the two operands.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
static SourcePred anyVectorType()
OpDescriptor splitBlockDescriptor(unsigned Weight)
const BasicBlock & getEntryBlock() const
LLVM Basic Block Representation.
The instances of the Type class are immutable: once they are created, they are never changed...
OpDescriptor gepDescriptor(unsigned Weight)
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file contains the declarations for the subclasses of Constant, which represent the different fla...
void describeFuzzerFloatOps(std::vector< fuzzerop::OpDescriptor > &Ops)
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
0 1 1 1 True if ordered (no nans)
unsigned getStructNumElements() const
void describeFuzzerPointerOps(std::vector< fuzzerop::OpDescriptor > &Ops)
void makeConstantsWithType(Type *T, std::vector< Constant *> &Cs)
1 1 1 1 Always true (always folded)
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
static wasm::ValType getType(const TargetRegisterClass *RC)
1 1 0 1 True if unordered, less than, or equal
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
static SourcePred validInsertValueIndex()
0 0 1 0 True if ordered and greater than
OpDescriptor insertValueDescriptor(unsigned Weight)
1 1 0 0 True if unordered or less than
void describeFuzzerIntOps(std::vector< fuzzerop::OpDescriptor > &Ops)
Getters for the default sets of operations, per general category.
bool isAggregateType() const
Return true if the type is an aggregate type.
static uint64_t getAggregateNumElements(Type *T)
static Constant * get(Type *Ty, uint64_t V, bool isSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
static BranchInst * Create(BasicBlock *IfTrue, Instruction *InsertBefore=nullptr)
A matcher/generator for finding suitable values for the next source in an operation's partially compl...
static SourcePred validExtractValueIndex()
void describeFuzzerAggregateOps(std::vector< fuzzerop::OpDescriptor > &Ops)
OpDescriptor cmpOpDescriptor(unsigned Weight, Instruction::OtherOps CmpOp, CmpInst::Predicate Pred)
static BinaryOperator * Create(BinaryOps Op, Value *S1, Value *S2, const Twine &Name=Twine(), Instruction *InsertBefore=nullptr)
Construct a binary instruction, given the opcode and the two operands.
static SourcePred anyAggregateType()
static IntegerType * getInt32Ty(LLVMContext &C)
unsigned greater or equal
static InsertValueInst * Create(Value *Agg, Value *Val, ArrayRef< unsigned > Idxs, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
const Function * getParent() const
Return the enclosing method, or null if none.
0 1 1 0 True if ordered and operands are unequal
A description of some operation we can build while fuzzing IR.
iterator_range< const_phi_iterator > phis() const
Returns a range that iterates over the phis in the basic block.
BasicBlock * splitBasicBlock(iterator I, const Twine &BBName="")
Split the basic block into two basic blocks at the specified instruction.
1 0 1 0 True if unordered or greater than
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool isEHPad() const
Return true if this basic block is an exception handling block.
0 0 0 1 True if ordered and equal
LLVM Value Representation.
static Value * buildGEP(IRBuilderTy &IRB, Value *BasePtr, SmallVectorImpl< Value *> &Indices, Twine NamePrefix)
Build a GEP out of a base pointer and indices.
1 0 1 1 True if unordered, greater than, or equal
static VectorType * get(Type *ElementType, unsigned NumElements)
This static method is the primary way to construct an VectorType.
static SourcePred matchScalarOfFirstType()
Match values that have the first source's scalar type.
0 0 1 1 True if ordered and greater than or equal
0 0 0 0 Always false (always folded)
static SourcePred anyIntType()