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