Path: blob/main/contrib/llvm-project/llvm/lib/Transforms/IPO/BarrierNoopPass.cpp
35268 views
//===- BarrierNoopPass.cpp - A barrier pass for the pass manager ----------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// NOTE: DO NOT USE THIS IF AVOIDABLE9//10// This pass is a nonce pass intended to allow manipulation of the implicitly11// nesting pass manager. For example, it can be used to cause a CGSCC pass12// manager to be closed prior to running a new collection of function passes.13//14// FIXME: This is a huge HACK. This should be removed when the pass manager's15// nesting is made explicit instead of implicit.16//17//===----------------------------------------------------------------------===//1819#include "llvm/InitializePasses.h"20#include "llvm/Pass.h"21#include "llvm/Transforms/IPO.h"22using namespace llvm;2324namespace {25/// A nonce module pass used to place a barrier in a pass manager.26///27/// There is no mechanism for ending a CGSCC pass manager once one is started.28/// This prevents extension points from having clear deterministic ordering29/// when they are phrased as non-module passes.30class BarrierNoop : public ModulePass {31public:32static char ID; // Pass identification.3334BarrierNoop() : ModulePass(ID) {35initializeBarrierNoopPass(*PassRegistry::getPassRegistry());36}3738bool runOnModule(Module &M) override { return false; }39};40}4142ModulePass *llvm::createBarrierNoopPass() { return new BarrierNoop(); }4344char BarrierNoop::ID = 0;45INITIALIZE_PASS(BarrierNoop, "barrier", "A No-Op Barrier Pass",46false, false)474849