llvm/llvm/lib/IR/Pass.cpp

//===- Pass.cpp - LLVM Pass Infrastructure Implementation -----------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file implements the LLVM Pass infrastructure.  It is primarily
// responsible with ensuring that passes are executed and batched together
// optimally.
//
//===----------------------------------------------------------------------===//

#include "llvm/Pass.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/IRPrintingPasses.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/LegacyPassNameParser.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/OptBisect.h"
#include "llvm/PassInfo.h"
#include "llvm/PassRegistry.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>

#ifdef EXPENSIVE_CHECKS
#include "llvm/IR/StructuralHash.h"
#endif

usingnamespacellvm;

#define DEBUG_TYPE

//===----------------------------------------------------------------------===//
// Pass Implementation
//

// Force out-of-line virtual method.
Pass::~Pass() {}

// Force out-of-line virtual method.
ModulePass::~ModulePass() = default;

Pass *ModulePass::createPrinterPass(raw_ostream &OS,
                                    const std::string &Banner) const {}

PassManagerType ModulePass::getPotentialPassManagerType() const {}

static std::string getDescription(const Module &M) {}

bool ModulePass::skipModule(Module &M) const {}

bool Pass::mustPreserveAnalysisID(char &AID) const {}

// dumpPassStructure - Implement the -debug-pass=Structure option
void Pass::dumpPassStructure(unsigned Offset) {}

/// getPassName - Return a nice clean name for a pass.  This usually
/// implemented in terms of the name that is registered by one of the
/// Registration templates, but can be overloaded directly.
StringRef Pass::getPassName() const {}

void Pass::preparePassManager(PMStack &) {}

PassManagerType Pass::getPotentialPassManagerType() const {}

void Pass::getAnalysisUsage(AnalysisUsage &) const {}

void Pass::releaseMemory() {}

void Pass::verifyAnalysis() const {}

void *Pass::getAdjustedAnalysisPointer(AnalysisID AID) {}

ImmutablePass *Pass::getAsImmutablePass() {}

PMDataManager *Pass::getAsPMDataManager() {}

void Pass::setResolver(AnalysisResolver *AR) {}

// print - Print out the internal state of the pass.  This is called by Analyze
// to print out the contents of an analysis.  Otherwise it is not necessary to
// implement this method.
void Pass::print(raw_ostream &OS, const Module *) const {}

#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
// dump - call print(cerr);
LLVM_DUMP_METHOD void Pass::dump() const {
  print(dbgs(), nullptr);
}
#endif

#ifdef EXPENSIVE_CHECKS
uint64_t Pass::structuralHash(Module &M) const {
  return StructuralHash(M, true);
}

uint64_t Pass::structuralHash(Function &F) const {
  return StructuralHash(F, true);
}
#endif

//===----------------------------------------------------------------------===//
// ImmutablePass Implementation
//
// Force out-of-line virtual method.
ImmutablePass::~ImmutablePass() = default;

void ImmutablePass::initializePass() {}

//===----------------------------------------------------------------------===//
// FunctionPass Implementation
//

Pass *FunctionPass::createPrinterPass(raw_ostream &OS,
                                      const std::string &Banner) const {}

PassManagerType FunctionPass::getPotentialPassManagerType() const {}

static std::string getDescription(const Function &F) {}

bool FunctionPass::skipFunction(const Function &F) const {}

const PassInfo *Pass::lookupPassInfo(const void *TI) {}

const PassInfo *Pass::lookupPassInfo(StringRef Arg) {}

Pass *Pass::createPass(AnalysisID ID) {}

//===----------------------------------------------------------------------===//
// PassRegistrationListener implementation
//

// enumeratePasses - Iterate over the registered passes, calling the
// passEnumerate callback on each PassInfo object.
void PassRegistrationListener::enumeratePasses() {}

PassNameParser::PassNameParser(cl::Option &O)
    :{}

// This only gets called during static destruction, in which case the
// PassRegistry will have already been destroyed by llvm_shutdown().  So
// attempting to remove the registration listener is an error.
PassNameParser::~PassNameParser() = default;

//===----------------------------------------------------------------------===//
//   AnalysisUsage Class Implementation
//

namespace {

struct GetCFGOnlyPasses : public PassRegistrationListener {};

} // end anonymous namespace

// setPreservesCFG - This function should be called to by the pass, iff they do
// not:
//
//  1. Add or remove basic blocks from the function
//  2. Modify terminator instructions in any way.
//
// This function annotates the AnalysisUsage info object to say that analyses
// that only depend on the CFG are preserved by this pass.
void AnalysisUsage::setPreservesCFG() {}

AnalysisUsage &AnalysisUsage::addPreserved(StringRef Arg) {}

AnalysisUsage &AnalysisUsage::addRequiredID(const void *ID) {}

AnalysisUsage &AnalysisUsage::addRequiredID(char &ID) {}

AnalysisUsage &AnalysisUsage::addRequiredTransitiveID(char &ID) {}