From: Chad Rosier <mcrosier@codeaurora.org>
Date: Wed, 5 Aug 2015 13:44:51 +0000 (+0000)
Subject: [AArch64] Register (existing) AArch64LoadStoreOpt pass with LLVM pass manager.
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b8d7701cce95b58f8f72eaad6fa58ac5a594c424;p=oota-llvm.git

[AArch64] Register (existing) AArch64LoadStoreOpt pass with LLVM pass manager.

Summary: Among other things, this allows -print-after-all/-print-before-all to
dump IR around this pass.

This is the AArch64 version of r243052.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244041 91177308-0d34-0410-b5e6-96231b3b80d8
---

diff --git a/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp b/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
index 372a6a347f7..e23e24cf90f 100644
--- a/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
+++ b/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
@@ -50,6 +50,12 @@ static cl::opt<bool> EnableAArch64UnscaledMemOp(
     "aarch64-unscaled-mem-op", cl::Hidden,
     cl::desc("Allow AArch64 unscaled load/store combining"), cl::init(true));
 
+namespace llvm {
+void initializeAArch64LoadStoreOptPass(PassRegistry &);
+}
+
+#define AARCH64_LOAD_STORE_OPT_NAME "AArch64 load / store optimization pass"
+
 namespace {
 
 typedef struct LdStPairFlags {
@@ -76,7 +82,9 @@ typedef struct LdStPairFlags {
 
 struct AArch64LoadStoreOpt : public MachineFunctionPass {
   static char ID;
-  AArch64LoadStoreOpt() : MachineFunctionPass(ID) {}
+  AArch64LoadStoreOpt() : MachineFunctionPass(ID) {
+    initializeAArch64LoadStoreOptPass(*PassRegistry::getPassRegistry());
+  }
 
   const AArch64InstrInfo *TII;
   const TargetRegisterInfo *TRI;
@@ -124,7 +132,7 @@ struct AArch64LoadStoreOpt : public MachineFunctionPass {
   bool runOnMachineFunction(MachineFunction &Fn) override;
 
   const char *getPassName() const override {
-    return "AArch64 load / store optimization pass";
+    return AARCH64_LOAD_STORE_OPT_NAME;
   }
 
 private:
@@ -133,6 +141,9 @@ private:
 char AArch64LoadStoreOpt::ID = 0;
 } // namespace
 
+INITIALIZE_PASS(AArch64LoadStoreOpt, "aarch64-ldst-opt",
+                AARCH64_LOAD_STORE_OPT_NAME, false, false)
+
 static bool isUnscaledLdst(unsigned Opc) {
   switch (Opc) {
   default: