@@ -354,11 +354,6 @@ class LLVM_ABI MachineFunction {
354354 // / a table of valid targets for Windows EHCont Guard.
355355 std::vector<MCSymbol *> CatchretTargets;
356356
357- // / Mapping of call instruction to the global value and target flags that it
358- // / calls, if applicable.
359- DenseMap<const MachineInstr *, std::pair<const GlobalValue *, unsigned >>
360- CalledGlobalsMap;
361-
362357 // / \name Exception Handling
363358 // / \{
364359
@@ -494,6 +489,11 @@ class LLVM_ABI MachineFunction {
494489 SmallVector<ArgRegPair, 1 > ArgRegPairs;
495490 };
496491
492+ struct CalledGlobalInfo {
493+ const GlobalValue *Callee;
494+ unsigned TargetFlags;
495+ };
496+
497497private:
498498 Delegate *TheDelegate = nullptr ;
499499 GISelChangeObserver *Observer = nullptr ;
@@ -506,6 +506,11 @@ class LLVM_ABI MachineFunction {
506506 // / instruction if debug entry value support is enabled.
507507 CallSiteInfoMap::iterator getCallSiteInfo (const MachineInstr *MI);
508508
509+ using CalledGlobalsMap = DenseMap<const MachineInstr *, CalledGlobalInfo>;
510+ // / Mapping of call instruction to the global value and target flags that it
511+ // / calls, if applicable.
512+ CalledGlobalsMap CalledGlobalsInfo;
513+
509514 // Callbacks for insertion and removal.
510515 void handleInsertion (MachineInstr &MI);
511516 void handleRemoval (MachineInstr &MI);
@@ -1189,22 +1194,20 @@ class LLVM_ABI MachineFunction {
11891194
11901195 // / Tries to get the global and target flags for a call site, if the
11911196 // / instruction is a call to a global.
1192- std::pair<const GlobalValue *, unsigned >
1193- tryGetCalledGlobal (const MachineInstr *MI) const {
1194- return CalledGlobalsMap.lookup (MI);
1197+ CalledGlobalInfo tryGetCalledGlobal (const MachineInstr *MI) const {
1198+ return CalledGlobalsInfo.lookup (MI);
11951199 }
11961200
11971201 // / Notes the global and target flags for a call site.
1198- void addCalledGlobal (const MachineInstr *MI,
1199- std::pair<const GlobalValue *, unsigned > Details) {
1202+ void addCalledGlobal (const MachineInstr *MI, CalledGlobalInfo Details) {
12001203 assert (MI && " MI must not be null" );
1201- assert (Details.first && " Global must not be null" );
1202- CalledGlobalsMap .insert ({MI, Details});
1204+ assert (Details.Callee && " Global must not be null" );
1205+ CalledGlobalsInfo .insert ({MI, Details});
12031206 }
12041207
12051208 // / Iterates over the full set of call sites and their associated globals.
12061209 auto getCalledGlobals () const {
1207- return llvm::make_range (CalledGlobalsMap .begin (), CalledGlobalsMap .end ());
1210+ return llvm::make_range (CalledGlobalsInfo .begin (), CalledGlobalsInfo .end ());
12081211 }
12091212
12101213 // / \name Exception Handling
@@ -1383,7 +1386,7 @@ class LLVM_ABI MachineFunction {
13831386
13841387 // / Start tracking the arguments passed to the call \p CallI.
13851388 void addCallSiteInfo (const MachineInstr *CallI, CallSiteInfo &&CallInfo) {
1386- assert (CallI->isCandidateForCallSiteEntry ());
1389+ assert (CallI->isCandidateForAdditionalCallInfo ());
13871390 bool Inserted =
13881391 CallSitesInfo.try_emplace (CallI, std::move (CallInfo)).second ;
13891392 (void )Inserted;
@@ -1399,18 +1402,16 @@ class LLVM_ABI MachineFunction {
13991402
14001403 // / Erase the call site info for \p MI. It is used to remove a call
14011404 // / instruction from the instruction stream.
1402- void eraseCallSiteInfo (const MachineInstr *MI);
1405+ void eraseAdditionalCallInfo (const MachineInstr *MI);
14031406 // / Copy the call site info from \p Old to \ New. Its usage is when we are
14041407 // / making a copy of the instruction that will be inserted at different point
14051408 // / of the instruction stream.
1406- void copyCallSiteInfo (const MachineInstr *Old,
1407- const MachineInstr *New);
1409+ void copyAdditionalCallInfo (const MachineInstr *Old, const MachineInstr *New);
14081410
14091411 // / Move the call site info from \p Old to \New call site info. This function
14101412 // / is used when we are replacing one call instruction with another one to
14111413 // / the same callee.
1412- void moveCallSiteInfo (const MachineInstr *Old,
1413- const MachineInstr *New);
1414+ void moveAdditionalCallInfo (const MachineInstr *Old, const MachineInstr *New);
14141415
14151416 unsigned getNewDebugInstrNum () {
14161417 return ++DebugInstrNumberingCount;
0 commit comments