Skip to content

Commit 8917afa

Browse files
authored
Revert "[NewPM][CodeGen] Port selection dag isel to new pass manager" (#94146)
This reverts commit de37c06 to de37c06 It still breaks EXPENSIVE_CHECKS build. Sorry.
1 parent de37c06 commit 8917afa

File tree

122 files changed

+288
-783
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+288
-783
lines changed

llvm/include/llvm/CodeGen/SelectionDAG.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#include "llvm/CodeGen/ISDOpcodes.h"
3030
#include "llvm/CodeGen/MachineFunction.h"
3131
#include "llvm/CodeGen/MachineMemOperand.h"
32-
#include "llvm/CodeGen/MachinePassManager.h"
3332
#include "llvm/CodeGen/SelectionDAGNodes.h"
3433
#include "llvm/CodeGen/ValueTypes.h"
3534
#include "llvm/CodeGenTypes/MachineValueType.h"
@@ -231,7 +230,6 @@ class SelectionDAG {
231230
const TargetLibraryInfo *LibInfo = nullptr;
232231
const FunctionVarLocs *FnVarLocs = nullptr;
233232
MachineFunction *MF;
234-
MachineFunctionAnalysisManager *MFAM = nullptr;
235233
Pass *SDAGISelPass = nullptr;
236234
LLVMContext *Context;
237235
CodeGenOptLevel OptLevel;
@@ -461,15 +459,6 @@ class SelectionDAG {
461459
UniformityInfo *UA, ProfileSummaryInfo *PSIin,
462460
BlockFrequencyInfo *BFIin, FunctionVarLocs const *FnVarLocs);
463461

464-
void init(MachineFunction &NewMF, OptimizationRemarkEmitter &NewORE,
465-
MachineFunctionAnalysisManager &AM,
466-
const TargetLibraryInfo *LibraryInfo, UniformityInfo *UA,
467-
ProfileSummaryInfo *PSIin, BlockFrequencyInfo *BFIin,
468-
FunctionVarLocs const *FnVarLocs) {
469-
init(NewMF, NewORE, nullptr, LibraryInfo, UA, PSIin, BFIin, FnVarLocs);
470-
MFAM = &AM;
471-
}
472-
473462
void setFunctionLoweringInfo(FunctionLoweringInfo * FuncInfo) {
474463
FLI = FuncInfo;
475464
}
@@ -480,7 +469,6 @@ class SelectionDAG {
480469

481470
MachineFunction &getMachineFunction() const { return *MF; }
482471
const Pass *getPass() const { return SDAGISelPass; }
483-
MachineFunctionAnalysisManager *getMFAM() { return MFAM; }
484472

485473
CodeGenOptLevel getOptLevel() const { return OptLevel; }
486474
const DataLayout &getDataLayout() const { return MF->getDataLayout(); }

llvm/include/llvm/CodeGen/SelectionDAGISel.h

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#define LLVM_CODEGEN_SELECTIONDAGISEL_H
1616

1717
#include "llvm/CodeGen/MachineFunctionPass.h"
18-
#include "llvm/CodeGen/MachinePassManager.h"
1918
#include "llvm/CodeGen/SelectionDAG.h"
2019
#include "llvm/IR/BasicBlock.h"
2120
#include <memory>
@@ -25,23 +24,21 @@ class AAResults;
2524
class AssumptionCache;
2625
class TargetInstrInfo;
2726
class TargetMachine;
28-
class SSPLayoutInfo;
2927
class SelectionDAGBuilder;
3028
class SDValue;
3129
class MachineRegisterInfo;
3230
class MachineFunction;
3331
class OptimizationRemarkEmitter;
3432
class TargetLowering;
3533
class TargetLibraryInfo;
36-
class TargetTransformInfo;
3734
class FunctionLoweringInfo;
3835
class SwiftErrorValueTracking;
3936
class GCFunctionInfo;
4037
class ScheduleDAGSDNodes;
4138

4239
/// SelectionDAGISel - This is the common base class used for SelectionDAG-based
4340
/// pattern-matching instruction selectors.
44-
class SelectionDAGISel {
41+
class SelectionDAGISel : public MachineFunctionPass {
4542
public:
4643
TargetMachine &TM;
4744
const TargetLibraryInfo *LibInfo;
@@ -54,10 +51,6 @@ class SelectionDAGISel {
5451
AAResults *AA = nullptr;
5552
AssumptionCache *AC = nullptr;
5653
GCFunctionInfo *GFI = nullptr;
57-
SSPLayoutInfo *SP = nullptr;
58-
#ifndef NDEBUG
59-
TargetTransformInfo *TTI = nullptr;
60-
#endif
6154
CodeGenOptLevel OptLevel;
6255
const TargetInstrInfo *TII;
6356
const TargetLowering *TLI;
@@ -74,18 +67,16 @@ class SelectionDAGISel {
7467
/// functions. Storing the filter result here so that we only need to do the
7568
/// filtering once.
7669
bool MatchFilterFuncName = false;
77-
StringRef FuncName;
7870

79-
explicit SelectionDAGISel(TargetMachine &tm,
71+
explicit SelectionDAGISel(char &ID, TargetMachine &tm,
8072
CodeGenOptLevel OL = CodeGenOptLevel::Default);
81-
virtual ~SelectionDAGISel();
73+
~SelectionDAGISel() override;
8274

8375
const TargetLowering *getTargetLowering() const { return TLI; }
8476

85-
void initializeAnalysisResults(MachineFunctionAnalysisManager &MFAM);
86-
void initializeAnalysisResults(MachineFunctionPass &MFP);
77+
void getAnalysisUsage(AnalysisUsage &AU) const override;
8778

88-
virtual bool runOnMachineFunction(MachineFunction &mf);
79+
bool runOnMachineFunction(MachineFunction &MF) override;
8980

9081
virtual void emitFunctionEntryCode() {}
9182

@@ -526,30 +517,6 @@ class SelectionDAGISel {
526517
bool isMorphNodeTo);
527518
};
528519

529-
class SelectionDAGISelLegacy : public MachineFunctionPass {
530-
std::unique_ptr<SelectionDAGISel> Selector;
531-
532-
public:
533-
SelectionDAGISelLegacy(char &ID, std::unique_ptr<SelectionDAGISel> S);
534-
535-
~SelectionDAGISelLegacy() override = default;
536-
537-
void getAnalysisUsage(AnalysisUsage &AU) const override;
538-
539-
bool runOnMachineFunction(MachineFunction &MF) override;
540-
};
541-
542-
class SelectionDAGISelPass : public PassInfoMixin<SelectionDAGISelPass> {
543-
std::unique_ptr<SelectionDAGISel> Selector;
544-
545-
protected:
546-
SelectionDAGISelPass(std::unique_ptr<SelectionDAGISel> Selector)
547-
: Selector(std::move(Selector)) {}
548-
549-
public:
550-
PreservedAnalyses run(MachineFunction &MF,
551-
MachineFunctionAnalysisManager &MFAM);
552-
};
553520
}
554521

555522
#endif /* LLVM_CODEGEN_SELECTIONDAGISEL_H */

llvm/include/llvm/CodeGen/StackProtector.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,6 @@ class StackProtector : public FunctionPass {
109109

110110
StackProtector();
111111

112-
SSPLayoutInfo &getLayoutInfo() { return LayoutInfo; }
113-
114112
void getAnalysisUsage(AnalysisUsage &AU) const override;
115113

116114
// Return true if StackProtector is supposed to be handled by SelectionDAG.

llvm/include/llvm/Passes/CodeGenPassBuilder.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,6 @@ template <typename DerivedT, typename TargetMachineT> class CodeGenPassBuilder {
140140
}
141141

142142
protected:
143-
template <typename PassT>
144-
using has_required_t = decltype(std::declval<PassT &>().isRequired());
145-
146143
template <typename PassT>
147144
using is_module_pass_t = decltype(std::declval<PassT &>().run(
148145
std::declval<Module &>(), std::declval<ModuleAnalysisManager &>()));
@@ -173,10 +170,8 @@ template <typename DerivedT, typename TargetMachineT> class CodeGenPassBuilder {
173170
static_assert((is_detected<is_function_pass_t, PassT>::value ||
174171
is_detected<is_module_pass_t, PassT>::value) &&
175172
"Only module pass and function pass are supported.");
176-
bool Required = false;
177-
if constexpr (is_detected<has_required_t, PassT>::value)
178-
Required = PassT::isRequired();
179-
if (!PB.runBeforeAdding(Name) && !Required)
173+
174+
if (!PB.runBeforeAdding(Name))
180175
return;
181176

182177
// Add Function Pass

0 commit comments

Comments
 (0)