Operations.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===-- Operations.h - ----------------------------------------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //
  14. // Implementations of common fuzzer operation descriptors for building an IR
  15. // mutator.
  16. //
  17. //===----------------------------------------------------------------------===//
  18. #ifndef LLVM_FUZZMUTATE_OPERATIONS_H
  19. #define LLVM_FUZZMUTATE_OPERATIONS_H
  20. #include "llvm/FuzzMutate/OpDescriptor.h"
  21. #include "llvm/IR/InstrTypes.h"
  22. #include "llvm/IR/Instruction.h"
  23. namespace llvm {
  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. namespace fuzzerop {
  34. /// Descriptors for individual operations.
  35. /// @{
  36. OpDescriptor binOpDescriptor(unsigned Weight, Instruction::BinaryOps Op);
  37. OpDescriptor cmpOpDescriptor(unsigned Weight, Instruction::OtherOps CmpOp,
  38. CmpInst::Predicate Pred);
  39. OpDescriptor splitBlockDescriptor(unsigned Weight);
  40. OpDescriptor gepDescriptor(unsigned Weight);
  41. OpDescriptor extractValueDescriptor(unsigned Weight);
  42. OpDescriptor insertValueDescriptor(unsigned Weight);
  43. OpDescriptor extractElementDescriptor(unsigned Weight);
  44. OpDescriptor insertElementDescriptor(unsigned Weight);
  45. OpDescriptor shuffleVectorDescriptor(unsigned Weight);
  46. /// @}
  47. } // end fuzzerop namespace
  48. } // end llvm namespace
  49. #endif // LLVM_FUZZMUTATE_OPERATIONS_H
  50. #ifdef __GNUC__
  51. #pragma GCC diagnostic pop
  52. #endif