mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 04:32:44 +01:00
[NFC] Clean up uses of MachineModuleInfoWrapperPass
This commit is contained in:
parent
dda5f484dc
commit
54a5a78649
@ -244,7 +244,6 @@ const MCSection *AsmPrinter::getCurrentSection() const {
|
||||
void AsmPrinter::getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.setPreservesAll();
|
||||
MachineFunctionPass::getAnalysisUsage(AU);
|
||||
AU.addRequired<MachineModuleInfoWrapperPass>();
|
||||
AU.addRequired<MachineOptimizationRemarkEmitterPass>();
|
||||
AU.addRequired<GCModuleInfo>();
|
||||
}
|
||||
@ -306,14 +305,14 @@ bool AsmPrinter::doInitialization(Module &M) {
|
||||
}
|
||||
|
||||
if (MAI->doesSupportDebugInformation()) {
|
||||
bool EmitCodeView = MMI->getModule()->getCodeViewFlag();
|
||||
bool EmitCodeView = M.getCodeViewFlag();
|
||||
if (EmitCodeView && TM.getTargetTriple().isOSWindows()) {
|
||||
Handlers.emplace_back(std::make_unique<CodeViewDebug>(this),
|
||||
DbgTimerName, DbgTimerDescription,
|
||||
CodeViewLineTablesGroupName,
|
||||
CodeViewLineTablesGroupDescription);
|
||||
}
|
||||
if (!EmitCodeView || MMI->getModule()->getDwarfVersion()) {
|
||||
if (!EmitCodeView || M.getDwarfVersion()) {
|
||||
DD = new DwarfDebug(this, &M);
|
||||
DD->beginModule();
|
||||
Handlers.emplace_back(std::unique_ptr<DwarfDebug>(DD), DbgTimerName,
|
||||
@ -376,8 +375,7 @@ bool AsmPrinter::doInitialization(Module &M) {
|
||||
DWARFGroupDescription);
|
||||
|
||||
// Emit tables for any value of cfguard flag (i.e. cfguard=1 or cfguard=2).
|
||||
if (mdconst::extract_or_null<ConstantInt>(
|
||||
MMI->getModule()->getModuleFlag("cfguard")))
|
||||
if (mdconst::extract_or_null<ConstantInt>(M.getModuleFlag("cfguard")))
|
||||
Handlers.emplace_back(std::make_unique<WinCFGuard>(this), CFGuardName,
|
||||
CFGuardDescription, DWARFGroupName,
|
||||
DWARFGroupDescription);
|
||||
@ -1051,9 +1049,9 @@ void AsmPrinter::emitStackSizeSection(const MachineFunction &MF) {
|
||||
OutStreamer->PopSection();
|
||||
}
|
||||
|
||||
static bool needFuncLabelsForEHOrDebugInfo(const MachineFunction &MF,
|
||||
MachineModuleInfo *MMI) {
|
||||
if (!MF.getLandingPads().empty() || MF.hasEHFunclets() || MMI->hasDebugInfo())
|
||||
static bool needFuncLabelsForEHOrDebugInfo(const MachineFunction &MF) {
|
||||
MachineModuleInfo &MMI = MF.getMMI();
|
||||
if (!MF.getLandingPads().empty() || MF.hasEHFunclets() || MMI.hasDebugInfo())
|
||||
return true;
|
||||
|
||||
// We might emit an EH table that uses function begin and end labels even if
|
||||
@ -1261,7 +1259,7 @@ void AsmPrinter::emitFunctionBody() {
|
||||
// Emit target-specific gunk after the function body.
|
||||
emitFunctionBodyEnd();
|
||||
|
||||
if (needFuncLabelsForEHOrDebugInfo(*MF, MMI) ||
|
||||
if (needFuncLabelsForEHOrDebugInfo(*MF) ||
|
||||
MAI->hasDotTypeDotSizeDirective()) {
|
||||
// Create a symbol for the end of function.
|
||||
CurrentFnEnd = createTempSymbol("func_end");
|
||||
@ -1789,7 +1787,7 @@ void AsmPrinter::SetupMachineFunction(MachineFunction &MF) {
|
||||
if (F.hasFnAttribute("patchable-function-entry") ||
|
||||
F.hasFnAttribute("function-instrument") ||
|
||||
F.hasFnAttribute("xray-instruction-threshold") ||
|
||||
needFuncLabelsForEHOrDebugInfo(MF, MMI) || NeedsLocalForSize ||
|
||||
needFuncLabelsForEHOrDebugInfo(MF) || NeedsLocalForSize ||
|
||||
MF.getTarget().Options.EmitStackSizeSection) {
|
||||
CurrentFnBegin = createTempSymbol("func_begin");
|
||||
if (NeedsLocalForSize)
|
||||
|
@ -448,7 +448,7 @@ bool BBSectionsPrepare::doInitialization(Module &M) {
|
||||
|
||||
void BBSectionsPrepare::getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.setPreservesAll();
|
||||
AU.addRequired<MachineModuleInfoWrapperPass>();
|
||||
MachineFunctionPass::getAnalysisUsage(AU);
|
||||
}
|
||||
|
||||
MachineFunctionPass *
|
||||
|
@ -135,10 +135,8 @@ bool BranchFolderPass::runOnMachineFunction(MachineFunction &MF) {
|
||||
BranchFolder Folder(EnableTailMerge, /*CommonHoist=*/true, MBBFreqInfo,
|
||||
getAnalysis<MachineBranchProbabilityInfo>(),
|
||||
&getAnalysis<ProfileSummaryInfoWrapperPass>().getPSI());
|
||||
auto *MMIWP = getAnalysisIfAvailable<MachineModuleInfoWrapperPass>();
|
||||
return Folder.OptimizeFunction(
|
||||
MF, MF.getSubtarget().getInstrInfo(), MF.getSubtarget().getRegisterInfo(),
|
||||
MMIWP ? &MMIWP->getMMI() : nullptr);
|
||||
return Folder.OptimizeFunction(MF, MF.getSubtarget().getInstrInfo(),
|
||||
MF.getSubtarget().getRegisterInfo());
|
||||
}
|
||||
|
||||
BranchFolder::BranchFolder(bool defaultEnableTailMerge, bool CommonHoist,
|
||||
@ -184,7 +182,6 @@ void BranchFolder::RemoveDeadBlock(MachineBasicBlock *MBB) {
|
||||
bool BranchFolder::OptimizeFunction(MachineFunction &MF,
|
||||
const TargetInstrInfo *tii,
|
||||
const TargetRegisterInfo *tri,
|
||||
MachineModuleInfo *mmi,
|
||||
MachineLoopInfo *mli, bool AfterPlacement) {
|
||||
if (!tii) return false;
|
||||
|
||||
@ -194,7 +191,6 @@ bool BranchFolder::OptimizeFunction(MachineFunction &MF,
|
||||
AfterBlockPlacement = AfterPlacement;
|
||||
TII = tii;
|
||||
TRI = tri;
|
||||
MMI = mmi;
|
||||
MLI = mli;
|
||||
this->MRI = &MRI;
|
||||
|
||||
|
@ -45,7 +45,7 @@ class TargetRegisterInfo;
|
||||
/// given function. Block placement changes the layout and may create new
|
||||
/// tail merging opportunities.
|
||||
bool OptimizeFunction(MachineFunction &MF, const TargetInstrInfo *tii,
|
||||
const TargetRegisterInfo *tri, MachineModuleInfo *mmi,
|
||||
const TargetRegisterInfo *tri,
|
||||
MachineLoopInfo *mli = nullptr,
|
||||
bool AfterPlacement = false);
|
||||
|
||||
@ -124,7 +124,6 @@ class TargetRegisterInfo;
|
||||
const TargetInstrInfo *TII;
|
||||
const MachineRegisterInfo *MRI;
|
||||
const TargetRegisterInfo *TRI;
|
||||
MachineModuleInfo *MMI;
|
||||
MachineLoopInfo *MLI;
|
||||
LivePhysRegs LiveRegs;
|
||||
|
||||
|
@ -57,7 +57,6 @@ public:
|
||||
/// GCMetadata record for each function.
|
||||
class GCMachineCodeAnalysis : public MachineFunctionPass {
|
||||
GCFunctionInfo *FI;
|
||||
MachineModuleInfo *MMI;
|
||||
const TargetInstrInfo *TII;
|
||||
|
||||
void FindSafePoints(MachineFunction &MF);
|
||||
@ -249,7 +248,6 @@ GCMachineCodeAnalysis::GCMachineCodeAnalysis() : MachineFunctionPass(ID) {}
|
||||
void GCMachineCodeAnalysis::getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
MachineFunctionPass::getAnalysisUsage(AU);
|
||||
AU.setPreservesAll();
|
||||
AU.addRequired<MachineModuleInfoWrapperPass>();
|
||||
AU.addRequired<GCModuleInfo>();
|
||||
}
|
||||
|
||||
@ -310,7 +308,6 @@ bool GCMachineCodeAnalysis::runOnMachineFunction(MachineFunction &MF) {
|
||||
return false;
|
||||
|
||||
FI = &getAnalysis<GCModuleInfo>().getFunctionInfo(MF.getFunction());
|
||||
MMI = &getAnalysis<MachineModuleInfoWrapperPass>().getMMI();
|
||||
TII = MF.getSubtarget().getInstrInfo();
|
||||
|
||||
// Find the size of the stack frame. There may be no correct static frame
|
||||
|
@ -463,10 +463,7 @@ bool IfConverter::runOnMachineFunction(MachineFunction &MF) {
|
||||
if (!PreRegAlloc) {
|
||||
// Tail merge tend to expose more if-conversion opportunities.
|
||||
BranchFolder BF(true, false, MBFI, *MBPI, PSI);
|
||||
auto *MMIWP = getAnalysisIfAvailable<MachineModuleInfoWrapperPass>();
|
||||
BFChange = BF.OptimizeFunction(
|
||||
MF, TII, ST.getRegisterInfo(),
|
||||
MMIWP ? &MMIWP->getMMI() : nullptr);
|
||||
BFChange = BF.OptimizeFunction(MF, TII, ST.getRegisterInfo());
|
||||
}
|
||||
|
||||
LLVM_DEBUG(dbgs() << "\nIfcvt: function (" << ++FnNum << ") \'"
|
||||
@ -605,10 +602,7 @@ bool IfConverter::runOnMachineFunction(MachineFunction &MF) {
|
||||
|
||||
if (MadeChange && IfCvtBranchFold) {
|
||||
BranchFolder BF(false, false, MBFI, *MBPI, PSI);
|
||||
auto *MMIWP = getAnalysisIfAvailable<MachineModuleInfoWrapperPass>();
|
||||
BF.OptimizeFunction(
|
||||
MF, TII, MF.getSubtarget().getRegisterInfo(),
|
||||
MMIWP ? &MMIWP->getMMI() : nullptr);
|
||||
BF.OptimizeFunction(MF, TII, MF.getSubtarget().getRegisterInfo());
|
||||
}
|
||||
|
||||
MadeChange |= BFChange;
|
||||
|
@ -3329,9 +3329,7 @@ bool MachineBlockPlacement::runOnMachineFunction(MachineFunction &MF) {
|
||||
BranchFolder BF(/*EnableTailMerge=*/true, /*CommonHoist=*/false, *MBFI,
|
||||
*MBPI, PSI, TailMergeSize);
|
||||
|
||||
auto *MMIWP = getAnalysisIfAvailable<MachineModuleInfoWrapperPass>();
|
||||
if (BF.OptimizeFunction(MF, TII, MF.getSubtarget().getRegisterInfo(),
|
||||
MMIWP ? &MMIWP->getMMI() : nullptr, MLI,
|
||||
if (BF.OptimizeFunction(MF, TII, MF.getSubtarget().getRegisterInfo(), MLI,
|
||||
/*AfterPlacement=*/true)) {
|
||||
// Redo the layout if tail merging creates/removes/moves blocks.
|
||||
BlockToChain.clear();
|
||||
|
@ -81,7 +81,7 @@ namespace {
|
||||
class UnreachableMachineBlockElim : public MachineFunctionPass {
|
||||
bool runOnMachineFunction(MachineFunction &F) override;
|
||||
void getAnalysisUsage(AnalysisUsage &AU) const override;
|
||||
MachineModuleInfo *MMI;
|
||||
|
||||
public:
|
||||
static char ID; // Pass identification, replacement for typeid
|
||||
UnreachableMachineBlockElim() : MachineFunctionPass(ID) {}
|
||||
@ -104,8 +104,6 @@ bool UnreachableMachineBlockElim::runOnMachineFunction(MachineFunction &F) {
|
||||
df_iterator_default_set<MachineBasicBlock*> Reachable;
|
||||
bool ModifiedPHI = false;
|
||||
|
||||
auto *MMIWP = getAnalysisIfAvailable<MachineModuleInfoWrapperPass>();
|
||||
MMI = MMIWP ? &MMIWP->getMMI() : nullptr;
|
||||
MachineDominatorTree *MDT = getAnalysisIfAvailable<MachineDominatorTree>();
|
||||
MachineLoopInfo *MLI = getAnalysisIfAvailable<MachineLoopInfo>();
|
||||
|
||||
|
@ -403,12 +403,6 @@ public:
|
||||
bool doInitialization(Module &M) override;
|
||||
bool runOnMachineFunction(MachineFunction &MF) override;
|
||||
|
||||
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
||||
MachineFunctionPass::getAnalysisUsage(AU);
|
||||
AU.addRequired<MachineModuleInfoWrapperPass>();
|
||||
AU.addPreserved<MachineModuleInfoWrapperPass>();
|
||||
}
|
||||
|
||||
private:
|
||||
std::tuple<SLSBLRThunkInserter> TIs;
|
||||
|
||||
|
@ -110,12 +110,6 @@ public:
|
||||
bool doInitialization(Module &M) override;
|
||||
bool runOnMachineFunction(MachineFunction &MF) override;
|
||||
|
||||
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
||||
MachineFunctionPass::getAnalysisUsage(AU);
|
||||
AU.addRequired<MachineModuleInfoWrapperPass>();
|
||||
AU.addPreserved<MachineModuleInfoWrapperPass>();
|
||||
}
|
||||
|
||||
private:
|
||||
std::tuple<RetpolineThunkInserter, LVIThunkInserter> TIs;
|
||||
|
||||
|
@ -173,7 +173,7 @@ bool X86InsertPrefetch::doInitialization(Module &M) {
|
||||
|
||||
void X86InsertPrefetch::getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.setPreservesAll();
|
||||
AU.addRequired<MachineModuleInfoWrapperPass>();
|
||||
MachineFunctionPass::getAnalysisUsage(AU);
|
||||
}
|
||||
|
||||
bool X86InsertPrefetch::runOnMachineFunction(MachineFunction &MF) {
|
||||
|
Loading…
Reference in New Issue
Block a user