[PATCH] D29762: Properly register the ARMConstantIslands pass with PassRegistry

Asiri Rathnayake via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 9 07:27:13 PST 2017


rmaprath created this revision.
Herald added subscribers: rengolin, aemerson.

This pass is currently not registered properly with the PassRegistry, making
it invisible for llc options like `-stop-after` and `-run-pass`.

I need this pass to be available for those options for a follow-up patch.


https://reviews.llvm.org/D29762

Files:
  lib/Target/ARM/ARM.h
  lib/Target/ARM/ARMConstantIslandPass.cpp
  lib/Target/ARM/ARMTargetMachine.cpp


Index: lib/Target/ARM/ARMTargetMachine.cpp
===================================================================
--- lib/Target/ARM/ARMTargetMachine.cpp
+++ lib/Target/ARM/ARMTargetMachine.cpp
@@ -87,6 +87,7 @@
   initializeGlobalISel(Registry);
   initializeARMLoadStoreOptPass(Registry);
   initializeARMPreAllocLoadStoreOptPass(Registry);
+  initializeARMConstantIslandsPass(Registry);
 }
 
 static std::unique_ptr<TargetLoweringObjectFile> createTLOF(const Triple &TT) {
Index: lib/Target/ARM/ARMConstantIslandPass.cpp
===================================================================
--- lib/Target/ARM/ARMConstantIslandPass.cpp
+++ lib/Target/ARM/ARMConstantIslandPass.cpp
@@ -55,6 +55,8 @@
 using namespace llvm;
 
 #define DEBUG_TYPE "arm-cp-islands"
+#define ARM_CONSTANT_ISLANDS_PASS_NAME \
+  "ARM constant island placement and branch shortening pass"
 
 STATISTIC(NumCPEs,       "Number of constpool entries");
 STATISTIC(NumSplit,      "Number of uncond branches inserted");
@@ -230,7 +232,7 @@
     }
 
     StringRef getPassName() const override {
-      return "ARM constant island placement and branch shortening pass";
+      return ARM_CONSTANT_ISLANDS_PASS_NAME;
     }
 
   private:
@@ -287,11 +289,13 @@
                              U.getMaxDisp(), U.NegOk, U.IsSoImm);
     }
   };
-
-  char ARMConstantIslands::ID = 0;
-
 } // end anonymous namespace
 
+char ARMConstantIslands::ID = 0;
+char &llvm::ARMConstantIslandsID = ARMConstantIslands::ID;
+INITIALIZE_PASS(ARMConstantIslands, DEBUG_TYPE, ARM_CONSTANT_ISLANDS_PASS_NAME,
+                false, false)
+
 /// verify - check BBOffsets, BBSizes, alignment of islands
 void ARMConstantIslands::verify() {
 #ifndef NDEBUG
Index: lib/Target/ARM/ARM.h
===================================================================
--- lib/Target/ARM/ARM.h
+++ lib/Target/ARM/ARM.h
@@ -54,6 +54,8 @@
 void initializeARMLoadStoreOptPass(PassRegistry &);
 void initializeARMPreAllocLoadStoreOptPass(PassRegistry &);
 
+extern char &ARMConstantIslandsID;
+void initializeARMConstantIslandsPass(PassRegistry &);
 } // end namespace llvm
 
 #endif // LLVM_LIB_TARGET_ARM_ARM_H


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29762.87807.patch
Type: text/x-patch
Size: 2136 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170209/973befd0/attachment.bin>


More information about the llvm-commits mailing list