Skip to content

Commit 686a889

Browse files
committed
Revert ABI/API changes from b288f7d
This still fixes PR43479, but does it in a way that does not change the libLLVM-9.so ABI.
1 parent 840845a commit 686a889

File tree

3 files changed

+36
-5
lines changed

3 files changed

+36
-5
lines changed

llvm/include/llvm/CodeGen/MachineFunction.h

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -787,9 +787,14 @@ class MachineFunction {
787787
///
788788
/// This is allocated on the function's allocator and so lives the life of
789789
/// the function.
790-
MachineInstr::ExtraInfo *createMIExtraInfo(
791-
ArrayRef<MachineMemOperand *> MMOs, MCSymbol *PreInstrSymbol = nullptr,
792-
MCSymbol *PostInstrSymbol = nullptr, MDNode *HeapAllocMarker = nullptr);
790+
MachineInstr::ExtraInfo *
791+
createMIExtraInfo(ArrayRef<MachineMemOperand *> MMOs,
792+
MCSymbol *PreInstrSymbol = nullptr,
793+
MCSymbol *PostInstrSymbol = nullptr);
794+
795+
MachineInstr::ExtraInfo *createMIExtraInfoWithMarker(
796+
ArrayRef<MachineMemOperand *> MMOs, MCSymbol *PreInstrSymbol,
797+
MCSymbol *PostInstrSymbol, MDNode *HeapAllocMarker);
793798

794799
/// Allocate a string and populate it with the given external symbol name.
795800
const char *createExternalSymbolName(StringRef Name);
@@ -933,6 +938,14 @@ class MachineFunction {
933938
return CodeViewAnnotations;
934939
}
935940

941+
/// Record heapallocsites
942+
void addCodeViewHeapAllocSite(MachineInstr *I, MDNode *MD);
943+
944+
ArrayRef<std::tuple<MCSymbol*, MCSymbol*, DIType*>>
945+
getCodeViewHeapAllocSites() const {
946+
return CodeViewHeapAllocSites;
947+
}
948+
936949
/// Return a reference to the C++ typeinfo for the current function.
937950
const std::vector<const GlobalValue *> &getTypeInfos() const {
938951
return TypeInfos;

llvm/lib/CodeGen/MachineFunction.cpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,15 @@ MachineFunction::getMachineMemOperand(const MachineMemOperand *MMO,
446446
MMO->getOrdering(), MMO->getFailureOrdering());
447447
}
448448

449-
MachineInstr::ExtraInfo *MachineFunction::createMIExtraInfo(
449+
MachineInstr::ExtraInfo *
450+
MachineFunction::createMIExtraInfo(ArrayRef<MachineMemOperand *> MMOs,
451+
MCSymbol *PreInstrSymbol,
452+
MCSymbol *PostInstrSymbol) {
453+
return MachineInstr::ExtraInfo::create(Allocator, MMOs, PreInstrSymbol,
454+
PostInstrSymbol, nullptr);
455+
}
456+
457+
MachineInstr::ExtraInfo *MachineFunction::createMIExtraInfoWithMarker(
450458
ArrayRef<MachineMemOperand *> MMOs, MCSymbol *PreInstrSymbol,
451459
MCSymbol *PostInstrSymbol, MDNode *HeapAllocMarker) {
452460
return MachineInstr::ExtraInfo::create(Allocator, MMOs, PreInstrSymbol,
@@ -822,6 +830,16 @@ try_next:;
822830
return FilterID;
823831
}
824832

833+
void MachineFunction::addCodeViewHeapAllocSite(MachineInstr *I, MDNode *MD) {
834+
MCSymbol *BeginLabel = Ctx.createTempSymbol("heapallocsite", true);
835+
MCSymbol *EndLabel = Ctx.createTempSymbol("heapallocsite", true);
836+
I->setPreInstrSymbol(*this, BeginLabel);
837+
I->setPostInstrSymbol(*this, EndLabel);
838+
839+
DIType *DI = dyn_cast<DIType>(MD);
840+
CodeViewHeapAllocSites.push_back(std::make_tuple(BeginLabel, EndLabel, DI));
841+
}
842+
825843
void MachineFunction::updateCallSiteInfo(const MachineInstr *Old,
826844
const MachineInstr *New) {
827845
if (!Target.Options.EnableDebugEntryValues || Old == New)

llvm/lib/CodeGen/MachineInstr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ void MachineInstr::setExtraInfo(MachineFunction &MF,
338338
// 32-bit pointers.
339339
// FIXME: Maybe we should make the symbols in the extra info mutable?
340340
else if (NumPointers > 1 || HasHeapAllocMarker) {
341-
Info.set<EIIK_OutOfLine>(MF.createMIExtraInfo(
341+
Info.set<EIIK_OutOfLine>(MF.createMIExtraInfoWithMarker(
342342
MMOs, PreInstrSymbol, PostInstrSymbol, HeapAllocMarker));
343343
return;
344344
}

0 commit comments

Comments
 (0)