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
21namespace llvm {
22
23/// Getters for the default sets of operations, per general category.
24/// @{
25void describeFuzzerIntOps(std::vector<fuzzerop::OpDescriptor> &Ops);
26void describeFuzzerFloatOps(std::vector<fuzzerop::OpDescriptor> &Ops);
27void describeFuzzerControlFlowOps(std::vector<fuzzerop::OpDescriptor> &Ops);
28void describeFuzzerPointerOps(std::vector<fuzzerop::OpDescriptor> &Ops);
29void describeFuzzerAggregateOps(std::vector<fuzzerop::OpDescriptor> &Ops);
30void describeFuzzerVectorOps(std::vector<fuzzerop::OpDescriptor> &Ops);
31/// @}
32
33namespace fuzzerop {
34
35/// Descriptors for individual operations.
36/// @{
37OpDescriptor binOpDescriptor(unsigned Weight, Instruction::BinaryOps Op);
38OpDescriptor cmpOpDescriptor(unsigned Weight, Instruction::OtherOps CmpOp,
39                             CmpInst::Predicate Pred);
40OpDescriptor splitBlockDescriptor(unsigned Weight);
41OpDescriptor gepDescriptor(unsigned Weight);
42OpDescriptor extractValueDescriptor(unsigned Weight);
43OpDescriptor insertValueDescriptor(unsigned Weight);
44OpDescriptor extractElementDescriptor(unsigned Weight);
45OpDescriptor insertElementDescriptor(unsigned Weight);
46OpDescriptor shuffleVectorDescriptor(unsigned Weight);
47/// @}
48
49} // end fuzzerop namespace
50
51} // end llvm namespace
52
53#endif // LLVM_FUZZMUTATE_OPERATIONS_H
54