llvm.org GIT mirror llvm / 1997473
Drop 'const' git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36662 91177308-0d34-0410-b5e6-96231b3b80d8 Devang Patel 13 years ago
150 changed file(s) with 312 addition(s) and 312 deletion(s). Raw diff Collapse all Expand all
262262 time.

263263
264264

                  
                
265 static const char ID;
265 static char ID;
266266 Hello() : FunctionPass((intptr_t)&ID) {}
267267

268268
284284 function.

285285
286286

                  
                
287 const char Hello::ID = 0;
287 char Hello::ID = 0;
288288
289289
290290

We initialize pass ID here. LLVM uses ID's address to identify pass so

310310 namespace {
311311 struct Hello : public FunctionPass {
312312
313 static const char ID;
313 static char ID;
314314 Hello() : FunctionPass((intptr_t)&ID) {}
315315
316316 virtual bool runOnFunction(Function &F) {
6060 virtual void getAnalysisUsage(AnalysisUsage &AU) const;
6161
6262 public:
63 static const char ID; // Class identification, replacement for typeinfo
63 static char ID; // Class identification, replacement for typeinfo
6464 AliasAnalysis() : TD(0), AA(0) {}
6565 virtual ~AliasAnalysis(); // We want to be subclassed
6666
7272 FunctionMapTy FunctionMap; // Map from a function to its node
7373
7474 public:
75 static const char ID; // Class identification, replacement for typeinfo
75 static char ID; // Class identification, replacement for typeinfo
7676 //===---------------------------------------------------------------------
7777 // Accessors...
7878 //
207207 ///
208208 class DominatorTree : public DominatorTreeBase {
209209 public:
210 static const char ID; // Pass ID, replacement for typeid
210 static char ID; // Pass ID, replacement for typeid
211211 DominatorTree() : DominatorTreeBase((intptr_t)&ID, false) {}
212212
213213 BasicBlock *getRoot() const {
398398
399399 class ETForest : public ETForestBase {
400400 public:
401 static const char ID; // Pass identifcation, replacement for typeid
401 static char ID; // Pass identifcation, replacement for typeid
402402
403403 ETForest() : ETForestBase((intptr_t)&ID, false) {}
404404
476476 ///
477477 class DominanceFrontier : public DominanceFrontierBase {
478478 public:
479 static const char ID; // Pass ID, replacement for typeid
479 static char ID; // Pass ID, replacement for typeid
480480 DominanceFrontier() :
481481 DominanceFrontierBase((intptr_t)& ID, false) {}
482482
2323 class FindUsedTypes : public ModulePass {
2424 std::set UsedTypes;
2525 public:
26 static const char ID; // Pass identifcation, replacement for typeid
26 static char ID; // Pass identifcation, replacement for typeid
2727 FindUsedTypes() : ModulePass((intptr_t)&ID) {}
2828
2929 /// getTypes - After the pass has been run, return the set containing all of
4444 std::vector Intervals;
4545
4646 public:
47 static const char ID; // Pass identifcation, replacement for typeid
47 static char ID; // Pass identifcation, replacement for typeid
4848
4949 IntervalPartition() : FunctionPass((intptr_t)&ID), RootInterval(0) {}
5050
240240 std::vector TopLevelLoops;
241241 friend class Loop;
242242 public:
243 static const char ID; // Pass identifcation, replacement for typeid
243 static char ID; // Pass identifcation, replacement for typeid
244244
245245 LoopInfo() : FunctionPass((intptr_t)&ID) {}
246246 ~LoopInfo() { releaseMemory(); }
6767 class LPPassManager : public FunctionPass, public PMDataManager {
6868
6969 public:
70 static const char ID;
70 static char ID;
7171 LPPassManager(int Depth);
7272
7373 /// run - Execute all of the passes scheduled for execution. Keep track of
2121 /// compute the a post-dominator tree.
2222 ///
2323 struct PostDominatorTree : public DominatorTreeBase {
24 static const char ID; // Pass identifcation, replacement for typeid
24 static char ID; // Pass identifcation, replacement for typeid
2525
2626 PostDominatorTree() :
2727 DominatorTreeBase((intptr_t)&ID, true) {}
5353 /// PostETForest Class - Concrete subclass of ETForestBase that is used to
5454 /// compute a forwards post-dominator ET-Forest.
5555 struct PostETForest : public ETForestBase {
56 static const char ID;
56 static char ID;
5757 PostETForest() : ETForestBase((intptr_t)&ID, true) {}
5858
5959 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
7878 /// used to compute the a post-dominance frontier.
7979 ///
8080 struct PostDominanceFrontier : public DominanceFrontierBase {
81 static const char ID;
81 static char ID;
8282 PostDominanceFrontier()
8383 : DominanceFrontierBase((intptr_t) &ID, true) {}
8484
3737 // entered.
3838 std::map, unsigned> EdgeCounts;
3939 public:
40 static const char ID; // Class identification, replacement for typeinfo
40 static char ID; // Class identification, replacement for typeinfo
4141 virtual ~ProfileInfo(); // We want to be subclassed
4242
4343 //===------------------------------------------------------------------===//
196196 class ScalarEvolution : public FunctionPass {
197197 void *Impl; // ScalarEvolution uses the pimpl pattern
198198 public:
199 static const char ID; // Pass identifcation, replacement for typeid
199 static char ID; // Pass identifcation, replacement for typeid
200200 ScalarEvolution() : FunctionPass((intptr_t)&ID), Impl(0) {}
201201
202202 /// getSCEV - Return a SCEV expression handle for the full generality of the
2828 class Instruction;
2929
3030 struct ValueNumbering {
31 static const char ID; // Class identification, replacement for typeinfo
31 static char ID; // Class identification, replacement for typeinfo
3232 virtual ~ValueNumbering(); // We want to be subclassed
3333
3434 /// getEqualNumberNodes - Return nodes with the same value number as the
2727 OStream *Out; // ostream to print on
2828 bool DeleteStream; // Delete the ostream in our dtor?
2929 public:
30 static const char ID;
30 static char ID;
3131 PrintModulePass() : ModulePass((intptr_t)&ID), Out(&cerr), DeleteStream(false) {}
3232 PrintModulePass(OStream *o, bool DS = false)
3333 : ModulePass((intptr_t)&ID), Out(o), DeleteStream(DS) {}
5151 OStream *Out; // ostream to print on
5252 bool DeleteStream; // Delete the ostream in our dtor?
5353 public:
54 static const char ID;
54 static char ID;
5555 PrintFunctionPass() : FunctionPass((intptr_t)&ID), Banner(""), Out(&cerr),
5656 DeleteStream(false) {}
5757 PrintFunctionPass(const std::string &B, OStream *o = &cout,
2525 bool DeleteStream;
2626 bool CompressFile;
2727 public:
28 static const char ID; // Pass identifcation, replacement for typeid
28 static char ID; // Pass identifcation, replacement for typeid
2929 WriteBytecodePass()
3030 : ModulePass((intptr_t) &ID), Out(&cout), DeleteStream(false),
3131 CompressFile(false) {}
3333 /// AsmPrinter - This class is intended to be used as a driving class for all
3434 /// asm writers.
3535 class AsmPrinter : public MachineFunctionPass {
36 static const char ID;
36 static char ID;
3737
3838 /// FunctionNumber - This provides a unique ID for each function emitted in
3939 /// this translation unit. It is autoincremented by SetupMachineFunction,
6464 BitVector JoinedLIs;
6565
6666 public:
67 static const char ID; // Pass identifcation, replacement for typeid
67 static char ID; // Pass identifcation, replacement for typeid
6868 LiveIntervals() : MachineFunctionPass((intptr_t)&ID) {}
6969
7070 struct CopyRec {
3939
4040 class LiveVariables : public MachineFunctionPass {
4141 public:
42 static const char ID; // Pass identifcation, replacement for typeid
42 static char ID; // Pass identifcation, replacement for typeid
4343 LiveVariables() : MachineFunctionPass((intptr_t)&ID) {}
4444
4545 /// VarInfo - This represents the regions where a virtual register is live in
10211021 std::vector TypeInfos;
10221022
10231023 public:
1024 static const char ID; // Pass identifcation, replacement for typeid
1024 static char ID; // Pass identifcation, replacement for typeid
10251025
10261026 MachineModuleInfo();
10271027 ~MachineModuleInfo();
4040 MachineBasicBlock *BB;
4141 std::vector TopOrder;
4242 unsigned DAGSize;
43 static const char ID;
43 static char ID;
4444
4545 explicit SelectionDAGISel(TargetLowering &tli) :
4646 FunctionPass((intptr_t)&ID), TLI(tli), DAGSize(0) {}
335335 class FPPassManager : public ModulePass, public PMDataManager {
336336
337337 public:
338 static const char ID;
338 static char ID;
339339 explicit FPPassManager(int Depth)
340340 : ModulePass((intptr_t)&ID), PMDataManager(Depth) { }
341341
201201 /// requested alignment (if the global has one).
202202 unsigned getPreferredAlignmentLog(const GlobalVariable *GV) const;
203203
204 static const char ID; // Pass identifcation, replacement for typeid
204 static char ID; // Pass identifcation, replacement for typeid
205205 };
206206
207207 /// StructLayout - used to lazily calculate structure layout information for a
2222 /// this interface are expected to chain to other implementations, such that
2323 /// multiple profilers can be support simultaniously.
2424 struct RSProfilers : public ModulePass {
25 static const char ID; // Pass identification, replacement for typeinfo
25 static char ID; // Pass identification, replacement for typeinfo
2626 RSProfilers() : ModulePass((intptr_t)&ID) {}
2727
2828 /// isProfiling - This method returns true if the value passed it was
2424 struct UnifyFunctionExitNodes : public FunctionPass {
2525 BasicBlock *ReturnBlock, *UnwindBlock, *UnreachableBlock;
2626 public:
27 static const char ID; // Pass identifcation, replacement for typeid
27 static char ID; // Pass identifcation, replacement for typeid
2828 UnifyFunctionExitNodes() : FunctionPass((intptr_t)&ID),
2929 ReturnBlock(0), UnwindBlock(0) {}
3030
3535 namespace {
3636 RegisterAnalysisGroup Z("Alias Analysis");
3737 }
38 const char AliasAnalysis::ID = 0;
38 char AliasAnalysis::ID = 0;
3939
4040 //===----------------------------------------------------------------------===//
4141 // Default chaining methods
3333 const char *Name;
3434 Module *M;
3535 public:
36 static const char ID; // Class identification, replacement for typeinfo
36 static char ID; // Class identification, replacement for typeinfo
3737 AliasAnalysisCounter() : ModulePass((intptr_t) &ID) {
3838 No = May = Must = 0;
3939 NoMR = JustRef = JustMod = MR = 0;
107107 }
108108 };
109109
110 const char AliasAnalysisCounter::ID = 0;
110 char AliasAnalysisCounter::ID = 0;
111111 RegisterPass
112112 X("count-aa", "Count Alias Analysis Query Responses");
113113 RegisterAnalysisGroup Y(X);
4949 unsigned NoModRef, Mod, Ref, ModRef;
5050
5151 public:
52 static const char ID; // Pass identifcation, replacement for typeid
52 static char ID; // Pass identifcation, replacement for typeid
5353 AAEval() : FunctionPass((intptr_t)&ID) {}
5454
5555 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
7272 bool doFinalization(Module &M);
7373 };
7474
75 const char AAEval::ID = 0;
75 char AAEval::ID = 0;
7676 RegisterPass
7777 X("aa-eval", "Exhaustive Alias Analysis Precision Evaluator");
7878 }
3939 std::set Vals;
4040
4141 public:
42 static const char ID; // Class identification, replacement for typeinfo
42 static char ID; // Class identification, replacement for typeinfo
4343 AliasDebugger() : ModulePass((intptr_t)&ID) {}
4444
4545 bool runOnModule(Module &M) {
121121
122122 };
123123
124 const char AliasDebugger::ID = 0;
124 char AliasDebugger::ID = 0;
125125 RegisterPass X("debug-aa", "AA use debugger");
126126 RegisterAnalysisGroup Y(X);
127127 }
554554 class VISIBILITY_HIDDEN AliasSetPrinter : public FunctionPass {
555555 AliasSetTracker *Tracker;
556556 public:
557 static const char ID; // Pass identifcation, replacement for typeid
557 static char ID; // Pass identifcation, replacement for typeid
558558 AliasSetPrinter() : FunctionPass((intptr_t)&ID) {}
559559
560560 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
572572 return false;
573573 }
574574 };
575 const char AliasSetPrinter::ID = 0;
575 char AliasSetPrinter::ID = 0;
576576 RegisterPass X("print-alias-sets", "Alias Set Printer");
577577 }
3535 /// such it doesn't follow many of the rules that other alias analyses must.
3636 ///
3737 struct VISIBILITY_HIDDEN NoAA : public ImmutablePass, public AliasAnalysis {
38 static const char ID; // Class identification, replacement for typeinfo
38 static char ID; // Class identification, replacement for typeinfo
3939 NoAA() : ImmutablePass((intptr_t)&ID) {}
4040
4141 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
7676 };
7777
7878 // Register this pass...
79 const char NoAA::ID = 0;
79 char NoAA::ID = 0;
8080 RegisterPass
8181 U("no-aa", "No Alias Analysis (always returns 'may' alias)");
8282
9191 /// Because it doesn't chain to a previous alias analysis (like -no-aa), it
9292 /// derives from the NoAA class.
9393 struct VISIBILITY_HIDDEN BasicAliasAnalysis : public NoAA {
94 static const char ID; // Class identification, replacement for typeinfo
94 static char ID; // Class identification, replacement for typeinfo
9595 AliasResult alias(const Value *V1, unsigned V1Size,
9696 const Value *V2, unsigned V2Size);
9797
123123 };
124124
125125 // Register this pass...
126 const char BasicAliasAnalysis::ID = 0;
126 char BasicAliasAnalysis::ID = 0;
127127 RegisterPass
128128 X("basicaa", "Basic Alias Analysis (default AA impl)");
129129
9090
9191 namespace {
9292 struct VISIBILITY_HIDDEN CFGPrinter : public FunctionPass {
93 static const char ID; // Pass identifcation, replacement for typeid
93 static char ID; // Pass identifcation, replacement for typeid
9494 CFGPrinter() : FunctionPass((intptr_t)&ID) {}
9595
9696 virtual bool runOnFunction(Function &F) {
113113 }
114114 };
115115
116 const char CFGPrinter::ID = 0;
116 char CFGPrinter::ID = 0;
117117 RegisterPass P1("print-cfg",
118118 "Print CFG of function to 'dot' file");
119119
120120 struct VISIBILITY_HIDDEN CFGOnlyPrinter : public CFGPrinter {
121 static const char ID; // Pass identifcation, replacement for typeid
121 static char ID; // Pass identifcation, replacement for typeid
122122 virtual bool runOnFunction(Function &F) {
123123 bool OldCFGOnly = CFGOnly;
124124 CFGOnly = true;
133133 }
134134 };
135135
136 const char CFGOnlyPrinter::ID = 0;
136 char CFGOnlyPrinter::ID = 0;
137137 RegisterPass
138138 P2("print-cfg-only",
139139 "Print CFG of function to 'dot' file (with no function bodies)");
7575 class VISIBILITY_HIDDEN Andersens : public ModulePass, public AliasAnalysis,
7676 private InstVisitor {
7777 public:
78 static const char ID; // Class identification, replacement for typeinfo
78 static char ID; // Class identification, replacement for typeinfo
7979 Andersens() : ModulePass((intptr_t)&ID) {}
8080 private:
8181 /// Node class - This class is used to represent a memory object in the
338338 void visitInstruction(Instruction &I);
339339 };
340340
341 const char Andersens::ID = 0;
341 char Andersens::ID = 0;
342342 RegisterPass X("anders-aa",
343343 "Andersen's Interprocedural Alias Analysis");
344344 RegisterAnalysisGroup Y(X);
5050 CallGraphNode *CallsExternalNode;
5151
5252 public:
53 static const char ID; // Class identification, replacement for typeinfo
53 static char ID; // Class identification, replacement for typeinfo
5454 BasicCallGraph() : ModulePass((intptr_t)&ID), Root(0),
5555 ExternalCallingNode(0), CallsExternalNode(0) {}
5656
195195
196196 } //End anonymous namespace
197197
198 const char CallGraph::ID = 0;
199 const char BasicCallGraph::ID = 0;
198 char CallGraph::ID = 0;
199 char BasicCallGraph::ID = 0;
200200
201201 void CallGraph::initialize(Module &M) {
202202 Mod = &M;
2929 class CGPassManager : public ModulePass, public PMDataManager {
3030
3131 public:
32 static const char ID;
32 static char ID;
3333 CGPassManager(int Depth)
3434 : ModulePass((intptr_t)&ID), PMDataManager(Depth) { }
3535
7272 }
7373 };
7474
75 const char CGPassManager::ID = 0;
75 char CGPassManager::ID = 0;
7676 /// run - Execute all of the passes scheduled for execution. Keep track of
7777 /// whether any of the passes modifies the module, and if so, return true.
7878 bool CGPassManager::runOnModule(Module &M) {
2020 #include "llvm/Support/InstIterator.h"
2121 using namespace llvm;
2222
23 const char FindUsedTypes::ID = 0;
23 char FindUsedTypes::ID = 0;
2424 static RegisterPass
2525 X("printusedtypes", "Find Used Types");
2626
8282 std::map FunctionInfo;
8383
8484 public:
85 static const char ID;
85 static char ID;
8686 GlobalsModRef() : ModulePass((intptr_t)&ID) {}
8787
8888 bool runOnModule(Module &M) {
145145 bool AnalyzeIndirectGlobalMemory(GlobalValue *GV);
146146 };
147147
148 const char GlobalsModRef::ID = 0;
148 char GlobalsModRef::ID = 0;
149149 RegisterPass X("globalsmodref-aa",
150150 "Simple mod/ref analysis for globals");
151151 RegisterAnalysisGroup Y(X);
5050 abort();
5151 }
5252 public:
53 static const char ID; // Pass identifcation, replacement for typeid
53 static char ID; // Pass identifcation, replacement for typeid
5454 InstCount() : FunctionPass((intptr_t)&ID) {}
5555
5656 virtual bool runOnFunction(Function &F);
6262
6363 };
6464
65 const char InstCount::ID = 0;
65 char InstCount::ID = 0;
6666 RegisterPass X("instcount",
6767 "Counts the various types of Instructions");
6868 }
1414 #include "llvm/Analysis/IntervalIterator.h"
1515 using namespace llvm;
1616
17 const char IntervalPartition::ID = 0;
17 char IntervalPartition::ID = 0;
1818 static RegisterPass
1919 X("intervals", "Interval Partition Construction", true);
2020
3939 namespace {
4040 // FIXME: This should not be a FunctionPass.
4141 struct VISIBILITY_HIDDEN LoadVN : public FunctionPass, public ValueNumbering {
42 static const char ID; // Class identification, replacement for typeinfo
42 static char ID; // Class identification, replacement for typeinfo
4343 LoadVN() : FunctionPass((intptr_t)&ID) {}
4444
4545 /// Pass Implementation stuff. This doesn't do any analysis.
8282 std::vector &RetVals) const;
8383 };
8484
85 const char LoadVN::ID = 0;
85 char LoadVN::ID = 0;
8686 // Register this pass...
8787 RegisterPass X("load-vn", "Load Value Numbering");
8888
2626 #include
2727 using namespace llvm;
2828
29 const char LoopInfo::ID = 0;
29 char LoopInfo::ID = 0;
3030 static RegisterPass
3131 X("loops", "Natural Loop Construction", true);
3232
2020 // LPPassManager
2121 //
2222
23 const char LPPassManager::ID = 0;
23 char LPPassManager::ID = 0;
2424 /// LPPassManager manages FPPassManagers and CalLGraphSCCPasses.
2525
2626 LPPassManager::LPPassManager(int Depth)
2121 // PostDominatorTree Implementation
2222 //===----------------------------------------------------------------------===//
2323
24 const char PostDominatorTree::ID = 0;
25 const char PostDominanceFrontier::ID = 0;
26 const char PostETForest::ID = 0;
24 char PostDominatorTree::ID = 0;
25 char PostDominanceFrontier::ID = 0;
26 char PostETForest::ID = 0;
2727 static RegisterPass
2828 F("postdomtree", "Post-Dominator Tree Construction", true);
2929
2323 namespace {
2424 RegisterAnalysisGroup Z("Profile Information");
2525 }
26 const char ProfileInfo::ID = 0;
26 char ProfileInfo::ID = 0;
2727
2828 ProfileInfo::~ProfileInfo() {}
2929
8585 namespace {
8686 struct VISIBILITY_HIDDEN NoProfileInfo
8787 : public ImmutablePass, public ProfileInfo {
88 static const char ID; // Class identification, replacement for typeinfo
88 static char ID; // Class identification, replacement for typeinfo
8989 NoProfileInfo() : ImmutablePass((intptr_t)&ID) {}
9090 };
9191
92 const char NoProfileInfo::ID = 0;
92 char NoProfileInfo::ID = 0;
9393 // Register this pass...
9494 RegisterPass
9595 X("no-profile", "No Profile Information");
3131 class VISIBILITY_HIDDEN LoaderPass : public ModulePass, public ProfileInfo {
3232 std::string Filename;
3333 public:
34 static const char ID; // Class identification, replacement for typeinfo
34 static char ID; // Class identification, replacement for typeinfo
3535 LoaderPass(const std::string &filename = "")
3636 : ModulePass((intptr_t)&ID), Filename(filename) {
3737 if (filename.empty()) Filename = ProfileInfoFilename;
4949 virtual bool runOnModule(Module &M);
5050 };
5151
52 const char LoaderPass::ID = 0;
52 char LoaderPass::ID = 0;
5353 RegisterPass
5454 X("profile-loader", "Load profile information from llvmprof.out");
5555
104104 RegisterPass
105105 R("scalar-evolution", "Scalar Evolution Analysis");
106106 }
107 const char ScalarEvolution::ID = 0;
107 char ScalarEvolution::ID = 0;
108108
109109 //===----------------------------------------------------------------------===//
110110 // SCEV class definitions
2121 #include "llvm/Support/Compiler.h"
2222 using namespace llvm;
2323
24 const char ValueNumbering::ID = 0;
24 char ValueNumbering::ID = 0;
2525 // Register the ValueNumbering interface, providing a nice name to refer to.
2626 static RegisterAnalysisGroup X("Value Numbering");
2727
5151 ///
5252 struct VISIBILITY_HIDDEN BasicVN
5353 : public ImmutablePass, public ValueNumbering {
54 static const char ID; // Class identification, replacement for typeinfo
54 static char ID; // Class identification, replacement for typeinfo
5555 BasicVN() : ImmutablePass((intptr_t)&ID) {}
5656
5757 /// getEqualNumberNodes - Return nodes with the same value number as the
6464 std::vector &RetVals) const;
6565 };
6666
67 const char BasicVN::ID = 0;
67 char BasicVN::ID = 0;
6868 // Register this pass...
6969 RegisterPass
7070 X("basicvn", "Basic Value Numbering (default GVN impl)");
4646 /// @brief The bytecode version number
4747 const unsigned BCVersionNum = 7;
4848
49 const char WriteBytecodePass::ID = 0;
49 char WriteBytecodePass::ID = 0;
5050 static RegisterPass X("emitbytecode", "Bytecode Writer");
5151
5252 STATISTIC(BytesWritten, "Number of bytecode bytes written");
3131 static cl::opt
3232 AsmVerbose("asm-verbose", cl::Hidden, cl::desc("Add comments to directives."));
3333
34 const char AsmPrinter::ID = 0;
34 char AsmPrinter::ID = 0;
3535 AsmPrinter::AsmPrinter(std::ostream &o, TargetMachine &tm,
3636 const TargetAsmInfo *T)
3737 : MachineFunctionPass((intptr_t)&ID), FunctionNumber(0), O(o), TM(tm), TAI(T)
3838
3939 namespace {
4040 struct BranchFolder : public MachineFunctionPass {
41 static const char ID;
41 static char ID;
4242 BranchFolder() : MachineFunctionPass((intptr_t)&ID) {}
4343
4444 virtual bool runOnMachineFunction(MachineFunction &MF);
6666 MachineBasicBlock *TBB, MachineBasicBlock *FBB,
6767 const std::vector &Cond);
6868 };
69 const char BranchFolder::ID = 0;
69 char BranchFolder::ID = 0;
7070 }
7171
7272 FunctionPass *llvm::createBranchFoldingPass() { return new BranchFolder(); }
4646 #include
4747 using namespace llvm;
4848
49 const char ELFWriter::ID = 0;
49 char ELFWriter::ID = 0;
5050 /// AddELFWriter - Concrete function to add the ELF writer to the function pass
5151 /// manager.
5252 MachineCodeEmitter *llvm::AddELFWriter(FunctionPassManager &FPM,
2929 class ELFWriter : public MachineFunctionPass {
3030 friend class ELFCodeEmitter;
3131 public:
32 static const char ID;
32 static char ID;
3333
3434 MachineCodeEmitter &getMachineCodeEmitter() const {
3535 return *(MachineCodeEmitter*)MCE;
4343 STATISTIC(numFolded , "Number of loads/stores folded into instructions");
4444 STATISTIC(numAborts , "Number of times interval joining aborted");
4545
46 const char LiveIntervals::ID = 0;
46 char LiveIntervals::ID = 0;
4747 namespace {
4848 RegisterPass X("liveintervals", "Live Interval Analysis");
4949
3636 #include
3737 using namespace llvm;
3838
39 const char LiveVariables::ID = 0;
39 char LiveVariables::ID = 0;
4040 static RegisterPass X("livevars", "Live Variable Analysis");
4141
4242 void LiveVariables::VarInfo::dump() const {
316316 // MachOWriter Implementation
317317 //===----------------------------------------------------------------------===//
318318
319 const char MachOWriter::ID = 0;
319 char MachOWriter::ID = 0;
320320 MachOWriter::MachOWriter(std::ostream &o, TargetMachine &tm)
321321 : MachineFunctionPass((intptr_t)&ID), O(o), TM(tm) {
322322 is64Bit = TM.getTargetData()->getPointerSizeInBits() == 64;
8383 class MachOWriter : public MachineFunctionPass {
8484 friend class MachOCodeEmitter;
8585 public:
86 static const char ID;
86 static char ID;
8787 MachineCodeEmitter &getMachineCodeEmitter() const {
8888 return *(MachineCodeEmitter*)MCE;
8989 }
4343
4444 namespace {
4545 struct VISIBILITY_HIDDEN Printer : public MachineFunctionPass {
46 static const char ID;
46 static char ID;
4747
4848 std::ostream *OS;
4949 const std::string Banner;
6363 return false;
6464 }
6565 };
66 const char Printer::ID = 0;
66 char Printer::ID = 0;
6767 }
6868
6969 /// Returns a newly-created MachineFunction Printer pass. The default output
7676
7777 namespace {
7878 struct VISIBILITY_HIDDEN Deleter : public MachineFunctionPass {
79 static const char ID;
79 static char ID;
8080 Deleter() : MachineFunctionPass((intptr_t)&ID) {}
8181
8282 const char *getPassName() const { return "Machine Code Deleter"; }
8787 return true;
8888 }
8989 };
90 const char Deleter::ID = 0;
90 char Deleter::ID = 0;
9191 }
9292
9393 /// MachineCodeDeletion Pass - This pass deletes all of the machine code for
2929 namespace {
3030 RegisterPass X("machinemoduleinfo", "Module Information");
3131 }
32 const char MachineModuleInfo::ID = 0;
32 char MachineModuleInfo::ID = 0;
3333
3434 //===----------------------------------------------------------------------===//
3535
17501750 namespace llvm {
17511751
17521752 struct DebugLabelFolder : public MachineFunctionPass {
1753 static const char ID;
1753 static char ID;
17541754 DebugLabelFolder() : MachineFunctionPass((intptr_t)&ID) {}
17551755
17561756 virtual bool runOnMachineFunction(MachineFunction &MF);
17571757 virtual const char *getPassName() const { return "Label Folder"; }
17581758 };
17591759
1760 const char DebugLabelFolder::ID = 0;
1760 char DebugLabelFolder::ID = 0;
17611761
17621762 bool DebugLabelFolder::runOnMachineFunction(MachineFunction &MF) {
17631763 // Get machine module info.
3232
3333 namespace {
3434 struct VISIBILITY_HIDDEN PNE : public MachineFunctionPass {
35 static const char ID; // Pass identifcation, replacement for typeid
35 static char ID; // Pass identifcation, replacement for typeid
3636 PNE() : MachineFunctionPass((intptr_t)&ID) {}
3737
3838 bool runOnMachineFunction(MachineFunction &Fn) {
7575 VRegPHIUse VRegPHIUseCount;
7676 };
7777
78 const char PNE::ID = 0;
78 char PNE::ID = 0;
7979 RegisterPass X("phi-node-elimination",
8080 "Eliminate PHI nodes for register allocation");
8181 }
3131
3232 namespace {
3333 struct VISIBILITY_HIDDEN PEI : public MachineFunctionPass {
34 static const char ID;
34 static char ID;
3535 PEI() : MachineFunctionPass((intptr_t)&ID) {}
3636
3737 const char *getPassName() const {
100100 void replaceFrameIndices(MachineFunction &Fn);
101101 void insertPrologEpilogCode(MachineFunction &Fn);
102102 };
103 const char PEI::ID = 0;
103 char PEI::ID = 0;
104104 }
105105
106106
4747 static unsigned numIntervals = 0;
4848
4949 struct VISIBILITY_HIDDEN RA : public MachineFunctionPass {
50 static const char ID;
50 static char ID;
5151 RA() : MachineFunctionPass((intptr_t)&ID) {}
5252
5353 typedef std::pair IntervalPtr;
148148 }
149149 }
150150 };
151 const char RA::ID = 0;
151 char RA::ID = 0;
152152 }
153153
154154 void RA::ComputeRelatedRegClasses() {
4343
4444 class VISIBILITY_HIDDEN RA : public MachineFunctionPass {
4545 public:
46 static const char ID;
46 static char ID;
4747 RA() : MachineFunctionPass((intptr_t)&ID) {}
4848 private:
4949 const TargetMachine *TM;
227227 void reloadPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator &I,
228228 unsigned PhysReg);
229229 };
230 const char RA::ID = 0;
230 char RA::ID = 0;
231231 }
232232
233233 /// getStackSpaceFor - This allocates space for the specified virtual register
3838
3939 class VISIBILITY_HIDDEN RegAllocSimple : public MachineFunctionPass {
4040 public:
41 static const char ID;
41 static char ID;
4242 RegAllocSimple() : MachineFunctionPass((intptr_t)&ID) {}
4343 private:
4444 MachineFunction *MF;
9393 void spillVirtReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
9494 unsigned VirtReg, unsigned PhysReg);
9595 };
96 const char RegAllocSimple::ID = 0;
96 char RegAllocSimple::ID = 0;
9797 }
9898
9999 /// getStackSpaceFor - This allocates space for the specified virtual
50115011 Ops.push_back(InOps.back());
50125012 }
50135013
5014 const char SelectionDAGISel::ID = 0;
5014 char SelectionDAGISel::ID = 0;
4949 namespace {
5050 struct VISIBILITY_HIDDEN TwoAddressInstructionPass
5151 : public MachineFunctionPass {
52 static const char ID; // Pass identifcation, replacement for typeid
52 static char ID; // Pass identifcation, replacement for typeid
5353 TwoAddressInstructionPass() : MachineFunctionPass((intptr_t)&ID) {}
5454
5555 virtual void getAnalysisUsage(AnalysisUsage &AU) const;
5858 bool runOnMachineFunction(MachineFunction&);
5959 };
6060
61 const char TwoAddressInstructionPass::ID = 0;
61 char TwoAddressInstructionPass::ID = 0;
6262 RegisterPass
6363 X("twoaddressinstruction", "Two-Address instruction pass");
6464 }
3434 class VISIBILITY_HIDDEN UnreachableBlockElim : public FunctionPass {
3535 virtual bool runOnFunction(Function &F);
3636 public:
37 static const char ID; // Pass identifcation, replacement for typeid
37 static char ID; // Pass identifcation, replacement for typeid
3838 UnreachableBlockElim() : FunctionPass((intptr_t)&ID) {}
3939 };
40 const char UnreachableBlockElim::ID = 0;
40 char UnreachableBlockElim::ID = 0;
4141 RegisterPass
4242 X("unreachableblockelim", "Remove unreachable blocks from the CFG");
4343 }
127127 ARMFunctionInfo *AFI;
128128 bool isThumb;
129129 public:
130 static const char ID;
130 static char ID;
131131 ARMConstantIslands() : MachineFunctionPass((intptr_t)&ID) {}
132132
133133 virtual bool runOnMachineFunction(MachineFunction &Fn);
173173 void dumpBBs();
174174 void verify(MachineFunction &Fn);
175175 };
176 const char ARMConstantIslands::ID = 0;
176 char ARMConstantIslands::ID = 0;
177177 }
178178
179179 /// verify - check BBOffsets, BBSizes, alignment of islands
3737
3838 namespace {
3939 struct VISIBILITY_HIDDEN ARMLoadStoreOpt : public MachineFunctionPass {
40 static const char ID;
40 static char ID;
4141 ARMLoadStoreOpt() : MachineFunctionPass((intptr_t)&ID) {}
4242
4343 const TargetInstrInfo *TII;
7272 bool LoadStoreMultipleOpti(MachineBasicBlock &MBB);
7373 bool MergeReturnIntoLDM(MachineBasicBlock &MBB);
7474 };
75 const char ARMLoadStoreOpt::ID = 0;
75 char ARMLoadStoreOpt::ID = 0;
7676 }
7777
7878 /// createARMLoadStoreOptimizationPass - returns an instance of the load / store
2121
2222 namespace {
2323 struct VISIBILITY_HIDDEN AlphaBSel : public MachineFunctionPass {
24 static const char ID;
24 static char ID;
2525 AlphaBSel() : MachineFunctionPass((intptr_t)&ID) {}
2626
2727 virtual bool runOnMachineFunction(MachineFunction &Fn);
3030 return "Alpha Branch Selection";
3131 }
3232 };
33 const char AlphaBSel::ID = 0;
33 char AlphaBSel::ID = 0;
3434 }
3535
3636 /// createAlphaBranchSelectionPass - returns an instance of the Branch Selection
3535 int getMachineOpValue(MachineInstr &MI, MachineOperand &MO);
3636
3737 public:
38 static const char ID;
38 static char ID;
3939 explicit AlphaCodeEmitter(TargetMachine &tm, MachineCodeEmitter &mce)
4040 : MachineFunctionPass((intptr_t)&ID), II(0), TM(tm), MCE(mce) {}
4141 AlphaCodeEmitter(TargetMachine &tm, MachineCodeEmitter &mce,
6060 void emitBasicBlock(MachineBasicBlock &MBB);
6161
6262 };
63 const char AlphaCodeEmitter::ID = 0;
63 char AlphaCodeEmitter::ID = 0;
6464 }
6565
6666 /// createAlphaCodeEmitterPass - Return a pass that emits the collected Alpha code
3636 ///
3737 AlphaTargetMachine &TM;
3838
39 static const char ID;
39 static char ID;
4040 AlphaLLRPPass(AlphaTargetMachine &tm)
4141 : MachineFunctionPass((intptr_t)&ID), TM(tm) { }
4242
153153 return Changed;
154154 }
155155 };
156 const char AlphaLLRPPass::ID = 0;
156 char AlphaLLRPPass::ID = 0;
157157 } // end of anonymous namespace
158158
159159 FunctionPass *llvm::createAlphaLLRPPass(AlphaTargetMachine &tm) {
5656 ///
5757 class CBackendNameAllUsedStructsAndMergeFunctions : public ModulePass {
5858 public:
59 static const char ID;
59 static char ID;
6060 CBackendNameAllUsedStructsAndMergeFunctions()
6161 : ModulePass((intptr_t)&ID) {}
6262 void getAnalysisUsage(AnalysisUsage &AU) const {
7070 virtual bool runOnModule(Module &M);
7171 };
7272
73 const char CBackendNameAllUsedStructsAndMergeFunctions::ID = 0;
73 char CBackendNameAllUsedStructsAndMergeFunctions::ID = 0;
7474
7575 /// CWriter - This class is the main chunk of code that converts an LLVM
7676 /// module to a C translation unit.
8787 std::set intrinsicPrototypesAlreadyGenerated;
8888
8989 public:
90 static const char ID;
90 static char ID;
9191 CWriter(std::ostream &o)
9292 : FunctionPass((intptr_t)&ID), Out(o), IL(0), Mang(0), LI(0),
9393 TheModule(0), TAsm(0), TD(0) {}
263263 };
264264 }
265265
266 const char CWriter::ID = 0;
266 char CWriter::ID = 0;
267267
268268 /// This method inserts names for any unnamed structure types that are used by
269269 /// the program, and removes names from structure types that are not used by the
3535
3636 namespace {
3737 struct IA64BundlingPass : public MachineFunctionPass {
38 static const char ID;
38 static char ID;
3939 /// Target machine description which we query for reg. names, data
4040 /// layout, etc.
4141 ///
6262 // 'fallthrough' code
6363 std::set PendingRegWrites;
6464 };
65 const char IA64BundlingPass::ID = 0;
65 char IA64BundlingPass::ID = 0;
6666 } // end of anonymous namespace
6767
6868 /// createIA64BundlingPass - Returns a pass that adds STOP (;;) instructions
7979 return Changed;
8080 }
8181
82 const char MSILModule::ID = 0;
83 const char MSILWriter::ID = 0;
82 char MSILModule::ID = 0;
83 char MSILWriter::ID = 0;
8484
8585 bool MSILWriter::runOnFunction(Function &F) {
8686 if (F.isDeclaration()) return false;
3636 const TargetData*& TD;
3737
3838 public:
39 static const char ID;
39 static char ID;
4040 MSILModule(const std::set*& _UsedTypes,
4141 const TargetData*& _TD)
4242 : ModulePass((intptr_t)&ID), UsedTypes(_UsedTypes), TD(_TD) {}
8282 std::map >
8383 StaticInitList;
8484 const std::set* UsedTypes;
85 static const char ID;
85 static char ID;
8686 MSILWriter(std::ostream &o) : FunctionPass((intptr_t)&ID), Out(o) {
8787 UniqID = 0;
8888 }
3131
3232 namespace {
3333 struct VISIBILITY_HIDDEN PPCBSel : public MachineFunctionPass {
34 static const char ID;
34 static char ID;
3535 PPCBSel() : MachineFunctionPass((intptr_t)&ID) {}
3636
3737 /// BlockSizes - The sizes of the basic blocks in the function.
4343 return "PowerPC Branch Selector";
4444 }
4545 };
46 const char PPCBSel::ID = 0;
46 char PPCBSel::ID = 0;
4747 }
4848
4949 /// createPPCBranchSelectionPass - returns an instance of the Branch Selection
3939 int getMachineOpValue(MachineInstr &MI, MachineOperand &MO);
4040
4141 public:
42 static const char ID;
42 static char ID;
4343 PPCCodeEmitter(TargetMachine &T, MachineCodeEmitter &M)
4444 : MachineFunctionPass((intptr_t)&ID), TM(T), MCE(M) {}
4545
6363 ///
6464 unsigned getBinaryCodeForInstr(MachineInstr &MI);
6565 };
66 const char PPCCodeEmitter::ID = 0;
66 char PPCCodeEmitter::ID = 0;
6767 }
6868
6969 /// createPPCCodeEmitterPass - Return a pass that emits the collected PPC code
2929 TargetMachine &TM;
3030 const TargetInstrInfo *TII;
3131
32 static const char ID;
32 static char ID;
3333 Filler(TargetMachine &tm)
3434 : MachineFunctionPass((intptr_t)&ID), TM(tm), TII(tm.getInstrInfo()) { }
3535
4747 }
4848
4949 };
50 const char Filler::ID = 0;
50 char Filler::ID = 0;
5151 } // end of anonymous namespace
5252
5353 /// createSparcDelaySlotFillerPass - Returns a pass that fills in delay
3131 ///
3232 TargetMachine &TM;
3333
34 static const char ID;
34 static char ID;
3535 FPMover(TargetMachine &tm)
3636 : MachineFunctionPass((intptr_t)&ID), TM(tm) { }
3737
4242 bool runOnMachineBasicBlock(MachineBasicBlock &MBB);
4343 bool runOnMachineFunction(MachineFunction &F);
4444 };
45 const char FPMover::ID = 0;
45 char FPMover::ID = 0;
4646 } // end of anonymous namespace
4747
4848 /// createSparcFPMoverPass - Returns a pass that turns FpMOVD
3434 // Register the default SparcV9 implementation...
3535 RegisterPass X("targetdata", "Target Data Layout");
3636 }
37 const char TargetData::ID = 0;
37 char TargetData::ID = 0;
3838
3939 //===----------------------------------------------------------------------===//
4040 // Support for StructLayout
3838 MachineCodeEmitter &MCE;
3939 bool Is64BitMode;
4040 public:
41 static const char ID;
41 static char ID;
4242 explicit Emitter(TargetMachine &tm, MachineCodeEmitter &mce)
4343 : MachineFunctionPass((intptr_t)&ID), II(0), TD(0), TM(tm),
4444 MCE(mce), Is64BitMode(false) {}
8181 bool isX86_64ExtendedReg(const MachineOperand &MO);
8282 unsigned determineREX(const MachineInstr &MI);
8383 };
84 const char Emitter::ID = 0;
84 char Emitter::ID = 0;
8585 }
8686
8787 /// createX86CodeEmitterPass - Return a pass that emits the collected X86 code
5151
5252 namespace {
5353 struct VISIBILITY_HIDDEN FPS : public MachineFunctionPass {
54 static const char ID;
54 static char ID;
5555 FPS() : MachineFunctionPass((intptr_t)&ID) {}
5656
5757 virtual bool runOnMachineFunction(MachineFunction &MF);
153153 void handleCondMovFP(MachineBasicBlock::iterator &I);
154154 void handleSpecialFP(MachineBasicBlock::iterator &I);
155155 };
156 const char FPS::ID = 0;
156 char FPS::ID = 0;
157157 }
158158
159159 FunctionPass *llvm::createX86FloatingPointStackifierPass() { return new FPS(); }
2424 namespace {
2525 // Hello - The first implementation, without getAnalysisUsage.
2626 struct Hello : public FunctionPass {
27 static const char ID; // Pass identifcation, replacement for typeid
27 static char ID; // Pass identifcation, replacement for typeid
2828 Hello() : FunctionPass((intptr_t)&ID) {}
2929
3030 virtual bool runOnFunction(Function &F) {
3636 }
3737 };
3838
39 const char Hello::ID = 0;
39 char Hello::ID = 0;
4040 RegisterPass X("hello", "Hello World Pass");
4141
4242 // Hello2 - The second implementation with getAnalysisUsage implemented.
4343 struct Hello2 : public FunctionPass {
44 static const char ID; // Pass identifcation, replacement for typeid
44 static char ID; // Pass identifcation, replacement for typeid
4545 Hello2() : FunctionPass((intptr_t)&ID) {}
4646
4747 virtual bool runOnFunction(Function &F) {
5757 AU.setPreservesAll();
5858 };
5959 };
60 const char Hello2::ID = 0;
60 char Hello2::ID = 0;
6161 RegisterPass Y("hello2",
6262 "Hello World Pass (with getAnalysisUsage implemented)");
6363 }
6262 }
6363
6464 virtual bool runOnSCC(const std::vector &SCC);
65 static const char ID; // Pass identifcation, replacement for typeid
65 static char ID; // Pass identifcation, replacement for typeid
6666 ArgPromotion() : CallGraphSCCPass((intptr_t)&ID) {}
6767
6868 private:
7171 Function *DoPromotion(Function *F, std::vector &ArgsToPromote);
7272 };
7373
74 const char ArgPromotion::ID = 0;
74 char ArgPromotion::ID = 0;
7575 RegisterPass X("argpromotion",
7676 "Promote 'by reference' arguments to scalars");
7777 }
2828
2929 namespace {
3030 struct VISIBILITY_HIDDEN ConstantMerge : public ModulePass {
31 static const char ID; // Pass identifcation, replacement for typeid
31 static char ID; // Pass identifcation, replacement for typeid
3232 ConstantMerge() : ModulePass((intptr_t)&ID) {}
3333
3434 // run - For this pass, process all of the globals in the module,
3737 bool runOnModule(Module &M);
3838 };
3939
40 const char ConstantMerge::ID = 0;
40 char ConstantMerge::ID = 0;
4141 RegisterPassX("constmerge","Merge Duplicate Global Constants");
4242 }
4343
7575 std::multimap CallSites;
7676
7777 public:
78 static const char ID; // Pass identifcation, replacement for typeid
78 static char ID; // Pass identifcation, replacement for typeid
7979 DAE() : ModulePass((intptr_t)&ID) {}
8080 bool runOnModule(Module &M);
8181
9494
9595 void RemoveDeadArgumentsFromFunction(Function *F);
9696 };
97 const char DAE::ID = 0;
97 char DAE::ID = 0;
9898 RegisterPass X("deadargelim", "Dead Argument Elimination");
9999
100100 /// DAH - DeadArgumentHacking pass - Same as dead argument elimination, but
101101 /// deletes arguments to functions which are external. This is only for use
102102 /// by bugpoint.
103103 struct DAH : public DAE {
104 static const char ID;
104 static char ID;
105105 virtual bool ShouldHackArguments() const { return true; }
106106 };
107 const char DAH::ID = 0;
107 char DAH::ID = 0;
108108 RegisterPass Y("deadarghaX0r",
109109 "Dead Argument Hacking (BUGPOINT USE ONLY; DO NOT USE)");
110110 }
2525
2626 namespace {
2727 struct VISIBILITY_HIDDEN DTE : public ModulePass {
28 static const char ID; // Pass identifcation, replacement for typeid
28 static char ID; // Pass identifcation, replacement for typeid
2929 DTE() : ModulePass((intptr_t)&ID) {}
3030
3131 // doPassInitialization - For this pass, it removes global symbol table
4242 AU.addRequired();
4343 }
4444 };
45 const char DTE::ID = 0;
45 char DTE::ID = 0;
4646 RegisterPass X("deadtypeelim", "Dead Type Elimination");
4747 }
4848
2424 bool deleteFunc;
2525 bool reLink;
2626 public:
27 static const char ID; // Pass identifcation, replacement for typeid
27 static char ID; // Pass identifcation, replacement for typeid
2828
2929 /// FunctionExtractorPass - If deleteFn is true, this pass deletes as the
3030 /// specified function. Otherwise, it deletes as much of the module as
133133 }
134134 };
135135
136 const char FunctionExtractorPass::ID = 0;
136 char FunctionExtractorPass::ID = 0;
137137 RegisterPass X("extract", "Function Extractor");
138138 }
139139
2929
3030 namespace {
3131 struct VISIBILITY_HIDDEN GlobalDCE : public ModulePass {
32 static const char ID; // Pass identifcation, replacement for typeid
32 static char ID; // Pass identifcation, replacement for typeid
3333 GlobalDCE() : ModulePass((intptr_t)&ID) {}
3434
3535 // run - Do the GlobalDCE pass on the specified module, optionally updating
4848 bool SafeToDestroyConstant(Constant* C);
4949 bool RemoveUnusedGlobalValue(GlobalValue &GV);
5050 };
51 const char GlobalDCE::ID = 0;
51 char GlobalDCE::ID = 0;
5252 RegisterPass X("globaldce", "Dead Global Elimination");
5353 }
5454
4949 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
5050 AU.addRequired();
5151 }
52 static const char ID; // Pass identifcation, replacement for typeid
52 static char ID; // Pass identifcation, replacement for typeid
5353 GlobalOpt() : ModulePass((intptr_t)&ID) {}
5454
5555 bool runOnModule(Module &M);
6262 bool ProcessInternalGlobal(GlobalVariable *GV,Module::global_iterator &GVI);
6363 };
6464
65 const char GlobalOpt::ID = 0;
65 char GlobalOpt::ID = 0;
6666 RegisterPass X("globalopt", "Global Variable Optimizer");
6767 }
6868
3232 /// IPCP - The interprocedural constant propagation pass
3333 ///
3434 struct VISIBILITY_HIDDEN IPCP : public ModulePass {
35 static const char ID; // Pass identifcation, replacement for typeid
35 static char ID; // Pass identifcation, replacement for typeid
3636 IPCP() : ModulePass((intptr_t)&ID) {}
3737
3838 bool runOnModule(Module &M);
4040 bool PropagateConstantsIntoArguments(Function &F);
4141 bool PropagateConstantReturn(Function &F);
4242 };
43 const char IPCP::ID = 0;
43 char IPCP::ID = 0;
4444 RegisterPass X("ipconstprop", "Interprocedural constant propagation");
4545 }
4646
3131 namespace {
3232 class VISIBILITY_HIDDEN IndMemRemPass : public ModulePass {
3333 public:
34 static const char ID; // Pass identifcation, replacement for typeid
34 static char ID; // Pass identifcation, replacement for typeid
3535 IndMemRemPass() : ModulePass((intptr_t)&ID) {}
3636
3737 virtual bool runOnModule(Module &M);
3838 };
39 const char IndMemRemPass::ID = 0;
39 char IndMemRemPass::ID = 0;
4040 RegisterPass X("indmemrem","Indirect Malloc and Free Removal");
4141 } // end anonymous namespace
4242
5353 class VISIBILITY_HIDDEN SimpleInliner : public Inliner {
5454 std::map CachedFunctionInfo;
5555 public:
56 static const char ID; // Pass identifcation, replacement for typeid
56 static char ID; // Pass identifcation, replacement for typeid
5757 int getInlineCost(CallSite CS);
5858 };
59 const char SimpleInliner::ID = 0;
59 char SimpleInliner::ID = 0;
6060 RegisterPass X("inline", "Function Integration/Inlining");
6161 }
6262
3535 cl::desc("Control the amount of inlining to perform (default = 200)"));
3636 }
3737
38 const char Inliner::ID = 0;
38 char Inliner::ID = 0;
3939 Inliner::Inliner()
4040 : CallGraphSCCPass((intptr_t)&ID), InlineThreshold(InlineLimit) {}
4141
2626 /// perform the inlining operations that does not depend on the policy.
2727 ///
2828 struct Inliner : public CallGraphSCCPass {
29 static const char ID;
29 static char ID;
3030 Inliner();
3131
3232 /// getAnalysisUsage - For this class, we declare that we require and preserve
4545 std::set ExternalNames;
4646 bool DontInternalize;
4747 public:
48 static const char ID; // Pass identifcation, replacement for typeid
48 static char ID; // Pass identifcation, replacement for typeid
4949 InternalizePass(bool InternalizeEverything = true);
5050 InternalizePass(const std::vector & exportList);
5151 void LoadFile(const char *Filename);
5252 virtual bool runOnModule(Module &M);
5353 };
54 const char InternalizePass::ID = 0;
54 char InternalizePass::ID = 0;
5555 RegisterPass X("internalize", "Internalize Global Symbols");
5656 } // end anonymous namespace
5757
3333 // Module passes to require FunctionPasses, so we can't get loop info if we're
3434 // not a function pass.
3535 struct VISIBILITY_HIDDEN LoopExtractor : public FunctionPass {
36 static const char ID; // Pass identifcation, replacement for typeid
36 static char ID; // Pass identifcation, replacement for typeid
3737 unsigned NumLoops;
3838
3939 LoopExtractor(unsigned numLoops = ~0)
5050 }
5151 };
5252
53 const char LoopExtractor::ID = 0;
53 char LoopExtractor::ID = 0;
5454 RegisterPass
5555 X("loop-extract", "Extract loops into new functions");
5656
5757 /// SingleLoopExtractor - For bugpoint.
5858 struct SingleLoopExtractor : public LoopExtractor {
59 static const char ID; // Pass identifcation, replacement for typeid
59 static char ID; // Pass identifcation, replacement for typeid
6060 SingleLoopExtractor() : LoopExtractor(1) {}
6161 };
6262
63 const char SingleLoopExtractor::ID = 0;
63 char SingleLoopExtractor::ID = 0;
6464 RegisterPass
6565 Y("loop-extract-single", "Extract at most one loop into a new function");
6666 } // End anonymous namespace
151151 class BlockExtractorPass : public ModulePass {
152152 std::vector BlocksToNotExtract;
153153 public:
154 static const char ID; // Pass identifcation, replacement for typeid
154 static char ID; // Pass identifcation, replacement for typeid
155155 BlockExtractorPass(std::vector &B)
156156 : ModulePass((intptr_t)&ID), BlocksToNotExtract(B) {}
157157 BlockExtractorPass() : ModulePass((intptr_t)&ID) {}
159159 bool runOnModule(Module &M);
160160 };
161161
162 const char BlockExtractorPass::ID = 0;
162 char BlockExtractorPass::ID = 0;
163163 RegisterPass
164164 XX("extract-blocks", "Extract Basic Blocks From Module (for bugpoint use)");
165165 }
108108
109109 bool IsTransformableFunction(const std::string& Name);
110110 public:
111 static const char ID; // Pass identifcation, replacement for typeid
111 static char ID; // Pass identifcation, replacement for typeid
112112 LowerSetJmp() : ModulePass((intptr_t)&ID) {}
113113
114114 void visitCallInst(CallInst& CI);
120120 bool doInitialization(Module& M);
121121 };
122122
123 const char LowerSetJmp::ID = 0;
123 char LowerSetJmp::ID = 0;
124124 RegisterPass X("lowersetjmp", "Lower Set Jump");
125125 } // end anonymous namespace
126126
3434
3535 namespace {
3636 struct VISIBILITY_HIDDEN PruneEH : public CallGraphSCCPass {
37 static const char ID; // Pass identifcation, replacement for typeid
37 static char ID; // Pass identifcation, replacement for typeid
3838 PruneEH() : CallGraphSCCPass((intptr_t)&ID) {}
3939
4040 /// DoesNotUnwind - This set contains all of the functions which we have
5252 void DeleteBasicBlock(BasicBlock *BB);
5353 };
5454
55 const char PruneEH::ID = 0;
55 char PruneEH::ID = 0;
5656 RegisterPass X("prune-eh", "Remove unused exception handling info");
5757 }
5858
3434 Function *MallocFunc; // Functions in the module we are processing
3535 Function *FreeFunc; // Initialized by doPassInitializationVirt
3636 public:
37 static const char ID; // Pass identifcation, replacement for typeid
37 static char ID; // Pass identifcation, replacement for typeid
3838 RaiseAllocations()
3939 : ModulePass((intptr_t)&ID), MallocFunc(0), FreeFunc(0) {}
4040
4848 bool runOnModule(Module &M);
4949 };
5050
51 const char RaiseAllocations::ID = 0;
51 char RaiseAllocations::ID = 0;
5252 RegisterPass
5353 X("raiseallocs", "Raise allocations from calls to instructions");
5454 } // end anonymous namespace
151151 /// @brief A ModulePass for optimizing well-known function calls.
152152 class VISIBILITY_HIDDEN SimplifyLibCalls : public ModulePass {
153153 public:
154 static const char ID; // Pass identifcation, replacement for typeid
154 static char ID; // Pass identifcation, replacement for typeid
155155 SimplifyLibCalls() : ModulePass((intptr_t)&ID) {}
156156
157157 /// We need some target data for accurate signature details that are
375375 TargetData *TD; ///< Cached TargetData
376376 };
377377
378 const char SimplifyLibCalls::ID = 0;
378 char SimplifyLibCalls::ID = 0;
379379 // Register the pass
380380 RegisterPass
381381 X("simplify-libcalls", "Simplify well-known library calls");
2626 /// @brief Pass to remove unused function declarations.
2727 class VISIBILITY_HIDDEN StripDeadPrototypesPass : public ModulePass {
2828 public:
29 static const char ID; // Pass identifcation, replacement for typeid
29 static char ID; // Pass identifcation, replacement for typeid
3030 StripDeadPrototypesPass() : ModulePass((intptr_t)&ID) { }
3131 virtual bool runOnModule(Module &M);
3232 };
3333
34 const char StripDeadPrototypesPass::ID = 0;
34 char StripDeadPrototypesPass::ID = 0;
3535 RegisterPass X("strip-dead-prototypes",
3636 "Strip Unused Function Prototypes");
3737
3636 class VISIBILITY_HIDDEN StripSymbols : public ModulePass {
3737 bool OnlyDebugInfo;
3838 public:
39 static const char ID; // Pass identifcation, replacement for typeid
39 static char ID; // Pass identifcation, replacement for typeid
4040 StripSymbols(bool ODI = false)
4141 : ModulePass((intptr_t)&ID), OnlyDebugInfo(ODI) {}
4242
4747 }
4848 };
4949
50 const char StripSymbols::ID = 0;
50 char StripSymbols::ID = 0;
5151 RegisterPass X("strip", "Strip all symbols from a module");
5252 }
5353
3232 namespace {
3333 class VISIBILITY_HIDDEN FunctionProfiler : public RSProfilers_std {
3434 public:
35 static const char ID;
35 static char ID;
3636 bool runOnModule(Module &M);
3737 };
3838
39 const char FunctionProfiler::ID = 0;
39 char FunctionProfiler::ID = 0;
4040
4141 RegisterPass X("insert-function-profiling",
4242 "Insert instrumentation for function profiling");
8383 class BlockProfiler : public RSProfilers_std {
8484 bool runOnModule(Module &M);
8585 public:
86 static const char ID;
86 static char ID;
8787 };
8888
89 const char BlockProfiler::ID = 0;
89 char BlockProfiler::ID = 0;
9090 RegisterPass Y("insert-block-profiling",
9191 "Insert instrumentation for block profiling");
9292 RegisterAnalysisGroup YG(Y);
3232 class VISIBILITY_HIDDEN EdgeProfiler : public ModulePass {
3333 bool runOnModule(Module &M);
3434 public:
35 static const char ID; // Pass identifcation, replacement for typeid
35 static char ID; // Pass identifcation, replacement for typeid
3636 EdgeProfiler() : ModulePass((intptr_t)&ID) {}
3737 };
3838
39 const char EdgeProfiler::ID = 0;
39 char EdgeProfiler::ID = 0;
4040 RegisterPass X("insert-edge-profiling",
4141 "Insert instrumentation for edge profiling");
4242 }
6868 /// measuring framework overhead
6969 class VISIBILITY_HIDDEN NullProfilerRS : public RSProfilers {
7070 public:
71 static const char ID; // Pass identifcation, replacement for typeid
71 static char ID; // Pass identifcation, replacement for typeid
7272 bool isProfiling(Value* v) {
7373 return false;
7474 }
138138
139139 /// ProfilerRS - Insert the random sampling framework
140140 struct VISIBILITY_HIDDEN ProfilerRS : public FunctionPass {
141 static const char ID; // Pass identifcation, replacement for typeid
141 static char ID; // Pass identifcation, replacement for typeid
142142 ProfilerRS() : FunctionPass((intptr_t)&ID) {}
143143
144144 std::map TransCache;
161161 "Insert random sampling instrumentation framework");
162162 }
163163
164 const char RSProfilers::ID = 0;
165 const char NullProfilerRS::ID = 0;
166 const char ProfilerRS::ID = 0;
164 char RSProfilers::ID = 0;
165 char NullProfilerRS::ID = 0;
166 char ProfilerRS::ID = 0;
167167
168168 //Local utilities
169169 static void ReplacePhiPred(BasicBlock* btarget,
1616 /// RSProfilers_std - a simple support class for profilers that handles most
1717 /// of the work of chaining and tracking inserted code.
1818 struct RSProfilers_std : public RSProfilers {
19 static const char ID;
19 static char ID;
2020 std::set profcode;
2121 // Lookup up values in profcode
2222 virtual bool isProfiling(Value* v);
5151 // The public interface for this class
5252 //
5353 public:
54 static const char ID; // Pass identifcation, replacement for typeid
54 static char ID; // Pass identifcation, replacement for typeid
5555 ADCE() : FunctionPass((intptr_t)&ID) {}
5656
5757 // Execute the Aggressive Dead Code Elimination Algorithm
106106 }
107107 };
108108
109 const char ADCE::ID = 0;
109 char ADCE::ID = 0;
110110 RegisterPass X("adce", "Aggressive Dead Code Elimination");
111111 } // End of anonymous namespace
112112
4040
4141 namespace {
4242 struct VISIBILITY_HIDDEN BlockPlacement : public FunctionPass {
43 static const char ID; // Pass identifcation, replacement for typeid
43 static char ID; // Pass identifcation, replacement for typeid
4444 BlockPlacement() : FunctionPass((intptr_t)&ID) {}
4545
4646 virtual bool runOnFunction(Function &F);
7272 void PlaceBlocks(BasicBlock *BB);
7373 };
7474
75 const char BlockPlacement::ID = 0;
75 char BlockPlacement::ID = 0;
7676 RegisterPass X("block-placement",
7777 "Profile Guided Basic Block Placement");
7878 }
3838 /// transformation profitability.
3939 const TargetLowering *TLI;
4040 public:
41 static const char ID; // Pass identifcation, replacement for typeid
41 static char ID; // Pass identifcation, replacement for typeid
4242 CodeGenPrepare(const TargetLowering *tli = 0) : FunctionPass((intptr_t)&ID),
4343 TLI(tli) {}
4444 bool runOnFunction(Function &F);
5454 };
5555 }
5656
57 const char CodeGenPrepare::ID = 0;
57 char CodeGenPrepare::ID = 0;
5858 static RegisterPass X("codegenprepare",
5959 "Optimize for code generation");
6060
3030
3131 namespace {
3232 struct VISIBILITY_HIDDEN CondProp : public FunctionPass {
33 static const char ID; // Pass identifcation, replacement for typeid
33 static char ID; // Pass identifcation, replacement for typeid
3434 CondProp() : FunctionPass((intptr_t)&ID) {}
3535
3636 virtual bool runOnFunction(Function &F);
4848 void RevectorBlockTo(BasicBlock *FromBB, BasicBlock *ToBB);
4949 };
5050
51 const char CondProp::ID = 0;
51 char CondProp::ID = 0;
5252 RegisterPass X("condprop", "Conditional Propagation");
5353 }
5454
3333
3434 namespace {
3535 struct VISIBILITY_HIDDEN ConstantPropagation : public FunctionPass {
36 static const char ID; // Pass identifcation, replacement for typeid
36 static char ID; // Pass identifcation, replacement for typeid
3737 ConstantPropagation() : FunctionPass((intptr_t)&ID) {}
3838
3939 bool runOnFunction(Function &F);
4343 }
4444 };
4545
46 const char ConstantPropagation::ID = 0;
46 char ConstantPropagation::ID = 0;
4747 RegisterPass X("constprop",
4848 "Simple constant propagation");
4949 }
224224 std::map RegionInfoMap;
225225 ETForest *EF;
226226 public:
227 static const char ID; // Pass identifcation, replacement for typeid
227 static char ID; // Pass identifcation, replacement for typeid
228228 CEE() : FunctionPass((intptr_t)&ID) {}
229229
230230 virtual bool runOnFunction(Function &F);
287287 bool SimplifyInstruction(Instruction *Inst, const RegionInfo &RI);
288288 };
289289
290 const char CEE::ID = 0;
290 char CEE::ID = 0;
291291 RegisterPass X("cee", "Correlated Expression Elimination");
292292 }
293293
3434 // DeadInstElimination pass implementation
3535 //
3636 struct VISIBILITY_HIDDEN DeadInstElimination : public BasicBlockPass {
37 static const char ID; // Pass identifcation, replacement for typeid
37 static char ID; // Pass identifcation, replacement for typeid
3838 DeadInstElimination() : BasicBlockPass(intptr_t(&ID)) {}
3939 virtual bool runOnBasicBlock(BasicBlock &BB) {
4040 bool Changed = false;
5252 }
5353 };
5454
55 const char DeadInstElimination::ID = 0;
55 char DeadInstElimination::ID = 0;
5656 RegisterPass X("die", "Dead Instruction Elimination");
5757 }
5858
6666 // DeadCodeElimination pass implementation
6767 //
6868 struct DCE : public FunctionPass {
69 static const char ID; // Pass identifcation, replacement for typeid
69 static char ID; // Pass identifcation, replacement for typeid
7070 DCE() : FunctionPass((intptr_t)&ID) {}
7171
7272 virtual bool runOnFunction(Function &F);
7676 }
7777 };
7878
79 const char DCE::ID = 0;
79 char DCE::ID = 0;
8080 RegisterPass Y("dce", "Dead Code Elimination");
8181 }
8282
3333
3434 namespace {
3535 struct VISIBILITY_HIDDEN DSE : public FunctionPass {
36 static const char ID; // Pass identifcation, replacement for typeid
36 static char ID; // Pass identifcation, replacement for typeid
3737 DSE() : FunctionPass((intptr_t)&ID) {}
3838
3939 virtual bool runOnFunction(Function &F) {
5757 AU.addPreserved();
5858 }
5959 };
60 const char DSE::ID = 0;
60 char DSE::ID = 0;
6161 RegisterPass X("dse", "Dead Store Elimination");
6262 }
6363
3636 "with constant values");
3737 namespace {
3838 struct VISIBILITY_HIDDEN GCSE : public FunctionPass {
39 static const char ID; // Pass identifcation, replacement for typeid
39 static char ID; // Pass identifcation, replacement for typeid
4040 GCSE() : FunctionPass((intptr_t)&ID) {}
4141
4242 virtual bool runOnFunction(Function &F);
5353 }
5454 };
5555
56 const char GCSE::ID = 0;
56 char GCSE::ID = 0;
5757 RegisterPass X("gcse", "Global Common Subexpression Elimination");
5858 }
5959
6868 bool Changed;
6969 public:
7070
71 static const char ID; // Pass identifcation, replacement for typeid
71 static char ID; // Pass identifcation, replacement for typeid
7272 IndVarSimplify() : LoopPass((intptr_t)&ID) {}
7373
7474 bool runOnLoop(Loop *L, LPPassManager &LPM);
9494 void DeleteTriviallyDeadInstructions(std::set &Insts);
9595 };
9696
97 const char IndVarSimplify::ID = 0;
97 char IndVarSimplify::ID = 0;
9898 RegisterPass X("indvars", "Canonicalize Induction Variables");
9999 }
100100
7575 TargetData *TD;
7676 bool MustPreserveLCSSA;
7777 public:
78 static const char ID; // Pass identifcation, replacement for typeid
78 static char ID; // Pass identifcation, replacement for typeid
7979 InstCombiner() : FunctionPass((intptr_t)&ID) {}
8080
8181 /// AddToWorkList - Add the specified instruction to the worklist if it
360360 Value *EvaluateInDifferentType(Value *V, const Type *Ty, bool isSigned);
361361 };
362362
363 const char InstCombiner::ID = 0;
363 char InstCombiner::ID = 0;
364364 RegisterPass X("instcombine", "Combine redundant instructions");
365365 }
366366
6262 cl::desc("Disable memory promotion in LICM pass"));
6363
6464 struct VISIBILITY_HIDDEN LICM : public LoopPass {
65 static const char ID; // Pass identifcation, replacement for typeid
65 static char ID; // Pass identifcation, replacement for typeid
6666 LICM() : LoopPass((intptr_t)&ID) {}
6767
6868 virtual bool runOnLoop(Loop *L, LPPassManager &LPM);
203203 std::map &Val2AlMap);
204204 };
205205
206 const char LICM::ID = 0;
206 char LICM::ID = 0;
207207 RegisterPass X("licm", "Loop Invariant Code Motion");
208208 }
209209
4343 class VISIBILITY_HIDDEN LoopRotate : public LoopPass {
4444
4545 public:
46 static const char ID; // Pass ID, replacement for typeid
46 static char ID; // Pass ID, replacement for typeid
4747 LoopRotate() : LoopPass((intptr_t)&ID) {}
4848
4949 // Rotate Loop L as many times as possible. Return true if
9393 SmallVector LoopHeaderInfo;
9494 };
9595
96 const char LoopRotate::ID = 0;
96 char LoopRotate::ID = 0;
9797 RegisterPass X ("loop-rotate", "Rotate Loops");
9898 }
9999
142142 const TargetLowering *TLI;
143143
144144 public:
145 static const char ID; // Pass ID, replacement for typeid
145 static char ID; // Pass ID, replacement for typeid
146146 LoopStrengthReduce(const TargetLowering *tli = NULL) :
147147 LoopPass((intptr_t)&ID), TLI(tli) {
148148 }
187187 Loop *L, bool isOnlyStride);
188188 void DeleteTriviallyDeadInstructions(std::set &Insts);
189189 };
190 const char LoopStrengthReduce::ID = 0;
190 char LoopStrengthReduce::ID = 0;
191191 RegisterPass X("loop-reduce", "Loop Strength Reduction");
192192 }
193193
4848 class VISIBILITY_HIDDEN LoopUnroll : public LoopPass {
4949 LoopInfo *LI; // The current loop information
5050 public:
51 static const char ID; // Pass ID, replacement for typeid
51 static char ID; // Pass ID, replacement for typeid
5252 LoopUnroll() : LoopPass((intptr_t)&ID) {}
5353
5454 bool runOnLoop(Loop *L, LPPassManager &LPM);
6565 AU.addPreserved();
6666 }
6767 };
68 const char LoopUnroll::ID = 0;
68 char LoopUnroll::ID = 0;
6969 RegisterPass X("loop-unroll", "Unroll loops");
7070 }
7171
6868 SmallPtrSet UnswitchedVals;
6969
7070 public:
71 static const char ID; // Pass ID, replacement for typeid
71 static char ID; // Pass ID, replacement for typeid
7272 LoopUnswitch() : LoopPass((intptr_t)&ID) {}
7373
7474 bool runOnLoop(Loop *L, LPPassManager &LPM);
111111 std::vector &Worklist);
112112 void RemoveLoopFromHierarchy(Loop *L);
113113 };
114 const char LoopUnswitch::ID = 0;
114 char LoopUnswitch::ID = 0;
115115 RegisterPass X("loop-unswitch", "Unswitch loops");
116116 }
117117
4646 /// had zero roots.
4747 const Type *MainRootRecordType;
4848 public:
49 static const char ID; // Pass identifcation, replacement for typeid
49 static char ID; // Pass identifcation, replacement for typeid
5050 LowerGC() : FunctionPass((intptr_t)&ID),
5151 GCRootInt(0), GCReadInt(0), GCWriteInt(0),
5252 GCRead(0), GCWrite(0), RootChain(0), MainRootRecordType(0) {}
5757 const StructType *getRootRecordType(unsigned NumRoots);
5858 };
5959
60 const char LowerGC::ID = 0;
60 char LowerGC::ID = 0;
6161 RegisterPass
6262 X("lowergc", "Lower GC intrinsics, for GCless code generators");
6363 }
3939 class VISIBILITY_HIDDEN LowerPacked
4040 : public FunctionPass, public InstVisitor {
4141 public:
42 static const char ID; // Pass identifcation, replacement for typeid
42 static char ID; // Pass identifcation, replacement for typeid
4343 LowerPacked() : FunctionPass((intptr_t)&ID) {}
4444
4545 /// @brief Lowers packed operations to scalar operations.
106106 std::vector instrsToRemove;
107107 };
108108
109 const char LowerPacked::ID = 0;
109 char LowerPacked::ID = 0;
110110 RegisterPass
111111 X("lower-packed",
112112 "lowers packed operations to operations on smaller packed datatypes");
19881988 std::vector WorkList;
19891989
19901990 public:
1991 static const char ID; // Pass identifcation, replacement for typeid
1991 static char ID; // Pass identifcation, replacement for typeid
19921992 PredicateSimplifier() : FunctionPass((intptr_t)&ID) {}
19931993
19941994 bool runOnFunction(Function &F);
23762376 }
23772377 }
23782378
2379 const char PredicateSimplifier::ID = 0;
2379 char PredicateSimplifier::ID = 0;
23802380 RegisterPass X("predsimplify",
23812381 "Predicate Simplifier");
23822382 }
6868 std::map ValueRankMap;
6969 bool MadeChange;
7070 public:
71 static const char ID; // Pass identifcation, replacement for typeid
71 static char ID; // Pass identifcation, replacement for typeid
7272 Reassociate() : FunctionPass((intptr_t)&ID) {}
7373
7474 bool runOnFunction(Function &F);
9191 void RemoveDeadBinaryOp(Value *V);
9292 };
9393
94 const char Reassociate::ID = 0;
94 char Reassociate::ID = 0;
9595 RegisterPass X("reassociate", "Reassociate expressions");
9696 }
9797
3232
3333 namespace {
3434 struct VISIBILITY_HIDDEN RegToMem : public FunctionPass {
35 static const char ID; // Pass identifcation, replacement for typeid
35 static char ID; // Pass identifcation, replacement for typeid
3636 RegToMem() : FunctionPass((intptr_t)&ID) {}
3737
3838 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
7777 }
7878 };
7979
80 const char RegToMem::ID = 0;
80 char RegToMem::ID = 0;
8181 RegisterPass X("reg2mem", "Demote all values to stack slots");
8282 }
8383
13331333 /// Sparse Conditional Constant Propagator.
13341334 ///
13351335 struct VISIBILITY_HIDDEN SCCP : public FunctionPass {
1336 static const char ID; // Pass identifcation, replacement for typeid
1336 static char ID; // Pass identifcation, replacement for typeid
13371337 SCCP() : FunctionPass((intptr_t)&ID) {}
13381338
13391339 // runOnFunction - Run the Sparse Conditional Constant Propagation
13461346 }
13471347 };
13481348
1349 const char SCCP::ID = 0;
1349 char SCCP::ID = 0;
13501350 RegisterPass X("sccp", "Sparse Conditional Constant Propagation");
13511351 } // end anonymous namespace
13521352
14461446 /// Constant Propagation.
14471447 ///
14481448 struct VISIBILITY_HIDDEN IPSCCP : public ModulePass {
1449 static const char ID;
1449 static char ID;
14501450 IPSCCP() : ModulePass((intptr_t)&ID) {}
14511451 bool runOnModule(Module &M);
14521452 };
14531453
1454 const char IPSCCP::ID = 0;
1454 char IPSCCP::ID = 0;
14551455 RegisterPass
14561456 Y("ipsccp", "Interprocedural Sparse Conditional Constant Propagation");
14571457 } // end anonymous namespace
4646
4747 namespace {
4848 struct VISIBILITY_HIDDEN SROA : public FunctionPass {
49 static const char ID; // Pass identifcation, replacement for typeid
49 static char ID; // Pass identifcation, replacement for typeid
5050 SROA() : FunctionPass((intptr_t)&ID) {}
5151
5252 bool runOnFunction(Function &F);
8383 static Instruction *isOnlyCopiedFromConstantGlobal(AllocationInst *AI);
8484 };
8585
86 const char SROA::ID = 0;
86 char SROA::ID = 0;
8787 RegisterPass X("scalarrepl", "Scalar Replacement of Aggregates");
8888 }
8989
3434
3535 namespace {
3636 struct VISIBILITY_HIDDEN CFGSimplifyPass : public FunctionPass {
37 static const char ID; // Pass identifcation, replacement for typeid
37 static char ID; // Pass identifcation, replacement for typeid
3838 CFGSimplifyPass() : FunctionPass((intptr_t)&ID) {}
3939
4040 virtual bool runOnFunction(Function &F);
4141 };
42 const char CFGSimplifyPass::ID = 0;
42 char CFGSimplifyPass::ID = 0;
4343 RegisterPass X("simplifycfg", "Simplify the CFG");
4444 }
4545
4242 class VISIBILITY_HIDDEN TailDup : public FunctionPass {
4343 bool runOnFunction(Function &F);
4444 public:
45 static const char ID; // Pass identifcation, replacement for typeid
45 static char ID; // Pass identifcation, replacement for typeid
4646 TailDup() : FunctionPass((intptr_t)&ID) {}
4747
4848 private:
4949 inline bool shouldEliminateUnconditionalBranch(TerminatorInst *TI);
5050 inline void eliminateUnconditionalBranch(BranchInst *BI);
5151 };
52 const char TailDup::ID = 0;
52 char TailDup::ID = 0;
5353 RegisterPass X("tailduplicate", "Tail Duplication");
5454 }
5555
6666
6767 namespace {
6868 struct VISIBILITY_HIDDEN TailCallElim : public FunctionPass {
69 static const char ID; // Pass identifcation, replacement for typeid
69 static char ID; // Pass identifcation, replacement for typeid
7070 TailCallElim() : FunctionPass((intptr_t)&ID) {}
7171
7272 virtual bool runOnFunction(Function &F);
7979 bool CanMoveAboveCall(Instruction *I, CallInst *CI);
8080 Value *CanTransformAccumulatorRecursion(Instruction *I, CallInst *CI);
8181 };
82 const char TailCallElim::ID = 0;
82 char TailCallElim::ID = 0;
8383 RegisterPass X("tailcallelim", "Tail Call Elimination");
8484 }
8585
3333
3434 namespace {
3535 struct VISIBILITY_HIDDEN BreakCriticalEdges : public FunctionPass {
36 static const char ID; // Pass identifcation, replacement for typeid
36 static char ID; // Pass identifcation, replacement for typeid
3737 BreakCriticalEdges() : FunctionPass((intptr_t)&ID) {}
3838
3939 virtual bool runOnFunction(Function &F);
4949 }
5050 };
5151
52 const char BreakCriticalEdges::ID = 0;
52 char BreakCriticalEdges::ID = 0;
5353 RegisterPass X("break-crit-edges",
5454 "Break critical edges in CFG");
5555 }
4646
4747 namespace {
4848 struct VISIBILITY_HIDDEN LCSSA : public FunctionPass {
49 static const char ID; // Pass identifcation, replacement for typeid
49 static char ID; // Pass identifcation, replacement for typeid
5050 LCSSA() : FunctionPass((intptr_t)&ID) {}
5151
5252 // Cached analysis information for the current function.
8383 }
8484 };
8585
86 const char LCSSA::ID = 0;
86 char LCSSA::ID = 0;
8787 RegisterPass X("lcssa", "Loop-Closed SSA Form Pass");
8888 }
8989
5353
5454 namespace {
5555 struct VISIBILITY_HIDDEN LoopSimplify : public FunctionPass {
56 static const char ID; // Pass identifcation, replacement for typeid
56 static char ID; // Pass identifcation, replacement for typeid
5757 LoopSimplify() : FunctionPass((intptr_t)&ID) {}
5858
5959 // AA - If we have an alias analysis object to update, this is it, otherwise
9191 std::vector &PredBlocks);
9292 };
9393
94 const char LoopSimplify::ID = 0;
94 char LoopSimplify::ID = 0;
9595 RegisterPass
9696 X("loopsimplify", "Canonicalize natural loops", true);
9797 }
3535 Constant *FreeFunc; // Initialized by doInitialization
3636 bool LowerMallocArgToInteger;
3737 public:
38 static const char ID; // Pass ID, replacement for typeid
38 static char ID; // Pass ID, replacement for typeid
3939 LowerAllocations(bool LowerToInt = false)
4040 : BasicBlockPass((intptr_t)&ID), MallocFunc(0), FreeFunc(0),
4141 LowerMallocArgToInteger(LowerToInt) {}
6767 bool runOnBasicBlock(BasicBlock &BB);
6868 };
6969
70 const char LowerAllocations::ID = 0;
70 char LowerAllocations::ID = 0;
7171 RegisterPass
7272 X("lowerallocs", "Lower allocations from instructions to calls");
7373 }
7474 const TargetLowering *TLI;
7575
7676 public:
77 static const char ID; // Pass identifcation, replacement for typeid
77 static char ID; // Pass identifcation, replacement for typeid
7878 LowerInvoke(const TargetLowering *tli = NULL) : FunctionPass((intptr_t)&ID),
7979 TLI(tli) { }
8080 bool doInitialization(Module &M);
9898 bool insertExpensiveEHSupport(Function &F);
9999 };
100100
101 const char LowerInvoke::ID = 0;
101 char LowerInvoke::ID = 0;
102102 RegisterPass
103103 X("lowerinvoke", "Lower invoke and unwind, for unwindless code generators");
104104 }
3232 class VISIBILITY_HIDDEN LowerSelect : public FunctionPass {
3333 bool OnlyFP; // Only lower FP select instructions?
3434 public:
35 static const char ID; // Pass identifcation, replacement for typeid
35 static char ID; // Pass identifcation, replacement for typeid
3636 LowerSelect(bool onlyfp = false) : FunctionPass((intptr_t)&ID),
3737 OnlyFP(onlyfp) {}
3838
4949 bool runOnFunction(Function &F);
5050 };
5151
52 const char LowerSelect::ID = 0;
52 char LowerSelect::ID = 0;
5353 RegisterPass
5454 X("lowerselect", "Lower select instructions to branches");
5555 }
2929 /// modifies the CFG!
3030 class VISIBILITY_HIDDEN LowerSwitch : public FunctionPass {
3131 public:
32 static const char ID; // Pass identifcation, replacement for typeid
32 static char ID; // Pass identifcation, replacement for typeid
3333 LowerSwitch() : FunctionPass((intptr_t) &ID) {}
3434
3535 virtual bool runOnFunction(Function &F);
7777 }
7878 };
7979
80 const char LowerSwitch::ID = 0;
80 char LowerSwitch::ID = 0;
8181 RegisterPass
8282 X("lowerswitch", "Lower SwitchInst's to branches");
8383 }
2626
2727 namespace {
2828 struct VISIBILITY_HIDDEN PromotePass : public FunctionPass {
29 static const char ID; // Pass identifcation, replacement for typeid
29 static char ID; // Pass identifcation, replacement for typeid
3030 PromotePass() : FunctionPass((intptr_t)&ID) {}
3131
3232 // runOnFunction - To run this pass, first we calculate the alloca
4949 }
5050 };
5151
52 const char PromotePass::ID = 0;
52 char PromotePass::ID = 0;
5353 RegisterPass X("mem2reg", "Promote Memory to Register");
5454 } // end of anonymous namespace
5555
2121 #include "llvm/Type.h"
2222 using namespace llvm;
2323
24 const char UnifyFunctionExitNodes::ID = 0;
24 char UnifyFunctionExitNodes::ID = 0;
2525 static RegisterPass
2626 X("mergereturn", "Unify function exit nodes");
2727
134134
135135 } // end namespace llvm
136136
137 const char PrintModulePass::ID = 0;
137 char PrintModulePass::ID = 0;
138138 static RegisterPass
139139 X("printm", "Print module to stderr");
140 const char PrintFunctionPass::ID = 0;
140 char PrintFunctionPass::ID = 0;
141141 static RegisterPass
142142 Y("print","Print function to stderr");
143143
5757 //
5858 //===----------------------------------------------------------------------===//
5959
60 const char DominatorTree::ID = 0;
60 char DominatorTree::ID = 0;
6161 static RegisterPass
6262 E("domtree", "Dominator Tree Construction", true);
6363
353353 // DominanceFrontier Implementation
354354 //===----------------------------------------------------------------------===//
355355
356 const char DominanceFrontier::ID = 0;
356 char DominanceFrontier::ID = 0;
357357 static RegisterPass
358358 G("domfrontier", "Dominance Frontier Construction", true);
359359
834834 // ETForest implementation
835835 //===----------------------------------------------------------------------===//
836836
837 const char ETForest::ID = 0;
837 char ETForest::ID = 0;
838838 static RegisterPass
839839 D("etforest", "ET Forest Construction", true);
840840
6262 public FunctionPass {
6363
6464 public:
65 static const char ID;
65 static char ID;
6666 BBPassManager(int Depth)
6767 : PMDataManager(Depth), FunctionPass((intptr_t)&ID) {}
6868
105105 }
106106 };
107107
108 const char BBPassManager::ID = 0;
108 char BBPassManager::ID = 0;
109109 }
110110
111111 namespace llvm {
118118 public PMDataManager,
119119 public PMTopLevelManager {
120120 public:
121 static const char ID;
121 static char ID;
122122 FunctionPassManagerImpl(int Depth) :
123123 Pass((intptr_t)&ID), PMDataManager(Depth),
124124 PMTopLevelManager(TLM_Function) { }
172172 }
173173 };
174174
175 const char FunctionPassManagerImpl::ID = 0;
175 char FunctionPassManagerImpl::ID = 0;
176176 //===----------------------------------------------------------------------===//
177177 // MPPassManager
178178 //
182182 class MPPassManager : public Pass, public PMDataManager {
183183
184184 public:
185 static const char ID;
185 static char ID;
186186 MPPassManager(int Depth) : Pass((intptr_t)&ID), PMDataManager(Depth) { }
187187
188188 // Delete on the fly managers.
246246 std::map OnTheFlyManagers;
247247 };
248248
249 const char MPPassManager::ID = 0;
249 char MPPassManager::ID = 0;
250250 //===----------------------------------------------------------------------===//
251251 // PassManagerImpl
252252 //
257257 public PMTopLevelManager {
258258
259259 public:
260 static const char ID;
260 static char ID;
261261 PassManagerImpl(int Depth) : Pass((intptr_t)&ID), PMDataManager(Depth),
262262 PMTopLevelManager(TLM_Pass) { }
263263
303303
304304 };
305305
306 const char PassManagerImpl::ID = 0;
306 char PassManagerImpl::ID = 0;
307307 } // End of llvm namespace
308308
309309 namespace {
11071107 //===----------------------------------------------------------------------===//
11081108 // FPPassManager implementation
11091109
1110 const char FPPassManager::ID = 0;
1110 char FPPassManager::ID = 0;
11111111 /// Print passes managed by this manager
11121112 void FPPassManager::dumpPassStructure(unsigned Offset) {
11131113 llvm::cerr << std::string(Offset*2, ' ') << "FunctionPass Manager\n";
6868
6969 struct VISIBILITY_HIDDEN
7070 Verifier : public FunctionPass, InstVisitor {
71 static const char ID; // Pass ID, replacement for typeid
71 static char ID; // Pass ID, replacement for typeid
7272 bool Broken; // Is this module found to be broken?
7373 bool RealPass; // Are we not being run by a PassManager?
7474 VerifierFailureAction action;
265265 }
266266 };
267267
268 const char Verifier::ID = 0;
268 char Verifier::ID = 0;
269269 RegisterPass X("verify", "Module Verifier");
270270 } // End anonymous namespace
271271
305305 class BlockExtractorPass : public ModulePass {
306306 bool runOnModule(Module &M);
307307 public:
308 static const char ID; // Pass ID, replacement for typeid
308 static char ID; // Pass ID, replacement for typeid
309309 BlockExtractorPass() : ModulePass((intptr_t)&ID) {}
310310 };
311 const char BlockExtractorPass::ID = 0;
311 char BlockExtractorPass::ID = 0;
312312 RegisterPass
313313 XX("extract-bbs", "Extract Basic Blocks From Module (for bugpoint use)");
314314 }
2525 /// crashes on any call instructions.
2626 class CrashOnCalls : public BasicBlockPass {
2727 public:
28 static const char ID; // Pass ID, replacement for typeid
28 static char ID; // Pass ID, replacement for typeid
2929 CrashOnCalls() : BasicBlockPass((intptr_t)&ID) {}
3030 private:
3131 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
4141 }
4242 };
4343
44 const char CrashOnCalls::ID = 0;
44 char CrashOnCalls::ID = 0;
4545 RegisterPass
4646 X("bugpoint-crashcalls",
4747 "BugPoint Test Pass - Intentionally crash on CallInsts");
5252 /// deletes some call instructions, "misoptimizing" the program.
5353 class DeleteCalls : public BasicBlockPass {
5454 public:
55 static const char ID; // Pass ID, replacement for typeid
55 static char ID; // Pass ID, replacement for typeid
5656 DeleteCalls() : BasicBlockPass((intptr_t)&ID) {}
5757 private:
5858 bool runOnBasicBlock(BasicBlock &BB) {
6767 }
6868 };
6969
70 const char DeleteCalls::ID = 0;
70 char DeleteCalls::ID = 0;
7171 RegisterPass
7272 Y("bugpoint-deletecalls",
7373 "BugPoint Test Pass - Intentionally 'misoptimize' CallInsts");
2929 /// useful when looking for standard library functions we should constant fold
3030 /// or handle in alias analyses.
3131 struct ExternalFunctionsPassedConstants : public ModulePass {
32 static const char ID; // Pass ID, replacement for typeid
32 static char ID; // Pass ID, replacement for typeid
3333 ExternalFunctionsPassedConstants() : ModulePass((intptr_t)&ID) {}
3434 virtual bool runOnModule(Module &M) {
3535 for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
6262 }
6363 };
6464
65 const char ExternalFunctionsPassedConstants::ID = 0;
65 char ExternalFunctionsPassedConstants::ID = 0;
6666 RegisterPass
6767 P1("externalfnconstants", "Print external fn callsites passed constants");
6868
6969 struct CallGraphPrinter : public ModulePass {
70 static const char ID; // Pass ID, replacement for typeid
70 static char ID; // Pass ID, replacement for typeid
7171 CallGraphPrinter() : ModulePass((intptr_t)&ID) {}
7272
7373 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
8181 }
8282 };
8383
84 const char CallGraphPrinter::ID = 0;
84 char CallGraphPrinter::ID = 0;
8585 RegisterPass
8686 P2("callgraph", "Print a call graph");
8787 }
5959
6060 namespace {
6161 struct CallGraphPrinter : public ModulePass {
62 static const char ID; // Pass ID, replacement for typeid
62 static char ID; // Pass ID, replacement for typeid
6363 CallGraphPrinter() : ModulePass((intptr_t)&ID) {}
6464
6565 virtual bool runOnModule(Module &M) {
7676 }
7777 };
7878
79 const char CallGraphPrinter::ID = 0;
79 char CallGraphPrinter::ID = 0;
8080 RegisterPass P2("print-callgraph",
8181 "Print Call Graph to 'dot' file");
8282 }
3434
3535 namespace {
3636 struct CFGSCC : public FunctionPass {
37 static const char ID; // Pass identification, replacement for typeid
37 static char ID; // Pass identification, replacement for typeid
3838 CFGSCC() : FunctionPass((intptr_t)&ID) {}
3939 bool runOnFunction(Function& func);
4040
4646 };
4747
4848 struct CallGraphSCC : public ModulePass {
49 static const char ID; // Pass identification, replacement for typeid
49 static char ID; // Pass identification, replacement for typeid
5050 CallGraphSCC() : ModulePass((intptr_t)&ID) {}
5151
5252 // run - Print out SCCs in the call graph for the specified module.
6161 }
6262 };
6363
64 const char CFGSCC::ID = 0;
64 char CFGSCC::ID = 0;
6565 RegisterPass
6666 Y("cfgscc", "Print SCCs of each function CFG");
6767
68 const char CallGraphSCC::ID = 0;
68 char CallGraphSCC::ID = 0;
6969 RegisterPass
7070 Z("callscc", "Print SCCs of the Call Graph");
7171 }
9797 namespace {
9898
9999 struct ModulePassPrinter : public ModulePass {
100 static const char ID;
100 static char ID;
101101 const PassInfo *PassToPrint;
102102 ModulePassPrinter(const PassInfo *PI) : ModulePass((intptr_t)&ID),
103103 PassToPrint(PI) {}
120120 }
121121 };
122122
123 const char ModulePassPrinter::ID = 0;
123 char ModulePassPrinter::ID = 0;
124124 struct FunctionPassPrinter : public FunctionPass {
125125 const PassInfo *PassToPrint;
126 static const char ID;
126 static char ID;
127127 FunctionPassPrinter(const PassInfo *PI) : FunctionPass((intptr_t)&ID),
128128 PassToPrint(PI) {}
129129
145145 }
146146 };
147147
148 const char FunctionPassPrinter::ID = 0;
148 char FunctionPassPrinter::ID = 0;
149149 struct BasicBlockPassPrinter : public BasicBlockPass {
150150 const PassInfo *PassToPrint;
151 static const char ID;
151 static char ID;
152152 BasicBlockPassPrinter(const PassInfo *PI)
153153 : BasicBlockPass((intptr_t)&ID), PassToPrint(PI) {}
154154
171171 }
172172 };
173173
174 const char BasicBlockPassPrinter::ID = 0;
174 char BasicBlockPassPrinter::ID = 0;
175175 inline void addPass(PassManager &PM, Pass *P) {
176176 // Add the pass to the pass manager...
177177 PM.add(P);