//
// The LLVM Compiler Infrastructure
//
-// This file was developed by the LLVM research group and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
#ifndef LLVM_PASS_SUPPORT_H
#define LLVM_PASS_SUPPORT_H
-#include "llvm/System/IncludeFile.h"
// No need to include Pass.h, we are being included by it!
namespace llvm {
const char *PassArgument; // Command Line argument to run this pass
intptr_t PassID;
bool IsCFGOnlyPass; // Pass only looks at the CFG.
+ bool IsAnalysis; // True if an analysis pass.
bool IsAnalysisGroup; // True if an analysis group.
std::vector<const PassInfo*> ItfImpl;// Interfaces implemented by this pass
/// PassInfo ctor - Do not call this directly, this should only be invoked
/// through RegisterPass.
PassInfo(const char *name, const char *arg, intptr_t pi,
- Pass *(*normal)() = 0, bool isCFGOnly = false)
+ Pass *(*normal)() = 0, bool isCFGOnly = false, bool isAnalysis = false)
: PassName(name), PassArgument(arg), PassID(pi),
- IsCFGOnlyPass(isCFGOnly), IsAnalysisGroup(false), NormalCtor(normal) {
+ IsCFGOnlyPass(isCFGOnly),
+ IsAnalysis(isAnalysis), IsAnalysisGroup(false), NormalCtor(normal) {
}
/// getPassName - Return the friendly name for the pass, never returns null
///
const char *getPassArgument() const { return PassArgument; }
- /// getTypeInfo - Return the type_info object for the pass...
+ /// getTypeInfo - Return the id object for the pass...
/// TODO : Rename
intptr_t getTypeInfo() const { return PassID; }
/// pass.
///
bool isAnalysisGroup() const { return IsAnalysisGroup; }
+ bool isAnalysis() const { return IsAnalysis; }
void SetIsAnalysisGroup() { IsAnalysisGroup = true; }
/// isCFGOnlyPass - return true if this pass only looks at the CFG for the
typedef Pass* (*NormalCtor_t)();
RegisterPassBase(const char *Name, const char *Arg, intptr_t TI,
- NormalCtor_t NormalCtor = 0, bool CFGOnly = false)
- : PIObj(Name, Arg, TI, NormalCtor, CFGOnly) {
+ NormalCtor_t NormalCtor = 0, bool CFGOnly = false,
+ bool IsAnalysis = false)
+ : PIObj(Name, Arg, TI, NormalCtor, CFGOnly, IsAnalysis) {
registerPass();
}
- RegisterPassBase(intptr_t TI)
+ explicit RegisterPassBase(intptr_t TI)
: PIObj("", "", TI) {
// This ctor may only be used for analysis groups: it does not auto-register
// the pass.
struct RegisterPass : public RegisterPassBase {
// Register Pass using default constructor...
- RegisterPass(const char *PassArg, const char *Name, bool CFGOnly = false)
- : RegisterPassBase(Name, PassArg, (intptr_t)&PassName::ID,
- (RegisterPassBase::NormalCtor_t)callDefaultCtor<PassName>, CFGOnly) {
+ RegisterPass(const char *PassArg, const char *Name, bool CFGOnly = false,
+ bool IsAnalysis = false)
+ : RegisterPassBase(Name, PassArg, intptr_t(&PassName::ID),
+ RegisterPassBase::NormalCtor_t(callDefaultCtor<PassName>),
+ CFGOnly, IsAnalysis) {
}
};
template<typename Interface, bool Default = false>
struct RegisterAnalysisGroup : public RegisterAGBase {
explicit RegisterAnalysisGroup(RegisterPassBase &RPB)
- : RegisterAGBase((intptr_t) &Interface::ID, RPB.getPassInfo()->getTypeInfo(),
+ : RegisterAGBase(intptr_t(&Interface::ID), RPB.getPassInfo()->getTypeInfo(),
Default) {
}
explicit RegisterAnalysisGroup(const char *Name)
- : RegisterAGBase((intptr_t) &Interface::ID) {
+ : RegisterAGBase(intptr_t(&Interface::ID)) {
setGroupName(Name);
}
};