LLVM 20.0.0git
MachineFunctionAnalysis.cpp
Go to the documentation of this file.
1//===- MachineFunctionAnalysis.cpp ----------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file contains the definitions of the MachineFunctionAnalysis
10// members.
11//
12//===----------------------------------------------------------------------===//
13
17#include "llvm/IR/Function.h"
19
20using namespace llvm;
21
22AnalysisKey MachineFunctionAnalysis::Key;
23
25 Function &, const PreservedAnalyses &PA,
27 // Unless it is invalidated explicitly, it should remain preserved.
28 auto PAC = PA.getChecker<MachineFunctionAnalysis>();
29 return !PAC.preservedWhenStateless();
30}
31
34 auto &Context = F.getContext();
35 const TargetSubtargetInfo &STI = *TM->getSubtargetImpl(F);
37 .getCachedResult<MachineModuleAnalysis>(*F.getParent())
38 ->getMMI();
39 auto MF = std::make_unique<MachineFunction>(
40 F, *TM, STI, MMI.getContext(), Context.generateMachineFunctionNum(F));
41 MF->initTargetMachineFunctionInfo(STI);
42
43 // MRI callback for target specific initializations.
45
46 return Result(std::move(MF));
47}
#define F(x, y, z)
Definition: MD5.cpp:55
FunctionAnalysisManager FAM
API to communicate dependencies between analyses during invalidation.
Definition: PassManager.h:292
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:253
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Definition: PassManager.h:405
virtual void registerMachineRegisterInfoCallback(MachineFunction &MF) const
bool invalidate(Function &, const PreservedAnalyses &PA, FunctionAnalysisManager::Invalidator &)
This analysis create MachineFunction for given Function.
Result run(Function &F, FunctionAnalysisManager &FAM)
An analysis over an "inner" IR unit that provides access to an analysis manager over a "outer" IR uni...
Definition: PassManager.h:688
A set of analyses that are preserved following a run of a transformation pass.
Definition: Analysis.h:111
PreservedAnalysisChecker getChecker() const
Build a checker for this PreservedAnalyses and the specified analysis type.
Definition: Analysis.h:264
virtual const TargetSubtargetInfo * getSubtargetImpl(const Function &) const
Virtual method implemented by subclasses that returns a reference to that target's TargetSubtargetInf...
TargetSubtargetInfo - Generic base class for all target subtargets.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition: Analysis.h:28