[llvm] 672cc8b - [GlobalISel] Allow customizing instruction-select pass

via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 19 23:06:43 PDT 2024


Author: darkbuck
Date: 2024-07-20T02:06:38-04:00
New Revision: 672cc8bce0a9306b07680b340617b8afd862adf5

URL: https://github.com/llvm/llvm-project/commit/672cc8bce0a9306b07680b340617b8afd862adf5
DIFF: https://github.com/llvm/llvm-project/commit/672cc8bce0a9306b07680b340617b8afd862adf5.diff

LOG: [GlobalISel] Allow customizing instruction-select pass

- Allow customizing instruction-select pass to add additional analysis
  dependencies.

Reviewers: aemerson, arsenm, aeubanks

Reviewed By: arsenm

Pull Request: https://github.com/llvm/llvm-project/pull/95724

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/GlobalISel/InstructionSelect.h
    llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/GlobalISel/InstructionSelect.h b/llvm/include/llvm/CodeGen/GlobalISel/InstructionSelect.h
index cada7f30072e2..8017f09aa3c8b 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/InstructionSelect.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/InstructionSelect.h
@@ -49,8 +49,8 @@ class InstructionSelect : public MachineFunctionPass {
         MachineFunctionProperties::Property::Selected);
   }
 
-  InstructionSelect(CodeGenOptLevel OL);
-  InstructionSelect();
+  InstructionSelect(CodeGenOptLevel OL = CodeGenOptLevel::Default,
+                    char &PassID = ID);
 
   bool runOnMachineFunction(MachineFunction &MF) override;
 

diff  --git a/llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp b/llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp
index 4cb1d01f3e8ca..9a27728dcb4dd 100644
--- a/llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp
@@ -62,14 +62,8 @@ INITIALIZE_PASS_END(InstructionSelect, DEBUG_TYPE,
                     "Select target instructions out of generic instructions",
                     false, false)
 
-InstructionSelect::InstructionSelect(CodeGenOptLevel OL)
-    : MachineFunctionPass(ID), OptLevel(OL) {}
-
-// In order not to crash when calling getAnalysis during testing with -run-pass
-// we use the default opt level here instead of None, so that the addRequired()
-// calls are made in getAnalysisUsage().
-InstructionSelect::InstructionSelect()
-    : MachineFunctionPass(ID), OptLevel(CodeGenOptLevel::Default) {}
+InstructionSelect::InstructionSelect(CodeGenOptLevel OL, char &PassID)
+    : MachineFunctionPass(PassID), OptLevel(OL) {}
 
 void InstructionSelect::getAnalysisUsage(AnalysisUsage &AU) const {
   AU.addRequired<TargetPassConfig>();


        


More information about the llvm-commits mailing list