Skip to content

Revert "[NewPM][CodeGen] Port selection dag isel to new pass manager" #94146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions llvm/include/llvm/CodeGen/SelectionDAG.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include "llvm/CodeGen/ISDOpcodes.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineMemOperand.h"
#include "llvm/CodeGen/MachinePassManager.h"
#include "llvm/CodeGen/SelectionDAGNodes.h"
#include "llvm/CodeGen/ValueTypes.h"
#include "llvm/CodeGenTypes/MachineValueType.h"
Expand Down Expand Up @@ -231,7 +230,6 @@ class SelectionDAG {
const TargetLibraryInfo *LibInfo = nullptr;
const FunctionVarLocs *FnVarLocs = nullptr;
MachineFunction *MF;
MachineFunctionAnalysisManager *MFAM = nullptr;
Pass *SDAGISelPass = nullptr;
LLVMContext *Context;
CodeGenOptLevel OptLevel;
Expand Down Expand Up @@ -461,15 +459,6 @@ class SelectionDAG {
UniformityInfo *UA, ProfileSummaryInfo *PSIin,
BlockFrequencyInfo *BFIin, FunctionVarLocs const *FnVarLocs);

void init(MachineFunction &NewMF, OptimizationRemarkEmitter &NewORE,
MachineFunctionAnalysisManager &AM,
const TargetLibraryInfo *LibraryInfo, UniformityInfo *UA,
ProfileSummaryInfo *PSIin, BlockFrequencyInfo *BFIin,
FunctionVarLocs const *FnVarLocs) {
init(NewMF, NewORE, nullptr, LibraryInfo, UA, PSIin, BFIin, FnVarLocs);
MFAM = &AM;
}

void setFunctionLoweringInfo(FunctionLoweringInfo * FuncInfo) {
FLI = FuncInfo;
}
Expand All @@ -480,7 +469,6 @@ class SelectionDAG {

MachineFunction &getMachineFunction() const { return *MF; }
const Pass *getPass() const { return SDAGISelPass; }
MachineFunctionAnalysisManager *getMFAM() { return MFAM; }

CodeGenOptLevel getOptLevel() const { return OptLevel; }
const DataLayout &getDataLayout() const { return MF->getDataLayout(); }
Expand Down
43 changes: 5 additions & 38 deletions llvm/include/llvm/CodeGen/SelectionDAGISel.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#define LLVM_CODEGEN_SELECTIONDAGISEL_H

#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachinePassManager.h"
#include "llvm/CodeGen/SelectionDAG.h"
#include "llvm/IR/BasicBlock.h"
#include <memory>
Expand All @@ -25,23 +24,21 @@ class AAResults;
class AssumptionCache;
class TargetInstrInfo;
class TargetMachine;
class SSPLayoutInfo;
class SelectionDAGBuilder;
class SDValue;
class MachineRegisterInfo;
class MachineFunction;
class OptimizationRemarkEmitter;
class TargetLowering;
class TargetLibraryInfo;
class TargetTransformInfo;
class FunctionLoweringInfo;
class SwiftErrorValueTracking;
class GCFunctionInfo;
class ScheduleDAGSDNodes;

/// SelectionDAGISel - This is the common base class used for SelectionDAG-based
/// pattern-matching instruction selectors.
class SelectionDAGISel {
class SelectionDAGISel : public MachineFunctionPass {
public:
TargetMachine &TM;
const TargetLibraryInfo *LibInfo;
Expand All @@ -54,10 +51,6 @@ class SelectionDAGISel {
AAResults *AA = nullptr;
AssumptionCache *AC = nullptr;
GCFunctionInfo *GFI = nullptr;
SSPLayoutInfo *SP = nullptr;
#ifndef NDEBUG
TargetTransformInfo *TTI = nullptr;
#endif
CodeGenOptLevel OptLevel;
const TargetInstrInfo *TII;
const TargetLowering *TLI;
Expand All @@ -74,18 +67,16 @@ class SelectionDAGISel {
/// functions. Storing the filter result here so that we only need to do the
/// filtering once.
bool MatchFilterFuncName = false;
StringRef FuncName;

explicit SelectionDAGISel(TargetMachine &tm,
explicit SelectionDAGISel(char &ID, TargetMachine &tm,
CodeGenOptLevel OL = CodeGenOptLevel::Default);
virtual ~SelectionDAGISel();
~SelectionDAGISel() override;

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

void initializeAnalysisResults(MachineFunctionAnalysisManager &MFAM);
void initializeAnalysisResults(MachineFunctionPass &MFP);
void getAnalysisUsage(AnalysisUsage &AU) const override;

virtual bool runOnMachineFunction(MachineFunction &mf);
bool runOnMachineFunction(MachineFunction &MF) override;

virtual void emitFunctionEntryCode() {}

Expand Down Expand Up @@ -526,30 +517,6 @@ class SelectionDAGISel {
bool isMorphNodeTo);
};

class SelectionDAGISelLegacy : public MachineFunctionPass {
std::unique_ptr<SelectionDAGISel> Selector;

public:
SelectionDAGISelLegacy(char &ID, std::unique_ptr<SelectionDAGISel> S);

~SelectionDAGISelLegacy() override = default;

void getAnalysisUsage(AnalysisUsage &AU) const override;

bool runOnMachineFunction(MachineFunction &MF) override;
};

class SelectionDAGISelPass : public PassInfoMixin<SelectionDAGISelPass> {
std::unique_ptr<SelectionDAGISel> Selector;

protected:
SelectionDAGISelPass(std::unique_ptr<SelectionDAGISel> Selector)
: Selector(std::move(Selector)) {}

public:
PreservedAnalyses run(MachineFunction &MF,
MachineFunctionAnalysisManager &MFAM);
};
}

#endif /* LLVM_CODEGEN_SELECTIONDAGISEL_H */
2 changes: 0 additions & 2 deletions llvm/include/llvm/CodeGen/StackProtector.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ class StackProtector : public FunctionPass {

StackProtector();

SSPLayoutInfo &getLayoutInfo() { return LayoutInfo; }

void getAnalysisUsage(AnalysisUsage &AU) const override;

// Return true if StackProtector is supposed to be handled by SelectionDAG.
Expand Down
9 changes: 2 additions & 7 deletions llvm/include/llvm/Passes/CodeGenPassBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,6 @@ template <typename DerivedT, typename TargetMachineT> class CodeGenPassBuilder {
}

protected:
template <typename PassT>
using has_required_t = decltype(std::declval<PassT &>().isRequired());

template <typename PassT>
using is_module_pass_t = decltype(std::declval<PassT &>().run(
std::declval<Module &>(), std::declval<ModuleAnalysisManager &>()));
Expand Down Expand Up @@ -173,10 +170,8 @@ template <typename DerivedT, typename TargetMachineT> class CodeGenPassBuilder {
static_assert((is_detected<is_function_pass_t, PassT>::value ||
is_detected<is_module_pass_t, PassT>::value) &&
"Only module pass and function pass are supported.");
bool Required = false;
if constexpr (is_detected<has_required_t, PassT>::value)
Required = PassT::isRequired();
if (!PB.runBeforeAdding(Name) && !Required)

if (!PB.runBeforeAdding(Name))
return;

// Add Function Pass
Expand Down
Loading
Loading