16using namespace fuzzerop;
71 std::vector<fuzzerop::OpDescriptor> &Ops) {
80 std::vector<fuzzerop::OpDescriptor> &Ops) {
97 case Instruction::Add:
98 case Instruction::Sub:
99 case Instruction::Mul:
100 case Instruction::SDiv:
101 case Instruction::UDiv:
102 case Instruction::SRem:
103 case Instruction::URem:
104 case Instruction::Shl:
105 case Instruction::LShr:
106 case Instruction::AShr:
107 case Instruction::And:
108 case Instruction::Or:
109 case Instruction::Xor:
111 case Instruction::FAdd:
112 case Instruction::FSub:
113 case Instruction::FMul:
114 case Instruction::FDiv:
115 case Instruction::FRem:
117 case Instruction::BinaryOpsEnd:
131 case Instruction::ICmp:
133 case Instruction::FCmp:
143 BasicBlock *Next = Block->splitBasicBlock(Inst,
"BB");
146 if (Block->isEHPad())
151 if (Block != &Block->getParent()->getEntryBlock()) {
153 Block->getTerminator()->eraseFromParent();
164 return V->getType()->isIntegerTy(1);
167 return {Weight, {isInt1Ty}, buildSplitBlock};
174 Type *Ty = Srcs[0]->getType()->isOpaquePointerTy()
176 : Srcs[0]->getType()->getNonOpaquePointerElementType();
190 assert(
T->isAggregateType() &&
"Not a struct or array");
191 if (isa<StructType>(
T))
192 return T->getStructNumElements();
193 return T->getArrayNumElements();
198 if (
auto *CI = dyn_cast<ConstantInt>(V))
204 std::vector<Constant *> Result;
221 unsigned Idx = cast<ConstantInt>(Srcs[1])->getZExtValue();
230 if (
auto *ArrayT = dyn_cast<ArrayType>(Cur[0]->
getType()))
231 return V->getType() == ArrayT->getElementType();
233 auto *STy = cast<StructType>(Cur[0]->
getType());
234 for (
int I = 0,
E = STy->getNumElements();
I <
E; ++
I)
235 if (STy->getTypeAtIndex(
I) == V->getType())
240 if (
auto *ArrayT = dyn_cast<ArrayType>(Cur[0]->
getType()))
243 std::vector<Constant *> Result;
244 auto *STy = cast<StructType>(Cur[0]->
getType());
245 for (
int I = 0,
E = STy->getNumElements();
I <
E; ++
I)
254 if (
auto *CI = dyn_cast<ConstantInt>(V))
255 if (CI->getBitWidth() == 32) {
258 return Indexed == Cur[1]->getType();
263 std::vector<Constant *> Result;
265 auto *
BaseTy = Cur[0]->getType();
280 unsigned Idx = cast<ConstantInt>(Srcs[2])->getZExtValue();
312 auto *FirstTy = cast<VectorType>(Cur[0]->
getType());
316 return std::vector<Constant *>{
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
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.
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 BranchInst * Create(BasicBlock *IfTrue, Instruction *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 predicate, Value *S1, Value *S2, const Twine &Name="", Instruction *InsertBefore=nullptr)
Construct a compare instruction, given the opcode, the predicate and the two operands.
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 GetElementPtrInst * Create(Type *PointeeType, Value *Ptr, ArrayRef< Value * > IdxList, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
static InsertElementInst * Create(Value *Vec, Value *NewElt, Value *Idx, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
static InsertValueInst * Create(Value *Agg, Value *Val, ArrayRef< unsigned > Idxs, const Twine &NameStr="", Instruction *InsertBefore=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 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.
OpDescriptor extractValueDescriptor(unsigned Weight)
OpDescriptor splitBlockDescriptor(unsigned Weight)
static SourcePred sizedPtrType()
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.
static SourcePred anyVectorType()
static SourcePred anyFloatType()
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)
Descriptors for individual operations.
OpDescriptor gepDescriptor(unsigned Weight)
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 describeFuzzerAggregateOps(std::vector< fuzzerop::OpDescriptor > &Ops)
void describeFuzzerVectorOps(std::vector< fuzzerop::OpDescriptor > &Ops)
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.