16using namespace fuzzerop;
71 std::vector<fuzzerop::OpDescriptor> &Ops) {
76 std::vector<fuzzerop::OpDescriptor> &Ops) {
89 std::vector<fuzzerop::OpDescriptor> &Ops) {
122 case Instruction::Add:
123 case Instruction::Sub:
124 case Instruction::Mul:
125 case Instruction::SDiv:
126 case Instruction::UDiv:
127 case Instruction::SRem:
128 case Instruction::URem:
129 case Instruction::Shl:
130 case Instruction::LShr:
131 case Instruction::AShr:
132 case Instruction::And:
133 case Instruction::Or:
134 case Instruction::Xor:
136 case Instruction::FAdd:
137 case Instruction::FSub:
138 case Instruction::FMul:
139 case Instruction::FDiv:
140 case Instruction::FRem:
142 case Instruction::BinaryOpsEnd:
157 case Instruction::ICmp:
159 case Instruction::FCmp:
173 if (
Block->isEHPad())
178 if (
Block != &
Block->getParent()->getEntryBlock()) {
180 Block->getTerminator()->getIterator());
181 Block->getTerminator()->eraseFromParent();
192 return V->getType()->isIntegerTy(1);
195 return {Weight, {isInt1Ty}, buildSplitBlock};
202 Type *Ty = Srcs[1]->getType();
216 assert(
T->isAggregateType() &&
"Not a struct or array");
217 if (isa<StructType>(
T))
218 return T->getStructNumElements();
219 return T->getArrayNumElements();
224 if (
auto *CI = dyn_cast<ConstantInt>(V))
230 std::vector<Constant *> Result;
234 Result.push_back(ConstantInt::get(Int32Ty, 0));
236 Result.push_back(ConstantInt::get(Int32Ty,
N - 1));
238 Result.push_back(ConstantInt::get(Int32Ty,
N / 2));
248 unsigned Idx = cast<ConstantInt>(Srcs[1])->getZExtValue();
257 if (
auto *ArrayT = dyn_cast<ArrayType>(Cur[0]->
getType()))
258 return V->getType() == ArrayT->getElementType();
260 auto *STy = cast<StructType>(Cur[0]->
getType());
261 for (
int I = 0, E = STy->getNumElements();
I < E; ++
I)
262 if (STy->getTypeAtIndex(
I) == V->getType())
267 if (
auto *ArrayT = dyn_cast<ArrayType>(Cur[0]->
getType()))
270 std::vector<Constant *> Result;
271 auto *STy = cast<StructType>(Cur[0]->
getType());
272 for (
int I = 0, E = STy->getNumElements();
I < E; ++
I)
281 if (
auto *CI = dyn_cast<ConstantInt>(V))
282 if (CI->getBitWidth() == 32) {
285 return Indexed == Cur[1]->getType();
290 std::vector<Constant *> Result;
292 auto *
BaseTy = Cur[0]->getType();
296 Result.push_back(ConstantInt::get(Int32Ty,
I));
307 unsigned Idx = cast<ConstantInt>(Srcs[2])->getZExtValue();
340 auto *FirstTy = cast<VectorType>(Cur[0]->
getType());
344 return std::vector<Constant *>{
345 UndefValue::get(VectorType::get(Int32Ty, FirstTy->getElementCount()))};
This file contains the declarations for the subclasses of Constant, which represent the different fla...
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
static SourcePred validShuffleVectorIndex()
static uint64_t getAggregateNumElements(Type *T)
static SourcePred validExtractValueIndex()
static SourcePred matchScalarInAggregate()
static SourcePred validInsertValueIndex()
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static SymbolRef::Type getType(const Symbol *Sym)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
ArrayRef< T > drop_front(size_t N=1) const
Drop the first N elements of the array.
LLVM Basic Block Representation.
InstListType::iterator iterator
Instruction iterators...
static BinaryOperator * Create(BinaryOps Op, Value *S1, Value *S2, const Twine &Name=Twine(), InsertPosition InsertBefore=nullptr)
Construct a binary instruction, given the opcode and the two operands.
static BranchInst * Create(BasicBlock *IfTrue, InsertPosition InsertBefore=nullptr)
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
@ FCMP_OEQ
0 0 0 1 True if ordered and equal
@ FCMP_TRUE
1 1 1 1 Always true (always folded)
@ ICMP_SLT
signed less than
@ ICMP_SLE
signed less or equal
@ FCMP_OLT
0 1 0 0 True if ordered and less than
@ FCMP_ULE
1 1 0 1 True if unordered, less than, or equal
@ FCMP_OGT
0 0 1 0 True if ordered and greater than
@ FCMP_OGE
0 0 1 1 True if ordered and greater than or equal
@ ICMP_UGE
unsigned greater or equal
@ ICMP_UGT
unsigned greater than
@ ICMP_SGT
signed greater than
@ FCMP_ULT
1 1 0 0 True if unordered or less than
@ FCMP_ONE
0 1 1 0 True if ordered and operands are unequal
@ FCMP_UEQ
1 0 0 1 True if unordered or equal
@ ICMP_ULT
unsigned less than
@ FCMP_UGT
1 0 1 0 True if unordered or greater than
@ FCMP_OLE
0 1 0 1 True if ordered and less than or equal
@ FCMP_ORD
0 1 1 1 True if ordered (no nans)
@ ICMP_SGE
signed greater or equal
@ FCMP_UNE
1 1 1 0 True if unordered or not equal
@ ICMP_ULE
unsigned less or equal
@ FCMP_UGE
1 0 1 1 True if unordered, greater than, or equal
@ FCMP_FALSE
0 0 0 0 Always false (always folded)
@ FCMP_UNO
1 0 0 0 True if unordered: isnan(X) | isnan(Y)
static CmpInst * Create(OtherOps Op, Predicate Pred, Value *S1, Value *S2, const Twine &Name="", InsertPosition InsertBefore=nullptr)
Construct a compare instruction, given the opcode, the predicate and the two operands.
This class represents an Operation in the Expression.
static GetElementPtrInst * Create(Type *PointeeType, Value *Ptr, ArrayRef< Value * > IdxList, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)
static InsertElementInst * Create(Value *Vec, Value *NewElt, Value *Idx, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)
static InsertValueInst * Create(Value *Agg, Value *Val, ArrayRef< unsigned > Idxs, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)
static SelectInst * Create(Value *C, Value *S1, Value *S2, const Twine &NameStr="", InsertPosition InsertBefore=nullptr, Instruction *MDFrom=nullptr)
This instruction constructs a fixed permutation of two input vectors.
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.
The instances of the Type class are immutable: once they are created, they are never changed.
static IntegerType * getInt32Ty(LLVMContext &C)
static UnaryOperator * Create(UnaryOps Op, Value *S, const Twine &Name=Twine(), InsertPosition InsertBefore=nullptr)
Construct a unary instruction, given the opcode and an operand.
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
LLVM Value Representation.
A matcher/generator for finding suitable values for the next source in an operation's partially compl...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
static SourcePred matchFirstLengthWAnyType()
OpDescriptor extractValueDescriptor(unsigned Weight)
OpDescriptor splitBlockDescriptor(unsigned Weight)
static SourcePred anyFloatOrVecFloatType()
static SourcePred sizedPtrType()
OpDescriptor fnegDescriptor(unsigned Weight)
void makeConstantsWithType(Type *T, std::vector< Constant * > &Cs)
OpDescriptor cmpOpDescriptor(unsigned Weight, Instruction::OtherOps CmpOp, CmpInst::Predicate Pred)
static SourcePred anyAggregateType()
OpDescriptor extractElementDescriptor(unsigned Weight)
OpDescriptor insertValueDescriptor(unsigned Weight)
OpDescriptor shuffleVectorDescriptor(unsigned Weight)
static SourcePred anyIntType()
static SourcePred matchScalarOfFirstType()
Match values that have the first source's scalar type.
OpDescriptor selectDescriptor(unsigned Weight)
Descriptors for individual operations.
static SourcePred anyIntOrVecIntType()
static SourcePred anyVectorType()
static SourcePred boolOrVecBoolType()
OpDescriptor insertElementDescriptor(unsigned Weight)
static SourcePred matchFirstType()
Match values that have the same type as the first source.
OpDescriptor binOpDescriptor(unsigned Weight, Instruction::BinaryOps Op)
OpDescriptor gepDescriptor(unsigned Weight)
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 describeFuzzerIntOps(std::vector< fuzzerop::OpDescriptor > &Ops)
Getters for the default sets of operations, per general category.
void describeFuzzerOtherOps(std::vector< fuzzerop::OpDescriptor > &Ops)
void describeFuzzerAggregateOps(std::vector< fuzzerop::OpDescriptor > &Ops)
void describeFuzzerUnaryOperations(std::vector< fuzzerop::OpDescriptor > &Ops)
void describeFuzzerVectorOps(std::vector< fuzzerop::OpDescriptor > &Ops)
DWARFExpression::Operation Op
void describeFuzzerFloatOps(std::vector< fuzzerop::OpDescriptor > &Ops)
void describeFuzzerControlFlowOps(std::vector< fuzzerop::OpDescriptor > &Ops)
void describeFuzzerPointerOps(std::vector< fuzzerop::OpDescriptor > &Ops)
A description of some operation we can build while fuzzing IR.