| 1 | //===-- Passes.h - Target independent code generation passes ----*- C++ -*-===// |
| 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 | // This file defines interfaces to access the target independent code generation |
| 10 | // passes provided by the LLVM backend. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef LLVM_CODEGEN_PASSES_H |
| 15 | #define LLVM_CODEGEN_PASSES_H |
| 16 | |
| 17 | #include "llvm/CodeGen/RegAllocCommon.h" |
| 18 | #include "llvm/Support/CodeGen.h" |
| 19 | #include "llvm/Support/Compiler.h" |
| 20 | #include "llvm/Support/Discriminator.h" |
| 21 | |
| 22 | #include <functional> |
| 23 | #include <string> |
| 24 | |
| 25 | namespace llvm { |
| 26 | |
| 27 | class FunctionPass; |
| 28 | class MachineFunction; |
| 29 | class MachineFunctionPass; |
| 30 | class ModulePass; |
| 31 | class Pass; |
| 32 | class TargetMachine; |
| 33 | class raw_ostream; |
| 34 | |
| 35 | template <typename T> class IntrusiveRefCntPtr; |
| 36 | namespace vfs { |
| 37 | class FileSystem; |
| 38 | } // namespace vfs |
| 39 | |
| 40 | } // namespace llvm |
| 41 | |
| 42 | // List of target independent CodeGen pass IDs. |
| 43 | namespace llvm { |
| 44 | |
| 45 | /// AtomicExpandPass - At IR level this pass replace atomic instructions with |
| 46 | /// __atomic_* library calls, or target specific instruction which implement the |
| 47 | /// same semantics in a way which better fits the target backend. |
| 48 | LLVM_ABI FunctionPass *createAtomicExpandLegacyPass(); |
| 49 | |
| 50 | /// createUnreachableBlockEliminationPass - The LLVM code generator does not |
| 51 | /// work well with unreachable basic blocks (what live ranges make sense for a |
| 52 | /// block that cannot be reached?). As such, a code generator should either |
| 53 | /// not instruction select unreachable blocks, or run this pass as its |
| 54 | /// last LLVM modifying pass to clean up blocks that are not reachable from |
| 55 | /// the entry block. |
| 56 | LLVM_ABI FunctionPass *createUnreachableBlockEliminationPass(); |
| 57 | |
| 58 | /// createGCEmptyBasicblocksPass - Empty basic blocks (basic blocks without |
| 59 | /// real code) appear as the result of optimization passes removing |
| 60 | /// instructions. These blocks confuscate profile analysis (e.g., basic block |
| 61 | /// sections) since they will share the address of their fallthrough blocks. |
| 62 | /// This pass garbage-collects such basic blocks. |
| 63 | LLVM_ABI MachineFunctionPass *createGCEmptyBasicBlocksPass(); |
| 64 | |
| 65 | /// createBasicBlockSections Pass - This pass assigns sections to machine |
| 66 | /// basic blocks and is enabled with -fbasic-block-sections. |
| 67 | LLVM_ABI MachineFunctionPass *createBasicBlockSectionsPass(); |
| 68 | |
| 69 | LLVM_ABI MachineFunctionPass *createBasicBlockPathCloningPass(); |
| 70 | |
| 71 | /// createMachineFunctionSplitterPass - This pass splits machine functions |
| 72 | /// using profile information. |
| 73 | LLVM_ABI MachineFunctionPass *createMachineFunctionSplitterPass(); |
| 74 | |
| 75 | /// createStaticDataSplitterPass - This is a machine-function pass that |
| 76 | /// categorizes static data hotness using profile information. |
| 77 | LLVM_ABI MachineFunctionPass *createStaticDataSplitterPass(); |
| 78 | |
| 79 | /// createStaticDataAnnotatorPASS - This is a module pass that reads from |
| 80 | /// StaticDataProfileInfoWrapperPass and annotates the section prefix of |
| 81 | /// global variables. |
| 82 | LLVM_ABI ModulePass *createStaticDataAnnotatorPass(); |
| 83 | |
| 84 | /// MachineFunctionPrinter pass - This pass prints out the machine function to |
| 85 | /// the given stream as a debugging tool. |
| 86 | LLVM_ABI MachineFunctionPass * |
| 87 | createMachineFunctionPrinterPass(raw_ostream &OS, |
| 88 | const std::string &Banner = "" ); |
| 89 | |
| 90 | /// StackFramePrinter pass - This pass prints out the machine function's |
| 91 | /// stack frame to the given stream as a debugging tool. |
| 92 | LLVM_ABI MachineFunctionPass *createStackFrameLayoutAnalysisPass(); |
| 93 | |
| 94 | /// MIRPrinting pass - this pass prints out the LLVM IR into the given stream |
| 95 | /// using the MIR serialization format. |
| 96 | LLVM_ABI MachineFunctionPass *createPrintMIRPass(raw_ostream &OS); |
| 97 | |
| 98 | /// This pass resets a MachineFunction when it has the FailedISel property |
| 99 | /// as if it was just created. |
| 100 | /// If EmitFallbackDiag is true, the pass will emit a |
| 101 | /// DiagnosticInfoISelFallback for every MachineFunction it resets. |
| 102 | /// If AbortOnFailedISel is true, abort compilation instead of resetting. |
| 103 | LLVM_ABI MachineFunctionPass * |
| 104 | createResetMachineFunctionPass(bool EmitFallbackDiag, bool AbortOnFailedISel); |
| 105 | |
| 106 | /// createCodeGenPrepareLegacyPass - Transform the code to expose more pattern |
| 107 | /// matching during instruction selection. |
| 108 | LLVM_ABI FunctionPass *createCodeGenPrepareLegacyPass(); |
| 109 | |
| 110 | /// This pass implements generation of target-specific intrinsics to support |
| 111 | /// handling of complex number arithmetic |
| 112 | LLVM_ABI FunctionPass *createComplexDeinterleavingPass(const TargetMachine *TM); |
| 113 | |
| 114 | /// AtomicExpandID -- Lowers atomic operations in terms of either cmpxchg |
| 115 | /// load-linked/store-conditional loops. |
| 116 | LLVM_ABI extern char &AtomicExpandID; |
| 117 | |
| 118 | /// MachineLoopInfo - This pass is a loop analysis pass. |
| 119 | LLVM_ABI extern char &MachineLoopInfoID; |
| 120 | |
| 121 | /// MachineDominators - This pass is a machine dominators analysis pass. |
| 122 | LLVM_ABI extern char &MachineDominatorsID; |
| 123 | |
| 124 | /// MachineDominanaceFrontier - This pass is a machine dominators analysis. |
| 125 | LLVM_ABI extern char &MachineDominanceFrontierID; |
| 126 | |
| 127 | /// MachineRegionInfo - This pass computes SESE regions for machine functions. |
| 128 | LLVM_ABI extern char &MachineRegionInfoPassID; |
| 129 | |
| 130 | /// EdgeBundles analysis - Bundle machine CFG edges. |
| 131 | LLVM_ABI extern char &EdgeBundlesWrapperLegacyID; |
| 132 | |
| 133 | /// LiveVariables pass - This pass computes the set of blocks in which each |
| 134 | /// variable is life and sets machine operand kill flags. |
| 135 | LLVM_ABI extern char &LiveVariablesID; |
| 136 | |
| 137 | /// PHIElimination - This pass eliminates machine instruction PHI nodes |
| 138 | /// by inserting copy instructions. This destroys SSA information, but is the |
| 139 | /// desired input for some register allocators. This pass is "required" by |
| 140 | /// these register allocator like this: AU.addRequiredID(PHIEliminationID); |
| 141 | LLVM_ABI extern char &PHIEliminationID; |
| 142 | |
| 143 | /// LiveIntervals - This analysis keeps track of the live ranges of virtual |
| 144 | /// and physical registers. |
| 145 | LLVM_ABI extern char &LiveIntervalsID; |
| 146 | |
| 147 | /// LiveStacks pass. An analysis keeping track of the liveness of stack slots. |
| 148 | LLVM_ABI extern char &LiveStacksID; |
| 149 | |
| 150 | /// TwoAddressInstruction - This pass reduces two-address instructions to |
| 151 | /// use two operands. This destroys SSA information but it is desired by |
| 152 | /// register allocators. |
| 153 | LLVM_ABI extern char &TwoAddressInstructionPassID; |
| 154 | |
| 155 | /// ProcessImpicitDefs pass - This pass removes IMPLICIT_DEFs. |
| 156 | LLVM_ABI extern char &ProcessImplicitDefsID; |
| 157 | |
| 158 | /// RegisterCoalescer - This pass merges live ranges to eliminate copies. |
| 159 | LLVM_ABI extern char &RegisterCoalescerID; |
| 160 | |
| 161 | /// MachineScheduler - This pass schedules machine instructions. |
| 162 | LLVM_ABI extern char &MachineSchedulerID; |
| 163 | |
| 164 | /// PostMachineScheduler - This pass schedules machine instructions postRA. |
| 165 | LLVM_ABI extern char &PostMachineSchedulerID; |
| 166 | |
| 167 | /// SpillPlacement analysis. Suggest optimal placement of spill code between |
| 168 | /// basic blocks. |
| 169 | LLVM_ABI extern char &SpillPlacementID; |
| 170 | |
| 171 | /// ShrinkWrap pass. Look for the best place to insert save and restore |
| 172 | // instruction and update the MachineFunctionInfo with that information. |
| 173 | LLVM_ABI extern char &ShrinkWrapID; |
| 174 | |
| 175 | /// LiveRangeShrink pass. Move instruction close to its definition to shrink |
| 176 | /// the definition's live range. |
| 177 | LLVM_ABI extern char &LiveRangeShrinkID; |
| 178 | |
| 179 | /// Greedy register allocator. |
| 180 | LLVM_ABI extern char &RAGreedyLegacyID; |
| 181 | |
| 182 | /// Basic register allocator. |
| 183 | LLVM_ABI extern char &RABasicID; |
| 184 | |
| 185 | /// VirtRegRewriter pass. Rewrite virtual registers to physical registers as |
| 186 | /// assigned in VirtRegMap. |
| 187 | LLVM_ABI extern char &VirtRegRewriterID; |
| 188 | LLVM_ABI FunctionPass *createVirtRegRewriter(bool ClearVirtRegs = true); |
| 189 | |
| 190 | /// UnreachableMachineBlockElimination - This pass removes unreachable |
| 191 | /// machine basic blocks. |
| 192 | LLVM_ABI extern char &UnreachableMachineBlockElimID; |
| 193 | |
| 194 | /// DeadMachineInstructionElim - This pass removes dead machine instructions. |
| 195 | LLVM_ABI extern char &DeadMachineInstructionElimID; |
| 196 | |
| 197 | /// This pass adds dead/undef flags after analyzing subregister lanes. |
| 198 | LLVM_ABI extern char &DetectDeadLanesID; |
| 199 | |
| 200 | /// This pass perform post-ra machine sink for COPY instructions. |
| 201 | LLVM_ABI extern char &PostRAMachineSinkingID; |
| 202 | |
| 203 | /// This pass adds flow sensitive discriminators. |
| 204 | LLVM_ABI extern char &MIRAddFSDiscriminatorsID; |
| 205 | |
| 206 | /// This pass reads flow sensitive profile. |
| 207 | LLVM_ABI extern char &MIRProfileLoaderPassID; |
| 208 | |
| 209 | // This pass gives undef values a Pseudo Instruction definition for |
| 210 | // Instructions to ensure early-clobber is followed when using the greedy |
| 211 | // register allocator. |
| 212 | LLVM_ABI extern char &InitUndefID; |
| 213 | |
| 214 | /// FastRegisterAllocation Pass - This pass register allocates as fast as |
| 215 | /// possible. It is best suited for debug code where live ranges are short. |
| 216 | /// |
| 217 | LLVM_ABI FunctionPass *createFastRegisterAllocator(); |
| 218 | LLVM_ABI FunctionPass *createFastRegisterAllocator(RegAllocFilterFunc F, |
| 219 | bool ClearVirtRegs); |
| 220 | |
| 221 | /// BasicRegisterAllocation Pass - This pass implements a degenerate global |
| 222 | /// register allocator using the basic regalloc framework. |
| 223 | /// |
| 224 | LLVM_ABI FunctionPass *createBasicRegisterAllocator(); |
| 225 | LLVM_ABI FunctionPass *createBasicRegisterAllocator(RegAllocFilterFunc F); |
| 226 | |
| 227 | /// Greedy register allocation pass - This pass implements a global register |
| 228 | /// allocator for optimized builds. |
| 229 | /// |
| 230 | LLVM_ABI FunctionPass *createGreedyRegisterAllocator(); |
| 231 | LLVM_ABI FunctionPass *createGreedyRegisterAllocator(RegAllocFilterFunc F); |
| 232 | |
| 233 | /// PBQPRegisterAllocation Pass - This pass implements the Partitioned Boolean |
| 234 | /// Quadratic Prograaming (PBQP) based register allocator. |
| 235 | /// |
| 236 | LLVM_ABI FunctionPass *createDefaultPBQPRegisterAllocator(); |
| 237 | |
| 238 | /// PrologEpilogCodeInserter - This pass inserts prolog and epilog code, |
| 239 | /// and eliminates abstract frame references. |
| 240 | LLVM_ABI extern char &PrologEpilogCodeInserterID; |
| 241 | LLVM_ABI MachineFunctionPass *createPrologEpilogInserterPass(); |
| 242 | |
| 243 | /// ExpandPostRAPseudos - This pass expands pseudo instructions after |
| 244 | /// register allocation. |
| 245 | LLVM_ABI extern char &ExpandPostRAPseudosID; |
| 246 | |
| 247 | /// PostRAHazardRecognizer - This pass runs the post-ra hazard |
| 248 | /// recognizer. |
| 249 | LLVM_ABI extern char &PostRAHazardRecognizerID; |
| 250 | |
| 251 | /// PostRAScheduler - This pass performs post register allocation |
| 252 | /// scheduling. |
| 253 | LLVM_ABI extern char &PostRASchedulerID; |
| 254 | |
| 255 | /// BranchFolding - This pass performs machine code CFG based |
| 256 | /// optimizations to delete branches to branches, eliminate branches to |
| 257 | /// successor blocks (creating fall throughs), and eliminating branches over |
| 258 | /// branches. |
| 259 | LLVM_ABI extern char &BranchFolderPassID; |
| 260 | |
| 261 | /// BranchRelaxation - This pass replaces branches that need to jump further |
| 262 | /// than is supported by a branch instruction. |
| 263 | LLVM_ABI extern char &BranchRelaxationPassID; |
| 264 | |
| 265 | /// MachineFunctionPrinterPass - This pass prints out MachineInstr's. |
| 266 | LLVM_ABI extern char &MachineFunctionPrinterPassID; |
| 267 | |
| 268 | /// MIRPrintingPass - this pass prints out the LLVM IR using the MIR |
| 269 | /// serialization format. |
| 270 | LLVM_ABI extern char &MIRPrintingPassID; |
| 271 | |
| 272 | /// TailDuplicate - Duplicate blocks with unconditional branches |
| 273 | /// into tails of their predecessors. |
| 274 | LLVM_ABI extern char &TailDuplicateLegacyID; |
| 275 | |
| 276 | /// Duplicate blocks with unconditional branches into tails of their |
| 277 | /// predecessors. Variant that works before register allocation. |
| 278 | LLVM_ABI extern char &EarlyTailDuplicateLegacyID; |
| 279 | |
| 280 | /// MachineTraceMetrics - This pass computes critical path and CPU resource |
| 281 | /// usage in an ensemble of traces. |
| 282 | LLVM_ABI extern char &MachineTraceMetricsID; |
| 283 | |
| 284 | /// EarlyIfConverter - This pass performs if-conversion on SSA form by |
| 285 | /// inserting cmov instructions. |
| 286 | LLVM_ABI extern char &EarlyIfConverterLegacyID; |
| 287 | |
| 288 | /// EarlyIfPredicator - This pass performs if-conversion on SSA form by |
| 289 | /// predicating if/else block and insert select at the join point. |
| 290 | LLVM_ABI extern char &EarlyIfPredicatorID; |
| 291 | |
| 292 | /// This pass performs instruction combining using trace metrics to estimate |
| 293 | /// critical-path and resource depth. |
| 294 | LLVM_ABI extern char &MachineCombinerID; |
| 295 | |
| 296 | /// StackSlotColoring - This pass performs stack coloring and merging. |
| 297 | /// It merges disjoint allocas to reduce the stack size. |
| 298 | LLVM_ABI extern char &StackColoringLegacyID; |
| 299 | |
| 300 | /// StackFramePrinter - This pass prints the stack frame layout and variable |
| 301 | /// mappings. |
| 302 | LLVM_ABI extern char &StackFrameLayoutAnalysisPassID; |
| 303 | |
| 304 | /// IfConverter - This pass performs machine code if conversion. |
| 305 | LLVM_ABI extern char &IfConverterID; |
| 306 | |
| 307 | LLVM_ABI FunctionPass * |
| 308 | createIfConverter(std::function<bool(const MachineFunction &)> Ftor); |
| 309 | |
| 310 | /// MachineBlockPlacement - This pass places basic blocks based on branch |
| 311 | /// probabilities. |
| 312 | LLVM_ABI extern char &MachineBlockPlacementID; |
| 313 | |
| 314 | /// MachineBlockPlacementStats - This pass collects statistics about the |
| 315 | /// basic block placement using branch probabilities and block frequency |
| 316 | /// information. |
| 317 | LLVM_ABI extern char &MachineBlockPlacementStatsID; |
| 318 | |
| 319 | /// GCLowering Pass - Used by gc.root to perform its default lowering |
| 320 | /// operations. |
| 321 | LLVM_ABI FunctionPass *createGCLoweringPass(); |
| 322 | |
| 323 | /// GCLowering Pass - Used by gc.root to perform its default lowering |
| 324 | /// operations. |
| 325 | LLVM_ABI extern char &GCLoweringID; |
| 326 | |
| 327 | /// ShadowStackGCLowering - Implements the custom lowering mechanism |
| 328 | /// used by the shadow stack GC. Only runs on functions which opt in to |
| 329 | /// the shadow stack collector. |
| 330 | LLVM_ABI FunctionPass *createShadowStackGCLoweringPass(); |
| 331 | |
| 332 | /// ShadowStackGCLowering - Implements the custom lowering mechanism |
| 333 | /// used by the shadow stack GC. |
| 334 | LLVM_ABI extern char &ShadowStackGCLoweringID; |
| 335 | |
| 336 | /// GCMachineCodeAnalysis - Target-independent pass to mark safe points |
| 337 | /// in machine code. Must be added very late during code generation, just |
| 338 | /// prior to output, and importantly after all CFG transformations (such as |
| 339 | /// branch folding). |
| 340 | LLVM_ABI extern char &GCMachineCodeAnalysisID; |
| 341 | |
| 342 | /// MachineCSE - This pass performs global CSE on machine instructions. |
| 343 | LLVM_ABI extern char &MachineCSELegacyID; |
| 344 | |
| 345 | /// MIRCanonicalizer - This pass canonicalizes MIR by renaming vregs |
| 346 | /// according to the semantics of the instruction as well as hoists |
| 347 | /// code. |
| 348 | LLVM_ABI extern char &MIRCanonicalizerID; |
| 349 | |
| 350 | /// ImplicitNullChecks - This pass folds null pointer checks into nearby |
| 351 | /// memory operations. |
| 352 | LLVM_ABI extern char &ImplicitNullChecksID; |
| 353 | |
| 354 | /// This pass performs loop invariant code motion on machine instructions. |
| 355 | LLVM_ABI extern char &MachineLICMID; |
| 356 | |
| 357 | /// This pass performs loop invariant code motion on machine instructions. |
| 358 | /// This variant works before register allocation. \see MachineLICMID. |
| 359 | LLVM_ABI extern char &EarlyMachineLICMID; |
| 360 | |
| 361 | /// MachineSinking - This pass performs sinking on machine instructions. |
| 362 | LLVM_ABI extern char &MachineSinkingLegacyID; |
| 363 | |
| 364 | /// MachineCopyPropagation - This pass performs copy propagation on |
| 365 | /// machine instructions. |
| 366 | LLVM_ABI extern char &MachineCopyPropagationID; |
| 367 | |
| 368 | LLVM_ABI MachineFunctionPass * |
| 369 | createMachineCopyPropagationPass(bool UseCopyInstr); |
| 370 | |
| 371 | /// MachineLateInstrsCleanup - This pass removes redundant identical |
| 372 | /// instructions after register allocation and rematerialization. |
| 373 | LLVM_ABI extern char &MachineLateInstrsCleanupID; |
| 374 | |
| 375 | /// PeepholeOptimizer - This pass performs peephole optimizations - |
| 376 | /// like extension and comparison eliminations. |
| 377 | LLVM_ABI extern char &PeepholeOptimizerLegacyID; |
| 378 | |
| 379 | /// OptimizePHIs - This pass optimizes machine instruction PHIs |
| 380 | /// to take advantage of opportunities created during DAG legalization. |
| 381 | LLVM_ABI extern char &OptimizePHIsLegacyID; |
| 382 | |
| 383 | /// StackSlotColoring - This pass performs stack slot coloring. |
| 384 | LLVM_ABI extern char &StackSlotColoringID; |
| 385 | |
| 386 | /// This pass lays out funclets contiguously. |
| 387 | LLVM_ABI extern char &FuncletLayoutID; |
| 388 | |
| 389 | /// This pass inserts the XRay instrumentation sleds if they are supported by |
| 390 | /// the target platform. |
| 391 | LLVM_ABI extern char &XRayInstrumentationID; |
| 392 | |
| 393 | /// This pass inserts FEntry calls |
| 394 | LLVM_ABI extern char &FEntryInserterID; |
| 395 | |
| 396 | /// This pass implements the "patchable-function" attribute. |
| 397 | LLVM_ABI extern char &PatchableFunctionID; |
| 398 | |
| 399 | /// createStackProtectorPass - This pass adds stack protectors to functions. |
| 400 | /// |
| 401 | LLVM_ABI FunctionPass *createStackProtectorPass(); |
| 402 | |
| 403 | /// createMachineVerifierPass - This pass verifies cenerated machine code |
| 404 | /// instructions for correctness. |
| 405 | /// |
| 406 | LLVM_ABI FunctionPass *createMachineVerifierPass(const std::string &Banner); |
| 407 | |
| 408 | /// createDwarfEHPass - This pass mulches exception handling code into a form |
| 409 | /// adapted to code generation. Required if using dwarf exception handling. |
| 410 | LLVM_ABI FunctionPass *createDwarfEHPass(CodeGenOptLevel OptLevel); |
| 411 | |
| 412 | /// createWinEHPass - Prepares personality functions used by MSVC on Windows, |
| 413 | /// in addition to the Itanium LSDA based personalities. |
| 414 | LLVM_ABI FunctionPass *createWinEHPass(bool DemoteCatchSwitchPHIOnly = false); |
| 415 | |
| 416 | /// createSjLjEHPreparePass - This pass adapts exception handling code to use |
| 417 | /// the GCC-style builtin setjmp/longjmp (sjlj) to handling EH control flow. |
| 418 | /// |
| 419 | LLVM_ABI FunctionPass *createSjLjEHPreparePass(const TargetMachine *TM); |
| 420 | |
| 421 | /// createWasmEHPass - This pass adapts exception handling code to use |
| 422 | /// WebAssembly's exception handling scheme. |
| 423 | LLVM_ABI FunctionPass *createWasmEHPass(); |
| 424 | |
| 425 | /// LocalStackSlotAllocation - This pass assigns local frame indices to stack |
| 426 | /// slots relative to one another and allocates base registers to access them |
| 427 | /// when it is estimated by the target to be out of range of normal frame |
| 428 | /// pointer or stack pointer index addressing. |
| 429 | LLVM_ABI extern char &LocalStackSlotAllocationID; |
| 430 | |
| 431 | /// This pass expands pseudo-instructions, reserves registers and adjusts |
| 432 | /// machine frame information. |
| 433 | LLVM_ABI extern char &FinalizeISelID; |
| 434 | |
| 435 | /// UnpackMachineBundles - This pass unpack machine instruction bundles. |
| 436 | LLVM_ABI extern char &UnpackMachineBundlesID; |
| 437 | |
| 438 | LLVM_ABI FunctionPass * |
| 439 | createUnpackMachineBundles(std::function<bool(const MachineFunction &)> Ftor); |
| 440 | |
| 441 | /// FinalizeMachineBundles - This pass finalize machine instruction |
| 442 | /// bundles (created earlier, e.g. during pre-RA scheduling). |
| 443 | LLVM_ABI extern char &FinalizeMachineBundlesID; |
| 444 | |
| 445 | /// StackMapLiveness - This pass analyses the register live-out set of |
| 446 | /// stackmap/patchpoint intrinsics and attaches the calculated information to |
| 447 | /// the intrinsic for later emission to the StackMap. |
| 448 | LLVM_ABI extern char &StackMapLivenessID; |
| 449 | |
| 450 | // MachineSanitizerBinaryMetadata - appends/finalizes sanitizer binary |
| 451 | // metadata after llvm SanitizerBinaryMetadata pass. |
| 452 | LLVM_ABI extern char &MachineSanitizerBinaryMetadataID; |
| 453 | |
| 454 | /// RemoveLoadsIntoFakeUses pass. |
| 455 | LLVM_ABI extern char &RemoveLoadsIntoFakeUsesID; |
| 456 | |
| 457 | /// RemoveRedundantDebugValues pass. |
| 458 | LLVM_ABI extern char &RemoveRedundantDebugValuesID; |
| 459 | |
| 460 | /// MachineCFGPrinter pass. |
| 461 | LLVM_ABI extern char &MachineCFGPrinterID; |
| 462 | |
| 463 | /// LiveDebugValues pass |
| 464 | LLVM_ABI extern char &LiveDebugValuesID; |
| 465 | |
| 466 | /// InterleavedAccess Pass - This pass identifies and matches interleaved |
| 467 | /// memory accesses to target specific intrinsics. |
| 468 | /// |
| 469 | LLVM_ABI FunctionPass *createInterleavedAccessPass(); |
| 470 | |
| 471 | /// InterleavedLoadCombines Pass - This pass identifies interleaved loads and |
| 472 | /// combines them into wide loads detectable by InterleavedAccessPass |
| 473 | /// |
| 474 | LLVM_ABI FunctionPass *createInterleavedLoadCombinePass(); |
| 475 | |
| 476 | /// LowerEmuTLS - This pass generates __emutls_[vt].xyz variables for all |
| 477 | /// TLS variables for the emulated TLS model. |
| 478 | /// |
| 479 | LLVM_ABI ModulePass *createLowerEmuTLSPass(); |
| 480 | |
| 481 | /// This pass lowers the \@llvm.load.relative and \@llvm.objc.* intrinsics to |
| 482 | /// instructions. This is unsafe to do earlier because a pass may combine the |
| 483 | /// constant initializer into the load, which may result in an overflowing |
| 484 | /// evaluation. |
| 485 | LLVM_ABI ModulePass *createPreISelIntrinsicLoweringPass(); |
| 486 | |
| 487 | /// GlobalMerge - This pass merges internal (by default) globals into structs |
| 488 | /// to enable reuse of a base pointer by indexed addressing modes. |
| 489 | /// It can also be configured to focus on size optimizations only. |
| 490 | /// |
| 491 | LLVM_ABI Pass * |
| 492 | createGlobalMergePass(const TargetMachine *TM, unsigned MaximalOffset, |
| 493 | bool OnlyOptimizeForSize = false, |
| 494 | bool MergeExternalByDefault = false, |
| 495 | bool MergeConstantByDefault = false, |
| 496 | bool MergeConstAggressiveByDefault = false); |
| 497 | |
| 498 | /// This pass splits the stack into a safe stack and an unsafe stack to |
| 499 | /// protect against stack-based overflow vulnerabilities. |
| 500 | LLVM_ABI FunctionPass *createSafeStackPass(); |
| 501 | |
| 502 | /// This pass detects subregister lanes in a virtual register that are used |
| 503 | /// independently of other lanes and splits them into separate virtual |
| 504 | /// registers. |
| 505 | LLVM_ABI extern char &RenameIndependentSubregsID; |
| 506 | |
| 507 | /// This pass is executed POST-RA to collect which physical registers are |
| 508 | /// preserved by given machine function. |
| 509 | LLVM_ABI FunctionPass *createRegUsageInfoCollector(); |
| 510 | |
| 511 | /// Return a MachineFunction pass that identifies call sites |
| 512 | /// and propagates register usage information of callee to caller |
| 513 | /// if available with PysicalRegisterUsageInfo pass. |
| 514 | LLVM_ABI FunctionPass *createRegUsageInfoPropPass(); |
| 515 | |
| 516 | /// This pass performs software pipelining on machine instructions. |
| 517 | LLVM_ABI extern char &MachinePipelinerID; |
| 518 | |
| 519 | /// This pass frees the memory occupied by the MachineFunction. |
| 520 | LLVM_ABI FunctionPass *createFreeMachineFunctionPass(); |
| 521 | |
| 522 | /// This pass performs merging similar functions globally. |
| 523 | LLVM_ABI ModulePass *createGlobalMergeFuncPass(); |
| 524 | |
| 525 | /// This pass performs outlining on machine instructions directly before |
| 526 | /// printing assembly. |
| 527 | LLVM_ABI ModulePass *createMachineOutlinerPass(bool RunOnAllFunctions = true); |
| 528 | |
| 529 | /// This pass expands the reduction intrinsics into sequences of shuffles. |
| 530 | LLVM_ABI FunctionPass *createExpandReductionsPass(); |
| 531 | |
| 532 | // This pass replaces intrinsics operating on vector operands with calls to |
| 533 | // the corresponding function in a vector library (e.g., SVML, libmvec). |
| 534 | LLVM_ABI FunctionPass *createReplaceWithVeclibLegacyPass(); |
| 535 | |
| 536 | // Expands large div/rem instructions. |
| 537 | LLVM_ABI FunctionPass *createExpandLargeDivRemPass(); |
| 538 | |
| 539 | // Expands large div/rem instructions. |
| 540 | LLVM_ABI FunctionPass *createExpandFpPass(); |
| 541 | |
| 542 | // This pass expands memcmp() to load/stores. |
| 543 | LLVM_ABI FunctionPass *createExpandMemCmpLegacyPass(); |
| 544 | |
| 545 | /// Creates Break False Dependencies pass. \see BreakFalseDeps.cpp |
| 546 | LLVM_ABI FunctionPass *createBreakFalseDeps(); |
| 547 | |
| 548 | // This pass expands indirectbr instructions. |
| 549 | LLVM_ABI FunctionPass *createIndirectBrExpandPass(); |
| 550 | |
| 551 | /// Creates CFI Fixup pass. \see CFIFixup.cpp |
| 552 | LLVM_ABI FunctionPass *createCFIFixup(); |
| 553 | |
| 554 | /// Creates CFI Instruction Inserter pass. \see CFIInstrInserter.cpp |
| 555 | LLVM_ABI FunctionPass *createCFIInstrInserter(); |
| 556 | |
| 557 | /// Creates CFGuard longjmp target identification pass. |
| 558 | /// \see CFGuardLongjmp.cpp |
| 559 | LLVM_ABI FunctionPass *createCFGuardLongjmpPass(); |
| 560 | |
| 561 | /// Creates Windows EH Continuation Guard target identification pass. |
| 562 | /// \see EHContGuardTargets.cpp |
| 563 | LLVM_ABI FunctionPass *createEHContGuardTargetsPass(); |
| 564 | |
| 565 | /// Create Hardware Loop pass. \see HardwareLoops.cpp |
| 566 | LLVM_ABI FunctionPass *createHardwareLoopsLegacyPass(); |
| 567 | |
| 568 | /// This pass inserts pseudo probe annotation for callsite profiling. |
| 569 | LLVM_ABI FunctionPass *createPseudoProbeInserter(); |
| 570 | |
| 571 | /// Create IR Type Promotion pass. \see TypePromotion.cpp |
| 572 | LLVM_ABI FunctionPass *createTypePromotionLegacyPass(); |
| 573 | |
| 574 | /// Add Flow Sensitive Discriminators. PassNum specifies the |
| 575 | /// sequence number of this pass (starting from 1). |
| 576 | LLVM_ABI FunctionPass * |
| 577 | createMIRAddFSDiscriminatorsPass(sampleprof::FSDiscriminatorPass P); |
| 578 | |
| 579 | /// Read Flow Sensitive Profile. |
| 580 | LLVM_ABI FunctionPass * |
| 581 | createMIRProfileLoaderPass(std::string File, std::string RemappingFile, |
| 582 | sampleprof::FSDiscriminatorPass P, |
| 583 | IntrusiveRefCntPtr<vfs::FileSystem> FS); |
| 584 | |
| 585 | /// Creates MIR Debugify pass. \see MachineDebugify.cpp |
| 586 | LLVM_ABI ModulePass *createDebugifyMachineModulePass(); |
| 587 | |
| 588 | /// Creates MIR Strip Debug pass. \see MachineStripDebug.cpp |
| 589 | /// If OnlyDebugified is true then it will only strip debug info if it was |
| 590 | /// added by a Debugify pass. The module will be left unchanged if the debug |
| 591 | /// info was generated by another source such as clang. |
| 592 | LLVM_ABI ModulePass *createStripDebugMachineModulePass(bool OnlyDebugified); |
| 593 | |
| 594 | /// Creates MIR Check Debug pass. \see MachineCheckDebugify.cpp |
| 595 | LLVM_ABI ModulePass *createCheckDebugMachineModulePass(); |
| 596 | |
| 597 | /// The pass fixups statepoint machine instruction to replace usage of |
| 598 | /// caller saved registers with stack slots. |
| 599 | LLVM_ABI extern char &FixupStatepointCallerSavedID; |
| 600 | |
| 601 | /// The pass transforms load/store <256 x i32> to AMX load/store intrinsics |
| 602 | /// or split the data to two <128 x i32>. |
| 603 | LLVM_ABI FunctionPass *createX86LowerAMXTypePass(); |
| 604 | |
| 605 | /// The pass transforms amx intrinsics to scalar operation if the function has |
| 606 | /// optnone attribute or it is O0. |
| 607 | LLVM_ABI FunctionPass *createX86LowerAMXIntrinsicsPass(); |
| 608 | |
| 609 | /// When learning an eviction policy, extract score(reward) information, |
| 610 | /// otherwise this does nothing |
| 611 | LLVM_ABI FunctionPass *createRegAllocScoringPass(); |
| 612 | |
| 613 | /// JMC instrument pass. |
| 614 | LLVM_ABI ModulePass *createJMCInstrumenterPass(); |
| 615 | |
| 616 | /// This pass converts conditional moves to conditional jumps when profitable. |
| 617 | LLVM_ABI FunctionPass *createSelectOptimizePass(); |
| 618 | |
| 619 | LLVM_ABI FunctionPass *createCallBrPass(); |
| 620 | |
| 621 | /// Creates Windows Secure Hot Patch pass. \see WindowsSecureHotPatching.cpp |
| 622 | LLVM_ABI ModulePass *createWindowsSecureHotPatchingPass(); |
| 623 | |
| 624 | /// Lowers KCFI operand bundles for indirect calls. |
| 625 | LLVM_ABI FunctionPass *createKCFIPass(); |
| 626 | } // namespace llvm |
| 627 | |
| 628 | #endif |
| 629 | |