[PATCH] D76162: [AIX] discard the label in the csect of function description and use qualname for linkage

Jason Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 25 08:04:46 PDT 2020


jasonliu added a comment.

Some last cleanups needed...



================
Comment at: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1543
 void PPCAIXAsmPrinter::SetupMachineFunction(MachineFunction &MF) {
-  // Get the function descriptor symbol.
-  CurrentFnDescSym = getSymbol(&MF.getFunction());
   // Set the alignment and the containing csect.
+  MCSectionXCOFF *FnDescSec =
----------------
We should modify the comment a bit to something like:
// Setup CurrentFnDescSym and its containing csect.


================
Comment at: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1550
+  CurrentFnDescSym = FnDescSec->getQualNameSymbol();
   cast<MCSymbolXCOFF>(CurrentFnDescSym)->setContainingCsect(FnDescSec);
 
----------------
This line could be removed, as the symbol returned from getQualNameSymbol() should already have its csect set. 


================
Comment at: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1569
   if (const Function *F = dyn_cast<Function>(CV)) {
     MCSymbolXCOFF *FSym = cast<MCSymbolXCOFF>(getSymbol(F));
     if (!FSym->hasContainingCsect()) {
----------------
I think we could remove this FSym now, as it's not needed and it's better if we actually remove its existant from MCContext. 
This if block could rewrite to:

```
  if (const Function *F = dyn_cast<Function>(CV)) {
    const MCSectionXCOFF *Csect = cast<MCSectionXCOFF>(
            F->isDeclaration()
                ? getObjFileLowering().getSectionForExternalReference(F, TM)
                : getObjFileLowering().getSectionForFunctionDescriptor(F, TM));
     return MCSymbolRefExpr::create(Csect->getQualNameSymbol(), OutContext);
   }
```



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76162





More information about the llvm-commits mailing list