LLVM  mainline
BarrierNoopPass.cpp
Go to the documentation of this file.
00001 //===- BarrierNoopPass.cpp - A barrier pass for the pass manager ----------===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // NOTE: DO NOT USE THIS IF AVOIDABLE
00011 //
00012 // This pass is a nonce pass intended to allow manipulation of the implicitly
00013 // nesting pass manager. For example, it can be used to cause a CGSCC pass
00014 // manager to be closed prior to running a new collection of function passes.
00015 //
00016 // FIXME: This is a huge HACK. This should be removed when the pass manager's
00017 // nesting is made explicit instead of implicit.
00018 //
00019 //===----------------------------------------------------------------------===//
00020 
00021 #include "llvm/Pass.h"
00022 #include "llvm/Transforms/IPO.h"
00023 using namespace llvm;
00024 
00025 namespace {
00026 /// \brief A nonce module pass used to place a barrier in a pass manager.
00027 ///
00028 /// There is no mechanism for ending a CGSCC pass manager once one is started.
00029 /// This prevents extension points from having clear deterministic ordering
00030 /// when they are phrased as non-module passes.
00031 class BarrierNoop : public ModulePass {
00032 public:
00033   static char ID; // Pass identification.
00034 
00035   BarrierNoop() : ModulePass(ID) {
00036     initializeBarrierNoopPass(*PassRegistry::getPassRegistry());
00037   }
00038 
00039   bool runOnModule(Module &M) override { return false; }
00040 };
00041 }
00042 
00043 ModulePass *llvm::createBarrierNoopPass() { return new BarrierNoop(); }
00044 
00045 char BarrierNoop::ID = 0;
00046 INITIALIZE_PASS(BarrierNoop, "barrier", "A No-Op Barrier Pass",
00047                 false, false)