summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2016-06-03 08:46:16 +0000
committerChandler Carruth <chandlerc@gmail.com>2016-06-03 08:46:16 +0000
commit345d225da2054df84615fec634b21d30d2082868 (patch)
tree47b2267a691a065f2b11781cd8db9fa29c7d0abd
parent1f077f6b2b9cf5b04890798e980fb438cc8f4873 (diff)
downloadbcm5719-llvm-345d225da2054df84615fec634b21d30d2082868.tar.gz
bcm5719-llvm-345d225da2054df84615fec634b21d30d2082868.zip
Run clang-format over PassSupport.h, mostly to get the macros all
formatted fancily. I'm working on rewriting these macros to use the new call_once stuff, but really want to have clang-format work on the edits, so just re-baselining the entire file here. No changes other than clang-format. llvm-svn: 271635
-rw-r--r--llvm/include/llvm/PassSupport.h211
1 files changed, 101 insertions, 110 deletions
diff --git a/llvm/include/llvm/PassSupport.h b/llvm/include/llvm/PassSupport.h
index 6d08257fa4b..f205c001f53 100644
--- a/llvm/include/llvm/PassSupport.h
+++ b/llvm/include/llvm/PassSupport.h
@@ -31,66 +31,66 @@ namespace llvm {
class TargetMachine;
-#define CALL_ONCE_INITIALIZATION(function) \
- static volatile sys::cas_flag initialized = 0; \
- sys::cas_flag old_val = sys::CompareAndSwap(&initialized, 1, 0); \
- if (old_val == 0) { \
- function(Registry); \
- sys::MemoryFence(); \
- TsanIgnoreWritesBegin(); \
- TsanHappensBefore(&initialized); \
- initialized = 2; \
- TsanIgnoreWritesEnd(); \
- } else { \
- sys::cas_flag tmp = initialized; \
- sys::MemoryFence(); \
- while (tmp != 2) { \
- tmp = initialized; \
- sys::MemoryFence(); \
- } \
- } \
+#define CALL_ONCE_INITIALIZATION(function) \
+ static volatile sys::cas_flag initialized = 0; \
+ sys::cas_flag old_val = sys::CompareAndSwap(&initialized, 1, 0); \
+ if (old_val == 0) { \
+ function(Registry); \
+ sys::MemoryFence(); \
+ TsanIgnoreWritesBegin(); \
+ TsanHappensBefore(&initialized); \
+ initialized = 2; \
+ TsanIgnoreWritesEnd(); \
+ } else { \
+ sys::cas_flag tmp = initialized; \
+ sys::MemoryFence(); \
+ while (tmp != 2) { \
+ tmp = initialized; \
+ sys::MemoryFence(); \
+ } \
+ } \
TsanHappensAfter(&initialized);
-#define INITIALIZE_PASS(passName, arg, name, cfg, analysis) \
- static void* initialize##passName##PassOnce(PassRegistry &Registry) { \
- PassInfo *PI = new PassInfo(name, arg, & passName ::ID, \
- PassInfo::NormalCtor_t(callDefaultCtor< passName >), cfg, analysis); \
- Registry.registerPass(*PI, true); \
- return PI; \
- } \
- void llvm::initialize##passName##Pass(PassRegistry &Registry) { \
- CALL_ONCE_INITIALIZATION(initialize##passName##PassOnce) \
+#define INITIALIZE_PASS(passName, arg, name, cfg, analysis) \
+ static void *initialize##passName##PassOnce(PassRegistry &Registry) { \
+ PassInfo *PI = new PassInfo( \
+ name, arg, &passName::ID, \
+ PassInfo::NormalCtor_t(callDefaultCtor<passName>), cfg, analysis); \
+ Registry.registerPass(*PI, true); \
+ return PI; \
+ } \
+ void llvm::initialize##passName##Pass(PassRegistry &Registry) { \
+ CALL_ONCE_INITIALIZATION(initialize##passName##PassOnce) \
}
-#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis) \
- static void* initialize##passName##PassOnce(PassRegistry &Registry) {
-
-#define INITIALIZE_PASS_DEPENDENCY(depName) \
- initialize##depName##Pass(Registry);
-#define INITIALIZE_AG_DEPENDENCY(depName) \
- initialize##depName##AnalysisGroup(Registry);
-
-#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis) \
- PassInfo *PI = new PassInfo(name, arg, & passName ::ID, \
- PassInfo::NormalCtor_t(callDefaultCtor< passName >), cfg, analysis); \
- Registry.registerPass(*PI, true); \
- return PI; \
- } \
- void llvm::initialize##passName##Pass(PassRegistry &Registry) { \
- CALL_ONCE_INITIALIZATION(initialize##passName##PassOnce) \
+#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis) \
+ static void *initialize##passName##PassOnce(PassRegistry &Registry) {
+
+#define INITIALIZE_PASS_DEPENDENCY(depName) initialize##depName##Pass(Registry);
+#define INITIALIZE_AG_DEPENDENCY(depName) \
+ initialize##depName##AnalysisGroup(Registry);
+
+#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis) \
+ PassInfo *PI = new PassInfo( \
+ name, arg, &passName::ID, \
+ PassInfo::NormalCtor_t(callDefaultCtor<passName>), cfg, analysis); \
+ Registry.registerPass(*PI, true); \
+ return PI; \
+ } \
+ void llvm::initialize##passName##Pass(PassRegistry &Registry) { \
+ CALL_ONCE_INITIALIZATION(initialize##passName##PassOnce) \
}
-#define INITIALIZE_PASS_WITH_OPTIONS(PassName, Arg, Name, Cfg, Analysis) \
- INITIALIZE_PASS_BEGIN(PassName, Arg, Name, Cfg, Analysis) \
- PassName::registerOptions(); \
+#define INITIALIZE_PASS_WITH_OPTIONS(PassName, Arg, Name, Cfg, Analysis) \
+ INITIALIZE_PASS_BEGIN(PassName, Arg, Name, Cfg, Analysis) \
+ PassName::registerOptions(); \
INITIALIZE_PASS_END(PassName, Arg, Name, Cfg, Analysis)
#define INITIALIZE_PASS_WITH_OPTIONS_BEGIN(PassName, Arg, Name, Cfg, Analysis) \
- INITIALIZE_PASS_BEGIN(PassName, Arg, Name, Cfg, Analysis) \
- PassName::registerOptions(); \
+ INITIALIZE_PASS_BEGIN(PassName, Arg, Name, Cfg, Analysis) \
+ PassName::registerOptions();
-template<typename PassName>
-Pass *callDefaultCtor() { return new PassName(); }
+template <typename PassName> Pass *callDefaultCtor() { return new PassName(); }
template <typename PassName> Pass *callTargetMachineCtor(TargetMachine *TM) {
return new PassName(TM);
@@ -113,20 +113,17 @@ template <typename PassName> Pass *callTargetMachineCtor(TargetMachine *TM) {
///
/// static RegisterPass<PassClassName> tmp("passopt", "My Name");
///
-template<typename passName>
-struct RegisterPass : public PassInfo {
-
+template <typename passName> struct RegisterPass : public PassInfo {
// Register Pass using default constructor...
RegisterPass(const char *PassArg, const char *Name, bool CFGOnly = false,
bool is_analysis = false)
- : PassInfo(Name, PassArg, &passName::ID,
- PassInfo::NormalCtor_t(callDefaultCtor<passName>),
- CFGOnly, is_analysis) {
+ : PassInfo(Name, PassArg, &passName::ID,
+ PassInfo::NormalCtor_t(callDefaultCtor<passName>), CFGOnly,
+ is_analysis) {
PassRegistry::getPassRegistry()->registerPass(*this);
}
};
-
/// RegisterAnalysisGroup - Register a Pass as a member of an analysis _group_.
/// Analysis groups are used to define an interface (which need not derive from
/// Pass) that is required by passes to do their job. Analysis Groups differ
@@ -148,70 +145,66 @@ struct RegisterPass : public PassInfo {
///
class RegisterAGBase : public PassInfo {
public:
- RegisterAGBase(const char *Name,
- const void *InterfaceID,
- const void *PassID = nullptr,
- bool isDefault = false);
+ RegisterAGBase(const char *Name, const void *InterfaceID,
+ const void *PassID = nullptr, bool isDefault = false);
};
-template<typename Interface, bool Default = false>
+template <typename Interface, bool Default = false>
struct RegisterAnalysisGroup : public RegisterAGBase {
explicit RegisterAnalysisGroup(PassInfo &RPB)
- : RegisterAGBase(RPB.getPassName(),
- &Interface::ID, RPB.getTypeInfo(),
- Default) {
- }
+ : RegisterAGBase(RPB.getPassName(), &Interface::ID, RPB.getTypeInfo(),
+ Default) {}
explicit RegisterAnalysisGroup(const char *Name)
- : RegisterAGBase(Name, &Interface::ID) {
- }
+ : RegisterAGBase(Name, &Interface::ID) {}
};
-#define INITIALIZE_ANALYSIS_GROUP(agName, name, defaultPass) \
- static void* initialize##agName##AnalysisGroupOnce(PassRegistry &Registry) { \
- initialize##defaultPass##Pass(Registry); \
- PassInfo *AI = new PassInfo(name, & agName :: ID); \
- Registry.registerAnalysisGroup(& agName ::ID, 0, *AI, false, true); \
- return AI; \
- } \
- void llvm::initialize##agName##AnalysisGroup(PassRegistry &Registry) { \
- CALL_ONCE_INITIALIZATION(initialize##agName##AnalysisGroupOnce) \
+#define INITIALIZE_ANALYSIS_GROUP(agName, name, defaultPass) \
+ static void *initialize##agName##AnalysisGroupOnce(PassRegistry &Registry) { \
+ initialize##defaultPass##Pass(Registry); \
+ PassInfo *AI = new PassInfo(name, &agName::ID); \
+ Registry.registerAnalysisGroup(&agName::ID, 0, *AI, false, true); \
+ return AI; \
+ } \
+ void llvm::initialize##agName##AnalysisGroup(PassRegistry &Registry) { \
+ CALL_ONCE_INITIALIZATION(initialize##agName##AnalysisGroupOnce) \
}
-
-#define INITIALIZE_AG_PASS(passName, agName, arg, name, cfg, analysis, def) \
- static void* initialize##passName##PassOnce(PassRegistry &Registry) { \
- if (!def) initialize##agName##AnalysisGroup(Registry); \
- PassInfo *PI = new PassInfo(name, arg, & passName ::ID, \
- PassInfo::NormalCtor_t(callDefaultCtor< passName >), cfg, analysis); \
- Registry.registerPass(*PI, true); \
- \
- PassInfo *AI = new PassInfo(name, & agName :: ID); \
- Registry.registerAnalysisGroup(& agName ::ID, & passName ::ID, \
- *AI, def, true); \
- return AI; \
- } \
- void llvm::initialize##passName##Pass(PassRegistry &Registry) { \
- CALL_ONCE_INITIALIZATION(initialize##passName##PassOnce) \
+#define INITIALIZE_AG_PASS(passName, agName, arg, name, cfg, analysis, def) \
+ static void *initialize##passName##PassOnce(PassRegistry &Registry) { \
+ if (!def) \
+ initialize##agName##AnalysisGroup(Registry); \
+ PassInfo *PI = new PassInfo( \
+ name, arg, &passName::ID, \
+ PassInfo::NormalCtor_t(callDefaultCtor<passName>), cfg, analysis); \
+ Registry.registerPass(*PI, true); \
+ \
+ PassInfo *AI = new PassInfo(name, &agName::ID); \
+ Registry.registerAnalysisGroup(&agName::ID, &passName::ID, *AI, def, \
+ true); \
+ return AI; \
+ } \
+ void llvm::initialize##passName##Pass(PassRegistry &Registry) { \
+ CALL_ONCE_INITIALIZATION(initialize##passName##PassOnce) \
}
-
#define INITIALIZE_AG_PASS_BEGIN(passName, agName, arg, n, cfg, analysis, def) \
- static void* initialize##passName##PassOnce(PassRegistry &Registry) { \
- if (!def) initialize##agName##AnalysisGroup(Registry);
-
-#define INITIALIZE_AG_PASS_END(passName, agName, arg, n, cfg, analysis, def) \
- PassInfo *PI = new PassInfo(n, arg, & passName ::ID, \
- PassInfo::NormalCtor_t(callDefaultCtor< passName >), cfg, analysis); \
- Registry.registerPass(*PI, true); \
- \
- PassInfo *AI = new PassInfo(n, & agName :: ID); \
- Registry.registerAnalysisGroup(& agName ::ID, & passName ::ID, \
- *AI, def, true); \
- return AI; \
- } \
- void llvm::initialize##passName##Pass(PassRegistry &Registry) { \
- CALL_ONCE_INITIALIZATION(initialize##passName##PassOnce) \
+ static void *initialize##passName##PassOnce(PassRegistry &Registry) { \
+ if (!def) \
+ initialize##agName##AnalysisGroup(Registry);
+
+#define INITIALIZE_AG_PASS_END(passName, agName, arg, n, cfg, analysis, def) \
+ PassInfo *PI = new PassInfo( \
+ n, arg, &passName::ID, \
+ PassInfo::NormalCtor_t(callDefaultCtor<passName>), cfg, analysis); \
+ Registry.registerPass(*PI, true); \
+ \
+ PassInfo *AI = new PassInfo(n, &agName::ID); \
+ Registry.registerAnalysisGroup(&agName::ID, &passName::ID, *AI, def, true); \
+ return AI; \
+ } \
+ void llvm::initialize##passName##Pass(PassRegistry &Registry) { \
+ CALL_ONCE_INITIALIZATION(initialize##passName##PassOnce) \
}
//===---------------------------------------------------------------------------
@@ -222,7 +215,6 @@ struct RegisterAnalysisGroup : public RegisterAGBase {
/// loaded).
///
struct PassRegistrationListener {
-
PassRegistrationListener() {}
virtual ~PassRegistrationListener() {}
@@ -242,7 +234,6 @@ struct PassRegistrationListener {
virtual void passEnumerate(const PassInfo *) {}
};
-
} // End llvm namespace
#endif
OpenPOWER on IntegriCloud