LLVM 20.0.0git
BarrierNoopPass.cpp
Go to the documentation of this file.
1//===- BarrierNoopPass.cpp - A barrier pass for the pass manager ----------===//
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// NOTE: DO NOT USE THIS IF AVOIDABLE
10//
11// This pass is a nonce pass intended to allow manipulation of the implicitly
12// nesting pass manager. For example, it can be used to cause a CGSCC pass
13// manager to be closed prior to running a new collection of function passes.
14//
15// FIXME: This is a huge HACK. This should be removed when the pass manager's
16// nesting is made explicit instead of implicit.
17//
18//===----------------------------------------------------------------------===//
19
21#include "llvm/Pass.h"
22#include "llvm/Transforms/IPO.h"
23using namespace llvm;
24
25namespace {
26/// A nonce module pass used to place a barrier in a pass manager.
27///
28/// There is no mechanism for ending a CGSCC pass manager once one is started.
29/// This prevents extension points from having clear deterministic ordering
30/// when they are phrased as non-module passes.
31class BarrierNoop : public ModulePass {
32public:
33 static char ID; // Pass identification.
34
35 BarrierNoop() : ModulePass(ID) {
37 }
38
39 bool runOnModule(Module &M) override { return false; }
40};
41}
42
43ModulePass *llvm::createBarrierNoopPass() { return new BarrierNoop(); }
44
45char BarrierNoop::ID = 0;
46INITIALIZE_PASS(BarrierNoop, "barrier", "A No-Op Barrier Pass",
47 false, false)
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
Definition: PassSupport.h:38
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
Definition: Pass.h:251
virtual bool runOnModule(Module &M)=0
runOnModule - Virtual method overriden by subclasses to process the module being operated on.
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition: CallingConv.h:24
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
ModulePass * createBarrierNoopPass()
createBarrierNoopPass - This pass is purely a module pass barrier in a pass manager.
void initializeBarrierNoopPass(PassRegistry &)