Go to the documentation of this file.
16 using namespace fuzzerop;
71 std::vector<fuzzerop::OpDescriptor> &Ops) {
80 std::vector<fuzzerop::OpDescriptor> &Ops) {
98 case Instruction::Sub:
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();
158 for (
PHINode &PHI : Block->phis())
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());
@ FCMP_ULE
1 1 0 1 True if unordered, less than, or equal
static SourcePred validShuffleVectorIndex()
This is an optimization pass for GlobalISel generic memory operations.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
static SourcePred validExtractValueIndex()
@ FCMP_ONE
0 1 1 0 True if ordered and operands are unequal
static InsertValueInst * Create(Value *Agg, Value *Val, ArrayRef< unsigned > Idxs, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
void makeConstantsWithType(Type *T, std::vector< Constant * > &Cs)
OpDescriptor gepDescriptor(unsigned Weight)
static InsertElementInst * Create(Value *Vec, Value *NewElt, Value *Idx, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
@ ICMP_SGT
signed greater than
The instances of the Type class are immutable: once they are created, they are never changed.
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.
@ ICMP_SLE
signed less or equal
static SourcePred anyFloatType()
OpDescriptor splitBlockDescriptor(unsigned Weight)
@ FCMP_OGT
0 0 1 0 True if ordered and greater than
static SourcePred matchFirstType()
Match values that have the same type as the first source.
static IntegerType * getInt32Ty(LLVMContext &C)
LLVM Basic Block Representation.
OpDescriptor binOpDescriptor(unsigned Weight, Instruction::BinaryOps Op)
Descriptors for individual operations.
@ FCMP_ULT
1 1 0 0 True if unordered or less than
FunctionType * getType(LLVMContext &Context, ID id, ArrayRef< Type * > Tys=None)
Return the function type for an intrinsic.
static SourcePred anyIntType()
void describeFuzzerPointerOps(std::vector< fuzzerop::OpDescriptor > &Ops)
static SourcePred sizedPtrType()
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
@ ICMP_ULE
unsigned less or equal
@ FCMP_UGE
1 0 1 1 True if unordered, greater than, or equal
A description of some operation we can build while fuzzing IR.
@ FCMP_UNO
1 0 0 0 True if unordered: isnan(X) | isnan(Y)
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
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.
@ FCMP_OEQ
0 0 0 1 True if ordered and equal
@ FCMP_OLT
0 1 0 0 True if ordered and less than
void describeFuzzerIntOps(std::vector< fuzzerop::OpDescriptor > &Ops)
Getters for the default sets of operations, per general category.
static uint64_t getAggregateNumElements(Type *T)
static SourcePred matchScalarInAggregate()
@ FCMP_FALSE
0 0 0 0 Always false (always folded)
static Value * buildGEP(IRBuilderTy &IRB, Value *BasePtr, SmallVectorImpl< Value * > &Indices, const Twine &NamePrefix)
Build a GEP out of a base pointer and indices.
OpDescriptor extractValueDescriptor(unsigned Weight)
static BranchInst * Create(BasicBlock *IfTrue, Instruction *InsertBefore=nullptr)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
OpDescriptor cmpOpDescriptor(unsigned Weight, Instruction::OtherOps CmpOp, CmpInst::Predicate Pred)
@ FCMP_OGE
0 0 1 1 True if ordered and greater than or equal
@ ICMP_UGE
unsigned greater or equal
OpDescriptor insertElementDescriptor(unsigned Weight)
@ ICMP_SLT
signed less than
static GetElementPtrInst * Create(Type *PointeeType, Value *Ptr, ArrayRef< Value * > IdxList, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
@ ICMP_ULT
unsigned less than
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Type * getType() const
All values are typed, get the type of this value.
void describeFuzzerControlFlowOps(std::vector< fuzzerop::OpDescriptor > &Ops)
@ FCMP_UGT
1 0 1 0 True if unordered or greater than
A matcher/generator for finding suitable values for the next source in an operation's partially compl...
@ ICMP_SGE
signed greater or equal
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< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
This instruction constructs a fixed permutation of two input vectors.
void describeFuzzerVectorOps(std::vector< fuzzerop::OpDescriptor > &Ops)
@ ICMP_UGT
unsigned greater than
OpDescriptor shuffleVectorDescriptor(unsigned Weight)
@ FCMP_UNE
1 1 1 0 True if unordered or not equal
@ FCMP_OLE
0 1 0 1 True if ordered and less than or equal
void describeFuzzerFloatOps(std::vector< fuzzerop::OpDescriptor > &Ops)
OpDescriptor extractElementDescriptor(unsigned Weight)
static SourcePred anyAggregateType()
static SourcePred validInsertValueIndex()
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.
@ FCMP_TRUE
1 1 1 1 Always true (always folded)
void describeFuzzerAggregateOps(std::vector< fuzzerop::OpDescriptor > &Ops)
LLVM Value Representation.
So we should use XX3Form_Rcr to implement intrinsic Convert DP outs ins xscvdpsp No builtin are required Round &Convert QP DP(dword[1] is set to zero) No builtin are required Round to Quad Precision because you need to assign rounding mode in instruction Provide builtin(set f128:$vT,(int_ppc_vsx_xsrqpi f128:$vB))(set f128 yields< n x< ty > >< result > yields< ty >< result > No builtin are required Load Store load store see def memrix16 in PPCInstrInfo td Load Store Vector Indexed
static VectorType * get(Type *ElementType, ElementCount EC)
This static method is the primary way to construct an VectorType.
static SourcePred anyVectorType()
static SourcePred matchScalarOfFirstType()
Match values that have the first source's scalar type.
@ FCMP_ORD
0 1 1 1 True if ordered (no nans)
@ FCMP_UEQ
1 0 0 1 True if unordered or equal
OpDescriptor insertValueDescriptor(unsigned Weight)