1 //===-- Operations.h - ----------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // Implementations of common fuzzer operation descriptors for building an IR
11 // mutator.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_FUZZMUTATE_OPERATIONS_H
16 #define LLVM_FUZZMUTATE_OPERATIONS_H
17 
18 #include "llvm/FuzzMutate/OpDescriptor.h"
19 #include "llvm/IR/InstrTypes.h"
20 #include "llvm/IR/Instruction.h"
21 
22 namespace llvm {
23 
24 /// Getters for the default sets of operations, per general category.
25 /// @{
26 void describeFuzzerIntOps(std::vector<fuzzerop::OpDescriptor> &Ops);
27 void describeFuzzerFloatOps(std::vector<fuzzerop::OpDescriptor> &Ops);
28 void describeFuzzerControlFlowOps(std::vector<fuzzerop::OpDescriptor> &Ops);
29 void describeFuzzerPointerOps(std::vector<fuzzerop::OpDescriptor> &Ops);
30 void describeFuzzerAggregateOps(std::vector<fuzzerop::OpDescriptor> &Ops);
31 void describeFuzzerVectorOps(std::vector<fuzzerop::OpDescriptor> &Ops);
32 /// @}
33 
34 namespace fuzzerop {
35 
36 /// Descriptors for individual operations.
37 /// @{
38 OpDescriptor binOpDescriptor(unsigned Weight, Instruction::BinaryOps Op);
39 OpDescriptor cmpOpDescriptor(unsigned Weight, Instruction::OtherOps CmpOp,
40                              CmpInst::Predicate Pred);
41 OpDescriptor splitBlockDescriptor(unsigned Weight);
42 OpDescriptor gepDescriptor(unsigned Weight);
43 OpDescriptor extractValueDescriptor(unsigned Weight);
44 OpDescriptor insertValueDescriptor(unsigned Weight);
45 OpDescriptor extractElementDescriptor(unsigned Weight);
46 OpDescriptor insertElementDescriptor(unsigned Weight);
47 OpDescriptor shuffleVectorDescriptor(unsigned Weight);
48 /// @}
49 
50 } // end fuzzerop namespace
51 
52 } // end llvm namespace
53 
54 #endif // LLVM_FUZZMUTATE_OPERATIONS_H
55