[llvm] r367324 - Address post commit review comments on revision 366727.

Sean Fertile via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 30 08:37:02 PDT 2019


Author: sfertile
Date: Tue Jul 30 08:37:01 2019
New Revision: 367324

URL: http://llvm.org/viewvc/llvm-project?rev=367324&view=rev
Log:
Address post commit review comments on revision 366727.

Addresses number of comment made on D64652 after commiting:

- Reorders function decls in the TargetLoweringObjectFileXCOFF class.
- Fix comment in MCSectionXCOFF to include description of external reference
  csects.
- Convert several llvm_unreachables to report_fatal_error
- Convert several dyn_casts to casts as they are expected not to fail.
- Avoid copying DataLayout object.

Modified:
    llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
    llvm/trunk/include/llvm/MC/MCSectionXCOFF.h
    llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
    llvm/trunk/lib/MC/MCSectionXCOFF.cpp
    llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp
    llvm/trunk/test/CodeGen/PowerPC/aix-xcoff-common.ll

Modified: llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h?rev=367324&r1=367323&r2=367324&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h (original)
+++ llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h Tue Jul 30 08:37:01 2019
@@ -211,16 +211,13 @@ public:
   TargetLoweringObjectFileXCOFF() = default;
   ~TargetLoweringObjectFileXCOFF() override = default;
 
-  MCSection *getExplicitSectionGlobal(const GlobalObject *GO, SectionKind Kind,
-                                      const TargetMachine &TM) const override;
-
-  MCSection *SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind,
-                                    const TargetMachine &TM) const override;
+  void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
 
   bool shouldPutJumpTableInFunctionSection(bool UsesLabelDifference,
                                            const Function &F) const override;
 
-  void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
+  MCSection *getExplicitSectionGlobal(const GlobalObject *GO, SectionKind Kind,
+                                      const TargetMachine &TM) const override;
 
   MCSection *getStaticCtorSection(unsigned Priority,
                                   const MCSymbol *KeySym) const override;
@@ -230,6 +227,9 @@ public:
   const MCExpr *lowerRelativeReference(const GlobalValue *LHS,
                                        const GlobalValue *RHS,
                                        const TargetMachine &TM) const override;
+
+  MCSection *SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind,
+                                    const TargetMachine &TM) const override;
 };
 
 } // end namespace llvm

Modified: llvm/trunk/include/llvm/MC/MCSectionXCOFF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSectionXCOFF.h?rev=367324&r1=367323&r2=367324&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCSectionXCOFF.h (original)
+++ llvm/trunk/include/llvm/MC/MCSectionXCOFF.h Tue Jul 30 08:37:01 2019
@@ -28,6 +28,9 @@ class MCSymbol;
 //    will have a label definition representing their offset within the csect.
 // 2) Uninitialized: The Type will be XTY_CM, it will contain a single symbol,
 //    and may not contain label definitions.
+// 3) An external reference providing a symbol table entry for a symbol
+//    contained in another XCOFF object file. External reference csects are not
+//    implemented yet.
 class MCSectionXCOFF final : public MCSection {
   friend class MCContext;
 
@@ -40,7 +43,7 @@ class MCSectionXCOFF final : public MCSe
       : MCSection(SV_XCOFF, K, Begin), Name(Section), MappingClass(SMC),
         Type(ST) {
     assert((ST == XCOFF::XTY_SD || ST == XCOFF::XTY_CM) &&
-           "Unexpected type for csect.");
+           "Invalid or unhandled type for csect.");
   }
 
 public:

Modified: llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp?rev=367324&r1=367323&r2=367324&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp (original)
+++ llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp Tue Jul 30 08:37:01 2019
@@ -1826,7 +1826,7 @@ MCSection *TargetLoweringObjectFileWasm:
 //===----------------------------------------------------------------------===//
 MCSection *TargetLoweringObjectFileXCOFF::getExplicitSectionGlobal(
     const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const {
-  llvm_unreachable("XCOFF explicit sections not yet implemented.");
+  report_fatal_error("XCOFF explicit sections not yet implemented.");
 }
 
 MCSection *TargetLoweringObjectFileXCOFF::SelectSectionForGlobal(
@@ -1851,7 +1851,7 @@ MCSection *TargetLoweringObjectFileXCOFF
 
 bool TargetLoweringObjectFileXCOFF::shouldPutJumpTableInFunctionSection(
     bool UsesLabelDifference, const Function &F) const {
-  llvm_unreachable("TLOF XCOFF not yet implemented.");
+  report_fatal_error("TLOF XCOFF not yet implemented.");
 }
 
 void TargetLoweringObjectFileXCOFF::Initialize(MCContext &Ctx,
@@ -1864,16 +1864,16 @@ void TargetLoweringObjectFileXCOFF::Init
 
 MCSection *TargetLoweringObjectFileXCOFF::getStaticCtorSection(
     unsigned Priority, const MCSymbol *KeySym) const {
-  llvm_unreachable("XCOFF ctor section not yet implemented.");
+  report_fatal_error("XCOFF ctor section not yet implemented.");
 }
 
 MCSection *TargetLoweringObjectFileXCOFF::getStaticDtorSection(
     unsigned Priority, const MCSymbol *KeySym) const {
-  llvm_unreachable("XCOFF dtor section not yet implemented.");
+  report_fatal_error("XCOFF dtor section not yet implemented.");
 }
 
 const MCExpr *TargetLoweringObjectFileXCOFF::lowerRelativeReference(
     const GlobalValue *LHS, const GlobalValue *RHS,
     const TargetMachine &TM) const {
-  llvm_unreachable("XCOFF not yet implemented.");
+  report_fatal_error("XCOFF not yet implemented.");
 }

Modified: llvm/trunk/lib/MC/MCSectionXCOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCSectionXCOFF.cpp?rev=367324&r1=367323&r2=367324&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCSectionXCOFF.cpp (original)
+++ llvm/trunk/lib/MC/MCSectionXCOFF.cpp Tue Jul 30 08:37:01 2019
@@ -32,7 +32,7 @@ void MCSectionXCOFF::PrintSwitchToSectio
     if (getMappingClass() != XCOFF::XMC_RW)
       llvm_unreachable("Unsupported storage-mapping class for common csect");
     if (getCSectType() != XCOFF::XTY_CM)
-      llvm_unreachable("wrong csect type for common csect");
+      llvm_unreachable("wrong csect type for .bss csect");
     // Don't have to print a directive for switching to section for commons.
     // '.comm' and '.lcomm' directives for the variable will create the needed
     // csect.

Modified: llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp?rev=367324&r1=367323&r2=367324&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp Tue Jul 30 08:37:01 2019
@@ -1656,20 +1656,20 @@ void PPCAIXAsmPrinter::EmitGlobalVariabl
     report_fatal_error("Custom section for Data not yet supported.");
 
   if (GV->hasComdat())
-    report_fatal_error("COMDAT not yet supported on AIX.");
+    report_fatal_error("COMDAT not yet supported by AIX.");
 
   SectionKind GVKind = getObjFileLowering().getKindForGlobal(GV, TM);
   if (!GVKind.isCommon())
-    report_fatal_error("Only common variables are supported on AIX.");
+    report_fatal_error("Only common variables are supported on AIX for now.");
 
   // Create the containing csect and switch to it.
-  MCSectionXCOFF *CSect = dyn_cast<MCSectionXCOFF>(
+  MCSectionXCOFF *CSect = cast<MCSectionXCOFF>(
       getObjFileLowering().SectionForGlobal(GV, GVKind, TM));
   OutStreamer->SwitchSection(CSect);
 
   // Create the symbol and emit it.
-  MCSymbolXCOFF *XSym = dyn_cast<MCSymbolXCOFF>(getSymbol(GV));
-  auto DL = GV->getParent()->getDataLayout();
+  MCSymbolXCOFF *XSym = cast<MCSymbolXCOFF>(getSymbol(GV));
+  const DataLayout &DL = GV->getParent()->getDataLayout();
   unsigned Align =
       GV->getAlignment() ? GV->getAlignment() : DL.getPreferredAlignment(GV);
   uint64_t Size = DL.getTypeAllocSize(GV->getType()->getElementType());

Modified: llvm/trunk/test/CodeGen/PowerPC/aix-xcoff-common.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/aix-xcoff-common.ll?rev=367324&r1=367323&r2=367324&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/aix-xcoff-common.ll (original)
+++ llvm/trunk/test/CodeGen/PowerPC/aix-xcoff-common.ll Tue Jul 30 08:37:01 2019
@@ -6,7 +6,6 @@
 
 @d = common local_unnamed_addr global double 0.000000e+00, align 8
 @f = common local_unnamed_addr global float 0.000000e+00, align 4
- at comm = common local_unnamed_addr global double 0.000000e+00, align 8
 
 @over_aligned = common local_unnamed_addr global double 0.000000e+00, align 32
 
@@ -19,6 +18,5 @@
 ; CHECK-NEXT: .comm   c,2,1
 ; CHECK-NEXT: .comm   d,8,3
 ; CHECK-NEXT: .comm   f,4,2
-; CHECK-NEXT: .comm   comm,8,3
 ; CHECK-NEXT: .comm   over_aligned,8,5
 ; CHECK-NEXT: .comm   array,32,0




More information about the llvm-commits mailing list