|
@@ -363,6 +363,13 @@ MachineInstr &MachineFunction::CloneMachineInstrBundle(MachineBasicBlock &MBB,
|
|
|
/// ~MachineInstr() destructor must be empty.
|
|
|
void
|
|
|
MachineFunction::DeleteMachineInstr(MachineInstr *MI) {
|
|
|
+ // Verify that a call site info is at valid state. This assertion should
|
|
|
+ // be triggered during the implementation of support for the
|
|
|
+ // call site info of a new architecture. If the assertion is triggered,
|
|
|
+ // back trace will tell where to insert a call to updateCallSiteInfo().
|
|
|
+ assert((!MI->isCall(MachineInstr::IgnoreBundle) ||
|
|
|
+ CallSitesInfo.find(MI) == CallSitesInfo.end()) &&
|
|
|
+ "Call site info was not updated!");
|
|
|
// Strip it for parts. The operand array and the MI object itself are
|
|
|
// independently recyclable.
|
|
|
if (MI->Operands)
|
|
@@ -826,6 +833,22 @@ void MachineFunction::addCodeViewHeapAllocSite(MachineInstr *I, MDNode *MD) {
|
|
|
CodeViewHeapAllocSites.push_back(std::make_tuple(BeginLabel, EndLabel, DI));
|
|
|
}
|
|
|
|
|
|
+void MachineFunction::updateCallSiteInfo(const MachineInstr *Old,
|
|
|
+ const MachineInstr *New) {
|
|
|
+ if (!Target.Options.EnableDebugEntryValues || Old == New)
|
|
|
+ return;
|
|
|
+
|
|
|
+ assert(Old->isCall() && (!New || New->isCall()) &&
|
|
|
+ "Call site info referes only to call instructions!");
|
|
|
+ CallSiteInfoMap::iterator CSIt = CallSitesInfo.find(Old);
|
|
|
+ if (CSIt == CallSitesInfo.end())
|
|
|
+ return;
|
|
|
+ CallSiteInfo CSInfo = std::move(CSIt->second);
|
|
|
+ CallSitesInfo.erase(CSIt);
|
|
|
+ if (New)
|
|
|
+ CallSitesInfo[New] = CSInfo;
|
|
|
+}
|
|
|
+
|
|
|
/// \}
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|