1 | //===-- Operations.h - ----------------------------------------*- C++ -*-===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | // |
9 | // Implementations of common fuzzer operation descriptors for building an IR |
10 | // mutator. |
11 | // |
12 | //===----------------------------------------------------------------------===// |
13 | |
14 | #ifndef LLVM_FUZZMUTATE_OPERATIONS_H |
15 | #define LLVM_FUZZMUTATE_OPERATIONS_H |
16 | |
17 | #include "llvm/FuzzMutate/OpDescriptor.h" |
18 | #include "llvm/IR/InstrTypes.h" |
19 | #include "llvm/IR/Instruction.h" |
20 | |
21 | namespace llvm { |
22 | |
23 | /// Getters for the default sets of operations, per general category. |
24 | /// @{ |
25 | void describeFuzzerIntOps(std::vector<fuzzerop::OpDescriptor> &Ops); |
26 | void describeFuzzerFloatOps(std::vector<fuzzerop::OpDescriptor> &Ops); |
27 | void describeFuzzerControlFlowOps(std::vector<fuzzerop::OpDescriptor> &Ops); |
28 | void describeFuzzerPointerOps(std::vector<fuzzerop::OpDescriptor> &Ops); |
29 | void describeFuzzerAggregateOps(std::vector<fuzzerop::OpDescriptor> &Ops); |
30 | void describeFuzzerVectorOps(std::vector<fuzzerop::OpDescriptor> &Ops); |
31 | void describeFuzzerUnaryOperations(std::vector<fuzzerop::OpDescriptor> &Ops); |
32 | void describeFuzzerOtherOps(std::vector<fuzzerop::OpDescriptor> &Ops); |
33 | /// @} |
34 | |
35 | namespace fuzzerop { |
36 | |
37 | /// Descriptors for individual operations. |
38 | /// @{ |
39 | OpDescriptor selectDescriptor(unsigned Weight); |
40 | OpDescriptor fnegDescriptor(unsigned Weight); |
41 | OpDescriptor binOpDescriptor(unsigned Weight, Instruction::BinaryOps Op); |
42 | OpDescriptor cmpOpDescriptor(unsigned Weight, Instruction::OtherOps CmpOp, |
43 | CmpInst::Predicate Pred); |
44 | OpDescriptor splitBlockDescriptor(unsigned Weight); |
45 | OpDescriptor gepDescriptor(unsigned Weight); |
46 | OpDescriptor (unsigned Weight); |
47 | OpDescriptor insertValueDescriptor(unsigned Weight); |
48 | OpDescriptor (unsigned Weight); |
49 | OpDescriptor insertElementDescriptor(unsigned Weight); |
50 | OpDescriptor shuffleVectorDescriptor(unsigned Weight); |
51 | |
52 | /// @} |
53 | |
54 | } // namespace fuzzerop |
55 | |
56 | } // namespace llvm |
57 | |
58 | #endif // LLVM_FUZZMUTATE_OPERATIONS_H |
59 | |