LLVM 24.0.0git
IPOOptions.h
Go to the documentation of this file.
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/IR/Function.h"
13#include "llvm/IR/LLVMContext.h"
14#include "llvm/IR/Module.h"
15#include <optional>
16
17namespace llvm {
18enum class PassSummaryAction;
19
20/// Mechanism to add runtime checking of devirtualization decisions, optionally
21/// trapping or falling back to indirect call on any that are not correct.
22/// Trapping mode is useful for debugging undefined behavior leading to failures
23/// with WPD. Fallback mode is useful for ensuring safety when whole program
24/// visibility may be compromised.
25enum class WPDCheckMode { None, Trap, Fallback };
26} // namespace llvm
27
28#define OPTIONS_STRUCT_DECL
29#include "IPOOptions.inc"
30
31namespace llvm {
32
33inline const IPOOptions &getIPOOptions(const LLVMContext &C) {
34 return C.getLibraryOptions().get<IPOOptions>();
35}
36
37inline const IPOOptions &getIPOOptions(const Function &F) {
38 return getIPOOptions(F.getContext());
39}
40
41inline const IPOOptions &getIPOOptions(const Module &M) {
42 return getIPOOptions(M.getContext());
43}
44
45} // namespace llvm
46
47#endif // LLVM_LIB_TRANSFORMS_IPO_IPOOPTIONS_H
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
Module.h This file contains the declarations for the Module class.
#define F(x, y, z)
Definition MD5.cpp:54
This is an important class for using LLVM in a threaded context.
Definition LLVMContext.h:76
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:68
This is an optimization pass for GlobalISel generic memory operations.
PassSummaryAction
What to do with the summary when running passes that operate on it.
Definition IPO.h:37
const IPOOptions & getIPOOptions(const LLVMContext &C)
Definition IPOOptions.h:33
WPDCheckMode
Mechanism to add runtime checking of devirtualization decisions, optionally trapping or falling back ...
Definition IPOOptions.h:25