[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / llvm / lib / Transforms / IPO / BarrierNoopPass.cpp
blobb49a92ad16b3a5e2a26bff6af4c85e9a1b4ba9de
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
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.
15 // FIXME: This is a huge HACK. This should be removed when the pass manager's
16 // nesting is made explicit instead of implicit.
18 //===----------------------------------------------------------------------===//
20 #include "llvm/InitializePasses.h"
21 #include "llvm/Pass.h"
22 #include "llvm/Transforms/IPO.h"
23 using namespace llvm;
25 namespace {
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.
31 class BarrierNoop : public ModulePass {
32 public:
33 static char ID; // Pass identification.
35 BarrierNoop() : ModulePass(ID) {
36 initializeBarrierNoopPass(*PassRegistry::getPassRegistry());
39 bool runOnModule(Module &M) override { return false; }
43 ModulePass *llvm::createBarrierNoopPass() { return new BarrierNoop(); }
45 char BarrierNoop::ID = 0;
46 INITIALIZE_PASS(BarrierNoop, "barrier", "A No-Op Barrier Pass",
47 false, false)