42 Context(TM.getTargetTriple(), TM.getMCAsmInfo(), TM.getMCRegisterInfo(),
43 TM.getMCSubtargetInfo(), nullptr,
false),
44 MachineFunctions(
std::
move(MMI.MachineFunctions)) {
45 Context.setObjectFileInfo(TM.getObjFileLowering());
46 ObjFileMMI = MMI.ObjFileMMI;
47 ExternalContext = MMI.ExternalContext;
48 TheModule = MMI.TheModule;
52 : TM(*TM), Context(TM->getTargetTriple(), TM->getMCAsmInfo(),
53 TM->getMCRegisterInfo(), TM->getMCSubtargetInfo(),
55 Context.setObjectFileInfo(TM->getObjFileLowering());
61 : TM(*TM), Context(TM->getTargetTriple(), TM->getMCAsmInfo(),
62 TM->getMCRegisterInfo(), TM->getMCSubtargetInfo(),
64 ExternalContext(ExtContext) {
65 Context.setObjectFileInfo(TM->getObjFileLowering());
73 auto I = MachineFunctions.find(&
F);
74 return I != MachineFunctions.end() ?
I->second.get() :
nullptr;
80 if (LastRequest == &
F)
83 auto I = MachineFunctions.insert(
84 std::make_pair(&
F, std::unique_ptr<MachineFunction>()));
93 TM.registerMachineRegisterInfoCallback(*MF);
96 I.first->second.reset(MF);
98 MF =
I.first->second.get();
108 LastRequest =
nullptr;
109 LastResult =
nullptr;
110 auto Leader = MFDeletionGrouping.findLeader(&
F);
111 if (Leader == MFDeletionGrouping.member_end()) {
112 MachineFunctions.erase(&
F);
118 return FinalizedMFs.count(Member);
122 for (
const Function *Member : MFDeletionGrouping.members(*Leader)) {
123 MachineFunctions.erase(Member);
129 std::unique_ptr<MachineFunction> &&MF) {
130 auto I = MachineFunctions.insert(std::make_pair(&
F, std::move(MF)));
131 assert(
I.second &&
"machine function already mapped");
150 MachineModuleInfo &MMI =
151 getAnalysis<MachineModuleInfoWrapperPass>().getMMI();
156 StringRef getPassName()
const override {
157 return "Free MachineFunction";
163char FreeMachineFunction::ID;
166 return new FreeMachineFunction();
179 "Machine Module Information",
false,
false)
185 unsigned BufNum =
SrcMgr.FindBufferContainingLoc(SMD.getLoc());
186 const MDNode *LocInfo =
nullptr;
187 if (BufNum > 0 && BufNum <= LocInfos.size())
188 LocInfo = LocInfos[BufNum - 1];
194 unsigned ErrorLine = SMD.getLineNo() - 1;
195 if (ErrorLine >= LocInfo->getNumOperands())
198 if (LocInfo->getNumOperands() != 0)
201 LocCookie = CI->getZExtValue();
214 std::vector<const MDNode *> &LocInfos) {
238 std::vector<const MDNode *> &LocInfos) {
239 unsigned LocCookie = 0;
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static bool runOnFunction(Function &F, bool PostInlining)
Module.h This file contains the declarations for the Module class.
static INITIALIZE_PASS(MachineModuleInfoWrapperPass, "machinemoduleinfo", "Machine Module Information", false, false) char MachineModuleInfoWrapperPass uint64_t getLocCookie(const SMDiagnostic &SMD, const SourceMgr &SrcMgr, std::vector< const MDNode * > &LocInfos)
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
Represent the analysis usage information of a pass.
AnalysisUsage & addRequired()
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
This is the shared class of boolean and integer constants.
Diagnostic information for SMDiagnostic reporting.
FunctionPass class - This class is used to implement most global optimizations.
This is an important class for using LLVM in a threaded context.
LLVM_ABI void setDiagnosticHandler(std::unique_ptr< DiagnosticHandler > &&DH, bool RespectFilters=false)
setDiagnosticHandler - This method sets unique_ptr to object of DiagnosticHandler to provide custom d...
Context object for machine code objects.
void initTargetMachineFunctionInfo(const TargetSubtargetInfo &STI)
Initialize the target specific MachineFunctionInfo.
void insert(iterator MBBI, MachineBasicBlock *MBB)
LLVM_ABI Result run(Module &M, ModuleAnalysisManager &)
Run the analysis pass and produce machine module information.
virtual ~MachineModuleInfoImpl()
bool doFinalization(Module &) override
doFinalization - Virtual method overriden by subclasses to do any necessary clean up after all passes...
MachineModuleInfoWrapperPass(const TargetMachine *TM=nullptr)
bool doInitialization(Module &) override
doInitialization - Virtual method overridden by subclasses to do any necessary initialization before ...
LLVM_ABI MachineModuleInfo(const TargetMachine *TM=nullptr)
LLVM_ABI void initialize()
LLVM_ABI void insertFunction(const Function &F, std::unique_ptr< MachineFunction > &&MF)
Add an externally created MachineFunction MF for F.
const MCContext & getContext() const
LLVM_ABI MachineFunction & getOrCreateMachineFunction(Function &F)
Returns the MachineFunction constructed for the IR function F.
LLVM_ABI ~MachineModuleInfo()
LLVM_ABI MachineFunction * getMachineFunction(const Function &F) const
Returns the MachineFunction associated to IR function F if there is one, otherwise nullptr.
LLVM_ABI void deleteMachineFunctionFor(Function &F)
Delete the MachineFunction MF and reset the link in the IR Function to Machine Function map.
A Module instance is used to store all the information related to an LLVM module.
Instances of this class encapsulate one diagnostic report, allowing printing to a raw_ostream as a ca...
This owns the files read by a parser, handles include stacks, and handles diagnostic wrangling.
Primary interface to the complete machine description for the target machine.
TargetSubtargetInfo - Generic base class for all target subtargets.
Calculates the starting offsets for various sections within the .debug_names section.
std::enable_if_t< detail::IsValidPointer< X, Y >::value, X * > dyn_extract(Y &&MD)
Extract a Value from Metadata, if any.
This is an optimization pass for GlobalISel generic memory operations.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
LLVM_ABI SourceMgr SrcMgr
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
LLVM_ABI FunctionPass * createFreeMachineFunctionPass()
This pass frees the memory occupied by the MachineFunction.
AnalysisManager< Module > ModuleAnalysisManager
Convenience typedef for the Module analysis manager.
Implement std::hash so that hash_code can be used in STL containers.
A special type used by analysis passes to provide an address that identifies that particular analysis...