LLVM 22.0.0git
PassBuilder.h
Go to the documentation of this file.
1/*===-- llvm-c/Transform/PassBuilder.h - PassBuilder for LLVM C ---*- C -*-===*\
2|* *|
3|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
4|* Exceptions. *|
5|* See https://llvm.org/LICENSE.txt for license information. *|
6|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
7|* *|
8|*===----------------------------------------------------------------------===*|
9|* *|
10|* This header contains the LLVM-C interface into the new pass manager *|
11|* *|
12\*===----------------------------------------------------------------------===*/
13
14#ifndef LLVM_C_TRANSFORMS_PASSBUILDER_H
15#define LLVM_C_TRANSFORMS_PASSBUILDER_H
16
17#include "llvm-c/Error.h"
19#include "llvm-c/Types.h"
20#include "llvm-c/Visibility.h"
21
22/**
23 * @defgroup LLVMCCoreNewPM New Pass Manager
24 * @ingroup LLVMCCore
25 *
26 * @{
27 */
28
30
31/**
32 * A set of options passed which are attached to the Pass Manager upon run.
33 *
34 * This corresponds to an llvm::LLVMPassBuilderOptions instance
35 *
36 * The details for how the different properties of this structure are used can
37 * be found in the source for LLVMRunPasses
38 */
39typedef struct LLVMOpaquePassBuilderOptions *LLVMPassBuilderOptionsRef;
40
41/**
42 * Construct and run a set of passes over a module
43 *
44 * This function takes a string with the passes that should be used. The format
45 * of this string is the same as opt's -passes argument for the new pass
46 * manager. Individual passes may be specified, separated by commas. Full
47 * pipelines may also be invoked using `default<O3>` and friends. See opt for
48 * full reference of the Passes format.
49 */
53
54/**
55 * Construct and run a set of passes over a function.
56 *
57 * This function behaves the same as LLVMRunPasses, but operates on a single
58 * function instead of an entire module.
59 */
63
64/**
65 * Create a new set of options for a PassBuilder
66 *
67 * Ownership of the returned instance is given to the client, and they are
68 * responsible for it. The client should call LLVMDisposePassBuilderOptions
69 * to free the pass builder options.
70 */
72
73/**
74 * Toggle adding the VerifierPass for the PassBuilder, ensuring all functions
75 * inside the module is valid.
76 */
77LLVM_C_ABI void
80
81/**
82 * Toggle debug logging when running the PassBuilder
83 */
84LLVM_C_ABI void
86 LLVMBool DebugLogging);
87
88/**
89 * Specify a custom alias analysis pipeline for the PassBuilder to be used
90 * instead of the default one. The string argument is not copied; the caller
91 * is responsible for ensuring it outlives the PassBuilderOptions instance.
92 */
93LLVM_C_ABI void
95 const char *AAPipeline);
96
97LLVM_C_ABI void
99 LLVMBool LoopInterleaving);
100
101LLVM_C_ABI void
103 LLVMBool LoopVectorization);
104
105LLVM_C_ABI void
107 LLVMBool SLPVectorization);
108
109LLVM_C_ABI void
111 LLVMBool LoopUnrolling);
112
114 LLVMPassBuilderOptionsRef Options, LLVMBool ForgetAllSCEVInLoopUnroll);
115
116LLVM_C_ABI void
118 unsigned LicmMssaOptCap);
119
121 LLVMPassBuilderOptionsRef Options, unsigned LicmMssaNoAccForPromotionCap);
122
123LLVM_C_ABI void
125 LLVMBool CallGraphProfile);
126
127LLVM_C_ABI void
129 LLVMBool MergeFunctions);
130
131LLVM_C_ABI void
133 int Threshold);
134
135/**
136 * Dispose of a heap-allocated PassBuilderOptions instance
137 */
138LLVM_C_ABI void
140
141/**
142 * @}
143 */
144
146
147#endif // LLVM_C_TRANSFORMS_PASSBUILDER_H
#define LLVM_C_EXTERN_C_BEGIN
Definition: ExternC.h:35
#define LLVM_C_EXTERN_C_END
Definition: ExternC.h:36
static LVOptions Options
Definition: LVOptions.cpp:25
#define F(x, y, z)
Definition: MD5.cpp:55
Function const char * Passes
bool VerifyEach
#define LLVM_C_ABI
LLVM_C_ABI is the export/visibility macro used to mark symbols declared in llvm-c as exported when bu...
Definition: Visibility.h:40
LLVM_C_ABI void LLVMPassBuilderOptionsSetSLPVectorization(LLVMPassBuilderOptionsRef Options, LLVMBool SLPVectorization)
LLVM_C_ABI void LLVMPassBuilderOptionsSetAAPipeline(LLVMPassBuilderOptionsRef Options, const char *AAPipeline)
Specify a custom alias analysis pipeline for the PassBuilder to be used instead of the default one.
LLVM_C_ABI void LLVMPassBuilderOptionsSetLoopVectorization(LLVMPassBuilderOptionsRef Options, LLVMBool LoopVectorization)
LLVM_C_ABI void LLVMPassBuilderOptionsSetDebugLogging(LLVMPassBuilderOptionsRef Options, LLVMBool DebugLogging)
Toggle debug logging when running the PassBuilder.
LLVM_C_ABI LLVMPassBuilderOptionsRef LLVMCreatePassBuilderOptions(void)
Create a new set of options for a PassBuilder.
LLVM_C_ABI void LLVMDisposePassBuilderOptions(LLVMPassBuilderOptionsRef Options)
Dispose of a heap-allocated PassBuilderOptions instance.
LLVM_C_ABI void LLVMPassBuilderOptionsSetVerifyEach(LLVMPassBuilderOptionsRef Options, LLVMBool VerifyEach)
Toggle adding the VerifierPass for the PassBuilder, ensuring all functions inside the module is valid...
LLVM_C_ABI void LLVMPassBuilderOptionsSetForgetAllSCEVInLoopUnroll(LLVMPassBuilderOptionsRef Options, LLVMBool ForgetAllSCEVInLoopUnroll)
LLVM_C_ABI void LLVMPassBuilderOptionsSetMergeFunctions(LLVMPassBuilderOptionsRef Options, LLVMBool MergeFunctions)
LLVM_C_ABI void LLVMPassBuilderOptionsSetLoopInterleaving(LLVMPassBuilderOptionsRef Options, LLVMBool LoopInterleaving)
LLVM_C_ABI void LLVMPassBuilderOptionsSetLicmMssaOptCap(LLVMPassBuilderOptionsRef Options, unsigned LicmMssaOptCap)
typedefLLVM_C_EXTERN_C_BEGIN struct LLVMOpaquePassBuilderOptions * LLVMPassBuilderOptionsRef
A set of options passed which are attached to the Pass Manager upon run.
Definition: PassBuilder.h:39
LLVM_C_ABI LLVMErrorRef LLVMRunPassesOnFunction(LLVMValueRef F, const char *Passes, LLVMTargetMachineRef TM, LLVMPassBuilderOptionsRef Options)
Construct and run a set of passes over a function.
LLVM_C_ABI void LLVMPassBuilderOptionsSetCallGraphProfile(LLVMPassBuilderOptionsRef Options, LLVMBool CallGraphProfile)
LLVM_C_ABI void LLVMPassBuilderOptionsSetLoopUnrolling(LLVMPassBuilderOptionsRef Options, LLVMBool LoopUnrolling)
LLVM_C_ABI void LLVMPassBuilderOptionsSetLicmMssaNoAccForPromotionCap(LLVMPassBuilderOptionsRef Options, unsigned LicmMssaNoAccForPromotionCap)
LLVM_C_ABI void LLVMPassBuilderOptionsSetInlinerThreshold(LLVMPassBuilderOptionsRef Options, int Threshold)
LLVM_C_ABI LLVMErrorRef LLVMRunPasses(LLVMModuleRef M, const char *Passes, LLVMTargetMachineRef TM, LLVMPassBuilderOptionsRef Options)
Construct and run a set of passes over a module.
struct LLVMOpaqueError * LLVMErrorRef
Opaque reference to an error instance.
Definition: Error.h:34
struct LLVMOpaqueValue * LLVMValueRef
Represents an individual value in LLVM IR.
Definition: Types.h:75
int LLVMBool
Definition: Types.h:28
struct LLVMOpaqueModule * LLVMModuleRef
The top-level container for all other LLVM Intermediate Representation (IR) objects.
Definition: Types.h:61
struct LLVMOpaqueTargetMachine * LLVMTargetMachineRef
Definition: TargetMachine.h:36