Skip to content

Commit c10130f

Browse files
committed
AsmPrinter: Avoid use of MachineFunction::getMMI
1 parent bb60c3e commit c10130f

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,8 +1669,8 @@ void AsmPrinter::emitPCSections(const MachineFunction &MF) {
16691669
}
16701670

16711671
/// Returns true if function begin and end labels should be emitted.
1672-
static bool needFuncLabels(const MachineFunction &MF) {
1673-
MachineModuleInfo &MMI = MF.getMMI();
1672+
static bool needFuncLabels(const MachineFunction &MF,
1673+
const MachineModuleInfo &MMI) {
16741674
if (!MF.getLandingPads().empty() || MF.hasEHFunclets() ||
16751675
MMI.hasDebugInfo() ||
16761676
MF.getFunction().hasMetadata(LLVMContext::MD_pcsections))
@@ -1944,7 +1944,7 @@ void AsmPrinter::emitFunctionBody() {
19441944
// are automatically sized.
19451945
bool EmitFunctionSize = MAI->hasDotTypeDotSizeDirective() && !TT.isWasm();
19461946

1947-
if (needFuncLabels(*MF) || EmitFunctionSize) {
1947+
if (needFuncLabels(*MF, *MMI) || EmitFunctionSize) {
19481948
// Create a symbol for the end of function.
19491949
CurrentFnEnd = createTempSymbol("func_end");
19501950
OutStreamer->emitLabel(CurrentFnEnd);
@@ -2587,8 +2587,9 @@ void AsmPrinter::SetupMachineFunction(MachineFunction &MF) {
25872587
bool NeedsLocalForSize = MAI->needsLocalForSize();
25882588
if (F.hasFnAttribute("patchable-function-entry") ||
25892589
F.hasFnAttribute("function-instrument") ||
2590-
F.hasFnAttribute("xray-instruction-threshold") || needFuncLabels(MF) ||
2591-
NeedsLocalForSize || MF.getTarget().Options.EmitStackSizeSection ||
2590+
F.hasFnAttribute("xray-instruction-threshold") ||
2591+
needFuncLabels(MF, *MMI) || NeedsLocalForSize ||
2592+
MF.getTarget().Options.EmitStackSizeSection ||
25922593
MF.getTarget().Options.BBAddrMap || MF.hasBBLabels()) {
25932594
CurrentFnBegin = createTempSymbol("func_begin");
25942595
if (NeedsLocalForSize)

llvm/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void DwarfCFIException::beginFunction(const MachineFunction *MF) {
9090
shouldEmitLSDA = shouldEmitPersonality &&
9191
LSDAEncoding != dwarf::DW_EH_PE_omit;
9292

93-
const MCAsmInfo &MAI = *MF->getMMI().getContext().getAsmInfo();
93+
const MCAsmInfo &MAI = *MF->getContext().getAsmInfo();
9494
if (MAI.getExceptionHandlingType() != ExceptionHandling::None)
9595
shouldEmitCFI =
9696
MAI.usesCFIForEH() && (shouldEmitPersonality || shouldEmitMoves);

0 commit comments

Comments
 (0)