comparison include/llvm/PassInfo.h @ 120:1172e4bd9c6f

update 4.0.0
author mir3636
date Fri, 25 Nov 2016 19:14:25 +0900
parents afa8332a0e37
children 803732b1fca8
comparison
equal deleted inserted replaced
101:34baf5011add 120:1172e4bd9c6f
10 // This file defines and implements the PassInfo class. 10 // This file defines and implements the PassInfo class.
11 // 11 //
12 //===----------------------------------------------------------------------===// 12 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_PASSINFO_H 13 #ifndef LLVM_PASSINFO_H
14 #define LLVM_PASSINFO_H 14 #define LLVM_PASSINFO_H
15
16 #include "llvm/ADT/StringRef.h"
15 17
16 #include <cassert> 18 #include <cassert>
17 #include <vector> 19 #include <vector>
18 20
19 namespace llvm { 21 namespace llvm {
31 public: 33 public:
32 typedef Pass* (*NormalCtor_t)(); 34 typedef Pass* (*NormalCtor_t)();
33 typedef Pass *(*TargetMachineCtor_t)(TargetMachine *); 35 typedef Pass *(*TargetMachineCtor_t)(TargetMachine *);
34 36
35 private: 37 private:
36 const char *const PassName; // Nice name for Pass 38 StringRef PassName; // Nice name for Pass
37 const char *const PassArgument; // Command Line argument to run this pass 39 StringRef PassArgument; // Command Line argument to run this pass
38 const void *PassID; 40 const void *PassID;
39 const bool IsCFGOnlyPass; // Pass only looks at the CFG. 41 const bool IsCFGOnlyPass; // Pass only looks at the CFG.
40 const bool IsAnalysis; // True if an analysis pass. 42 const bool IsAnalysis; // True if an analysis pass.
41 const bool IsAnalysisGroup; // True if an analysis group. 43 const bool IsAnalysisGroup; // True if an analysis group.
42 std::vector<const PassInfo *> ItfImpl; // Interfaces implemented by this pass 44 std::vector<const PassInfo *> ItfImpl; // Interfaces implemented by this pass
45 TargetMachineCtor_t TargetMachineCtor; 47 TargetMachineCtor_t TargetMachineCtor;
46 48
47 public: 49 public:
48 /// PassInfo ctor - Do not call this directly, this should only be invoked 50 /// PassInfo ctor - Do not call this directly, this should only be invoked
49 /// through RegisterPass. 51 /// through RegisterPass.
50 PassInfo(const char *name, const char *arg, const void *pi, 52 PassInfo(StringRef name, StringRef arg, const void *pi, NormalCtor_t normal,
51 NormalCtor_t normal, bool isCFGOnly, bool is_analysis, 53 bool isCFGOnly, bool is_analysis,
52 TargetMachineCtor_t machine = nullptr) 54 TargetMachineCtor_t machine = nullptr)
53 : PassName(name), PassArgument(arg), PassID(pi), IsCFGOnlyPass(isCFGOnly), 55 : PassName(name), PassArgument(arg), PassID(pi), IsCFGOnlyPass(isCFGOnly),
54 IsAnalysis(is_analysis), IsAnalysisGroup(false), NormalCtor(normal), 56 IsAnalysis(is_analysis), IsAnalysisGroup(false), NormalCtor(normal),
55 TargetMachineCtor(machine) {} 57 TargetMachineCtor(machine) {}
56 /// PassInfo ctor - Do not call this directly, this should only be invoked 58 /// PassInfo ctor - Do not call this directly, this should only be invoked
57 /// through RegisterPass. This version is for use by analysis groups; it 59 /// through RegisterPass. This version is for use by analysis groups; it
58 /// does not auto-register the pass. 60 /// does not auto-register the pass.
59 PassInfo(const char *name, const void *pi) 61 PassInfo(StringRef name, const void *pi)
60 : PassName(name), PassArgument(""), PassID(pi), IsCFGOnlyPass(false), 62 : PassName(name), PassArgument(""), PassID(pi), IsCFGOnlyPass(false),
61 IsAnalysis(false), IsAnalysisGroup(true), NormalCtor(nullptr), 63 IsAnalysis(false), IsAnalysisGroup(true), NormalCtor(nullptr),
62 TargetMachineCtor(nullptr) {} 64 TargetMachineCtor(nullptr) {}
63 65
64 /// getPassName - Return the friendly name for the pass, never returns null 66 /// getPassName - Return the friendly name for the pass, never returns null
65 /// 67 ///
66 const char *getPassName() const { return PassName; } 68 StringRef getPassName() const { return PassName; }
67 69
68 /// getPassArgument - Return the command line option that may be passed to 70 /// getPassArgument - Return the command line option that may be passed to
69 /// 'opt' that will cause this pass to be run. This will return null if there 71 /// 'opt' that will cause this pass to be run. This will return null if there
70 /// is no argument. 72 /// is no argument.
71 /// 73 ///
72 const char *getPassArgument() const { return PassArgument; } 74 StringRef getPassArgument() const { return PassArgument; }
73 75
74 /// getTypeInfo - Return the id object for the pass... 76 /// getTypeInfo - Return the id object for the pass...
75 /// TODO : Rename 77 /// TODO : Rename
76 const void *getTypeInfo() const { return PassID; } 78 const void *getTypeInfo() const { return PassID; }
77 79