[llvm] [NewPM][CodeGen] Port selection dag isel to new pass manager (PR #83567)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 12 05:46:22 PDT 2024


================
@@ -341,9 +341,50 @@ void TargetLowering::AdjustInstrPostInstrSelection(MachineInstr &MI,
 // SelectionDAGISel code
 //===----------------------------------------------------------------------===//
 
-SelectionDAGISel::SelectionDAGISel(char &ID, TargetMachine &tm,
-                                   CodeGenOptLevel OL)
-    : MachineFunctionPass(ID), TM(tm), FuncInfo(new FunctionLoweringInfo()),
+SelectionDAGISelLegacy::SelectionDAGISelLegacy(
+    char &ID, std::unique_ptr<SelectionDAGISel> S)
+    : MachineFunctionPass(ID), Selector(std::move(S)) {
+  initializeGCModuleInfoPass(*PassRegistry::getPassRegistry());
+  initializeBranchProbabilityInfoWrapperPassPass(
+      *PassRegistry::getPassRegistry());
+  initializeAAResultsWrapperPassPass(*PassRegistry::getPassRegistry());
+  initializeTargetLibraryInfoWrapperPassPass(*PassRegistry::getPassRegistry());
+}
+
+bool SelectionDAGISelLegacy::runOnMachineFunction(MachineFunction &MF) {
+  // If we already selected that function, we do not need to run SDISel.
+  if (MF.getProperties().hasProperty(
+          MachineFunctionProperties::Property::Selected))
+    return false;
+
+  // Do some sanity-checking on the command-line options.
+  assert((!EnableFastISelAbort || Selector->TM.Options.EnableFastISel) &&
+         "-fast-isel-abort > 0 requires -fast-isel");
----------------
arsenm wrote:

This shouldn't be an assert. If we want to do something other than press on, should be a proper error 

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


More information about the llvm-commits mailing list