1 //===- BarrierNoopPass.cpp - A barrier pass for the pass manager ----------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // NOTE: DO NOT USE THIS IF AVOIDABLE
12 // This pass is a nonce pass intended to allow manipulation of the implicitly
13 // nesting pass manager. For example, it can be used to cause a CGSCC pass
14 // manager to be closed prior to running a new collection of function passes.
16 // FIXME: This is a huge HACK. This should be removed when the pass manager's
17 // nesting is made explicit instead of implicit.
19 //===----------------------------------------------------------------------===//
21 #include "llvm/Pass.h"
22 #include "llvm/Transforms/IPO.h"
26 /// \brief A nonce module pass used to place a barrier in a pass manager.
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 {
33 static char ID; // Pass identification.
35 BarrierNoop() : ModulePass(ID) {
36 initializeBarrierNoopPass(*PassRegistry::getPassRegistry());
39 bool runOnModule(Module &M) { return false; }
43 ModulePass *llvm::createBarrierNoopPass() { return new BarrierNoop(); }
45 char BarrierNoop::ID = 0;
46 INITIALIZE_PASS(BarrierNoop, "barrier", "A No-Op Barrier Pass",