[PATCH] D122258: [MC] Omit DWARF unwind info if compact unwind is present for all archs

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 26 20:38:57 PDT 2022


int3 added inline comments.


================
Comment at: llvm/lib/CodeGen/MachineModuleInfo.cpp:69
               MMI.TM.getMCRegisterInfo(), MMI.TM.getMCSubtargetInfo(), nullptr,
-              nullptr, false),
+              &MMI.TM.Options.MCOptions, false),
       MachineFunctions(std::move(MMI.MachineFunctions)) {
----------------
`MCTargetOptions` isn't passed directly to `MCObjectFileInfo`; it only gets an `MCContext`. `MCContext` already has a member pointer to MCTargetOptions, but it seemed not to be initialized in a number of cases, hence the need for this change.


================
Comment at: llvm/tools/llc/llc.cpp:697-700
+    auto &Ctx = MMIWP->getMMI().getContext();
+    Ctx.setGenDwarfForAssembly(Target->Options.ForceDwarfFrameSection);
     const_cast<TargetLoweringObjectFile *>(LLVMTM.getObjFileLowering())
+        ->Initialize(Ctx, *Target);
----------------
lhames wrote:
> int3 wrote:
> > int3 wrote:
> > > lhames wrote:
> > > > This option hand-off feels very manual. I wonder if we should add a `propagateTargetOptionsToMC` function, but maybe the set of options that it would apply to is small enough not to bother for now?
> > > > 
> > > > I would add something like this to `LLVMTargetMachine::addPassesToEmitMC` too, for the the case where the caller passes in a null `MCContext*`. 
> > > thanks for the pointers! I'll look into that
> > actually, I'm not sure I understood your suggestion... which class do you envision `propagateTargetOptionsToMC` being defined in? How would it make things "less manual"?
> Oh! `TargetOptions` has an `MCTargetOptions` member already. If `GenDwarfUnwindInfo` === `ForceDwarfUnwindInfo`, could you just sink `ForceDwarfUnwindInfo` into `MCTargetOptions`? 
alright, I think I got it to work :)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122258/new/

https://reviews.llvm.org/D122258



More information about the llvm-commits mailing list