16#include "llvm/Config/llvm-config.h"
30#ifdef EXPENSIVE_CHECKS
36#define DEBUG_TYPE "ir"
48ModulePass::~ModulePass() =
default;
51 const std::string &Banner)
const {
60 return "module (" +
M.getName().str() +
")";
63bool ModulePass::skipModule(
const Module &M)
const {
64 const OptPassGate &Gate =
M.getContext().getOptPassGate();
73bool Pass::mustPreserveAnalysisID(
char &AID)
const {
74 return Resolver->getAnalysisIfAvailable(&AID) !=
nullptr;
78void Pass::dumpPassStructure(
unsigned Offset) {
87 const PassInfo *PI = PassRegistry::getPassRegistry()->getPassInfo(AID);
90 return "Unnamed pass: implement Pass::getPassName()";
97 const PassInfo *PI = Pass::lookupPassInfo(AID);
103void Pass::preparePassManager(
PMStack &) {
116void Pass::releaseMemory() {
120void Pass::verifyAnalysis()
const {
141 OS <<
"Pass::print not implemented for pass: '" << getPassName() <<
"'!\n";
144#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
151#ifdef EXPENSIVE_CHECKS
165ImmutablePass::~ImmutablePass() =
default;
167void ImmutablePass::initializePass() {
176 const std::string &Banner)
const {
185 return "function (" +
F.getName().str() +
")";
188bool FunctionPass::skipFunction(
const Function &
F)
const {
198 if (
F.hasOptNone()) {
199 LLVM_DEBUG(
dbgs() <<
"Skipping pass '" << getPassName() <<
"' on function "
200 <<
F.getName() <<
"\n");
206const PassInfo *Pass::lookupPassInfo(
const void *TI) {
207 return PassRegistry::getPassRegistry()->getPassInfo(TI);
211 return PassRegistry::getPassRegistry()->getPassInfo(Arg);
215 const PassInfo *PI = PassRegistry::getPassRegistry()->getPassInfo(
ID);
227void PassRegistrationListener::enumeratePasses() {
228 PassRegistry::getPassRegistry()->enumerateWith(
this);
233 PassRegistry::getPassRegistry()->addRegistrationListener(
this);
239PassNameParser::~PassNameParser() =
default;
252 GetCFGOnlyPasses(
VectorType &L) : CFGOnlyList(
L) {}
254 void passEnumerate(
const PassInfo *
P)
override {
255 if (
P->isCFGOnlyPass())
256 CFGOnlyList.push_back(
P->getTypeInfo());
270void AnalysisUsage::setPreservesCFG() {
273 GetCFGOnlyPasses(Preserved).enumeratePasses();
277 const PassInfo *PI = Pass::lookupPassInfo(Arg);
285 pushUnique(Required,
ID);
290 pushUnique(Required, &
ID);
295 pushUnique(Required, &
ID);
296 pushUnique(RequiredTransitive, &
ID);
303 case ThinOrFullLTOPhase::None:
305 case ThinOrFullLTOPhase::ThinLTOPreLink:
306 return "ThinLTOPreLink";
307 case ThinOrFullLTOPhase::ThinLTOPostLink:
308 return "ThinLTOPostLink";
309 case ThinOrFullLTOPhase::FullLTOPreLink:
310 return "FullLTOPreLink";
311 case ThinOrFullLTOPhase::FullLTOPostLink:
312 return "FullLTOPostLink";
aarch64 falkor hwpf fix Falkor HW Prefetch Fix Late Phase
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
This file contains an interface for creating legacy passes to print out IR in various granularities.
Module.h This file contains the declarations for the Module class.
static std::string getDescription(const Loop &L)
This file declares the interface for bisecting optimizations.
static const char PassName[]
AnalysisResolver - Simple interface used by Pass objects to pull all analysis information out of pass...
Represent the analysis usage information of a pass.
ImmutablePass class - This class is used to provide information that does not need to be run.
A Module instance is used to store all the information related to an LLVM module.
Extensions to this class implement mechanisms to disable passes and individual optimizations at compi...
virtual bool isEnabled() const
isEnabled() should return true before calling shouldRunPass().
virtual bool shouldRunPass(StringRef PassName, StringRef IRDescription) const
IRDescription is a textual description of the IR unit the pass is running over.
PMDataManager provides the common place to manage the analysis data used by pass managers.
PMStack - This class implements a stack data structure of PMDataManager pointers.
PassInfo class - An instance of this class exists for every pass known by the system,...
StringRef getPassArgument() const
getPassArgument - Return the command line option that may be passed to 'opt' that will cause this pas...
StringRef getPassName() const
getPassName - Return the friendly name for the pass, never returns null
Pass * createPass() const
createPass() - Use this method to create an instance of this pass.
const void * getTypeInfo() const
getTypeInfo - Return the id object for the pass... TODO : Rename
Pass interface - Implemented by all 'passes'.
Interface for looking up the initializer for a variable name, used by Init::resolveReferences.
StringRef - Represent a constant reference to a string, i.e.
This class implements an extremely fast bulk output stream that can only output to a stream.
raw_ostream & indent(unsigned NumSpaces)
indent - Insert 'NumSpaces' spaces.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
PassManagerType
Different types of internal pass managers.
@ PMT_ModulePassManager
MPPassManager.
@ PMT_FunctionPassManager
FPPassManager.
ThinOrFullLTOPhase
This enumerates the LLVM full LTO or ThinLTO optimization phases.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
const char * to_string(ThinOrFullLTOPhase Phase)
LLVM_ABI ModulePass * createPrintModulePass(raw_ostream &OS, const std::string &Banner="", bool ShouldPreserveUseListOrder=false)
Create and return a pass that writes the module to the specified raw_ostream.
LLVM_ABI FunctionPass * createPrintFunctionPass(raw_ostream &OS, const std::string &Banner="")
Create and return a pass that prints functions to the specified raw_ostream as they are processed.
LLVM_ABI stable_hash StructuralHash(const Function &F, bool DetailedHash=false)
Returns a hash of the function F.
PassRegistrationListener class - This class is meant to be derived from by clients that are intereste...