| 1 | //===----------------------------------------------------------------------===// |
| 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 | #ifndef LLVM_LIB_TRANSFORMS_IPO_IPOOPTIONS_H |
| 10 | #define LLVM_LIB_TRANSFORMS_IPO_IPOOPTIONS_H |
| 11 | |
| 12 | #include "llvm/Analysis/ReplayInlineAdvisor.h" |
| 13 | #include "llvm/IR/Function.h" |
| 14 | #include "llvm/IR/LLVMContext.h" |
| 15 | #include "llvm/IR/Module.h" |
| 16 | #include <limits> |
| 17 | #include <optional> |
| 18 | |
| 19 | namespace llvm { |
| 20 | enum class ExpandVariadicsMode; |
| 21 | enum class PassSummaryAction; |
| 22 | |
| 23 | /// Mechanism to add runtime checking of devirtualization decisions, optionally |
| 24 | /// trapping or falling back to indirect call on any that are not correct. |
| 25 | /// Trapping mode is useful for debugging undefined behavior leading to failures |
| 26 | /// with WPD. Fallback mode is useful for ensuring safety when whole program |
| 27 | /// visibility may be compromised. |
| 28 | enum class WPDCheckMode { None, Trap, Fallback }; |
| 29 | } // namespace llvm |
| 30 | |
| 31 | #define OPTIONS_STRUCT_DECL |
| 32 | #include "IPOOptions.inc" |
| 33 | |
| 34 | namespace llvm { |
| 35 | |
| 36 | inline const IPOOptions &getIPOOptions(const LLVMContext &C) { |
| 37 | return C.getLibraryOptions().get<IPOOptions>(); |
| 38 | } |
| 39 | |
| 40 | inline const IPOOptions &getIPOOptions(const Function &F) { |
| 41 | return getIPOOptions(C: F.getContext()); |
| 42 | } |
| 43 | |
| 44 | inline const IPOOptions &getIPOOptions(const Module &M) { |
| 45 | return getIPOOptions(C: M.getContext()); |
| 46 | } |
| 47 | |
| 48 | } // namespace llvm |
| 49 | |
| 50 | #endif // LLVM_LIB_TRANSFORMS_IPO_IPOOPTIONS_H |
| 51 | |