[llvm] [AArch64] Add AArch64PassRegistry.def (PR #85215)

via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 17 20:57:25 PDT 2024


================
@@ -0,0 +1,304 @@
+//===- TargetPassRegistry.def - Registry of passes --------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file is used as the registry of passes in registerPassBuilderCallbacks
+//
+//===----------------------------------------------------------------------===//
+
+// NOTE: NO INCLUDE GUARD DESIRED!
+
+#ifdef GET_PASS_REGISTRY
+
+#if !__has_include(GET_PASS_REGISTRY)
+#error "must provide <Target>PassRegistry.def"
+#endif
+
+static constexpr bool HAVE_MODULE_ANALYSIS_ = std::size({
+                                                  "",
+#define MODULE_ANALYSIS(NAME, CREATE_PASS) NAME,
+#include GET_PASS_REGISTRY
+#undef MODULE_ANALYSIS
+                                              }) > 1;
+
+static constexpr bool HAVE_MODULE_PASS_ = std::size({
+                                              "",
+#define MODULE_PASS(NAME, CREATE_PASS) NAME,
+#include GET_PASS_REGISTRY
+#undef MODULE_PASS
+                                          }) > 1;
+
+static constexpr bool HAVE_MODULE_PASS_WITH_PARAMS_ = std::size({
+                                                          "",
+#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) NAME,
+#include GET_PASS_REGISTRY
+#undef MODULE_PASS_WITH_PARAMS
+                                                      }) > 1;
+
+static constexpr bool HAVE_FUNCTION_ANALYSIS_ = std::size({
+                                                    "",
+#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) NAME,
+#include GET_PASS_REGISTRY
+#undef FUNCTION_ANALYSIS
+                                                }) > 1;
+
+static constexpr bool HAVE_FUNCTION_ALIAS_ANALYSIS_ = std::size({
+                                                          "",
+#define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS) NAME,
+#include GET_PASS_REGISTRY
+#undef FUNCTION_ALIAS_ANALYSIS
+                                                      }) > 1;
+
+static constexpr bool HAVE_FUNCTION_PASS_ = std::size({
+                                                "",
+#define FUNCTION_PASS(NAME, CREATE_PASS) NAME,
+#include GET_PASS_REGISTRY
+#undef FUNCTION_PASS
+                                            }) > 1;
+
+static constexpr bool HAVE_FUNCTION_PASS_WITH_PARAMS_ = std::size({
+                                                            "",
+#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS)    \
+  NAME,
+#include GET_PASS_REGISTRY
+#undef FUNCTION_PASS_WITH_PARAMS
+                                                        }) > 1;
+
+static constexpr bool HAVE_LOOP_ANALYSIS_ = std::size({
+                                                "",
+#define LOOP_ANALYSIS(NAME, CREATE_PASS) NAME,
+#include GET_PASS_REGISTRY
+#undef LOOP_ANALYSIS
+                                            }) > 1;
+
+static constexpr bool HAVE_LOOP_PASS_ = std::size({
+                                            "",
+#define LOOP_PASS(NAME, CREATE_PASS) NAME,
+#include GET_PASS_REGISTRY
+#undef LOOP_PASS
+                                        }) > 1;
+
+static constexpr bool HAVE_MACHINE_FUNCTION_ANALYSIS_ = std::size({
+                                                            "",
+#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) NAME,
+#include GET_PASS_REGISTRY
+#undef MACHINE_FUNCTION_ANALYSIS
+                                                        }) > 1;
+
+static constexpr bool HAVE_MACHINE_FUNCTION_PASS_ = std::size({
+                                                        "",
+#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) NAME,
+#include GET_PASS_REGISTRY
+#undef MACHINE_FUNCTION_PASS
+                                                    }) > 1;
+
+static constexpr bool HAVE_MACHINE_FUNCTION_PASS_WITH_PARAMS_ = std::size({
+                                                                    "",
+#define MACHINE_FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER,    \
+                                          PARAMS)                              \
+  NAME,
+#include GET_PASS_REGISTRY
+#undef MACHINE_FUNCTION_PASS_WITH_PARAMS
+                                                                }) > 1;
+
+if (PopulateClassToPassNames) {
+  auto *PIC = PB.getPassInstrumentationCallbacks();
+
+#define ADD_CLASS_PASS_TO_PASS_NAME(NAME, CREATE_PASS)                         \
+  PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
+#define ADD_CLASS_PASS_TO_PASS_NAME_WITH_PARAMS(NAME, CLASS)                   \
+  PIC->addClassToPassName(CLASS, NAME);
----------------
paperchalice wrote:

Could be
```c++
#define ADD_CLASS_PASS_TO_PASS_NAME_WITH_PARAMS(NAME, CREATE_PASS)             \
  {                                                                            \
    auto C_ = CREATE_PASS;                                                     \
    PIC->addClassToPassName(function_traits<decltype(C_)>::result_t::name(),   \
                            NAME);                                             \
  }
```

https://github.com/llvm/llvm-project/pull/85215


More information about the llvm-commits mailing list