[llvm] a3515ab - [MC][Target][XCOFF] Consolidate MCAsmInfo XCOFF defaults; NFC

Hubert Tong via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 30 17:48:39 PDT 2020


Author: Hubert Tong
Date: 2020-04-30T20:48:30-04:00
New Revision: a3515ab8af8aa2db463def55ba6a477b24e64a54

URL: https://github.com/llvm/llvm-project/commit/a3515ab8af8aa2db463def55ba6a477b24e64a54
DIFF: https://github.com/llvm/llvm-project/commit/a3515ab8af8aa2db463def55ba6a477b24e64a54.diff

LOG: [MC][Target][XCOFF] Consolidate MCAsmInfo XCOFF defaults; NFC

The setting of `MCAsmInfo` properties for XCOFF got split between
`MCAsmInfoXCOFF` and `PPCXCOFFMCAsmInfo`. Except for the properties that
are dependent on the target information being passed via the
constructor, the properties being set in `PPCXCOFFMCAsmInfo` had no
fundamental reason for being treated as specific for XCOFF on PowerPC.
Indeed, the property that might be considered more specific to PowerPC,
`NeedsFunctionDescriptors`, was set in `MCAsmInfoXCOFF`.

XCOFF being specific to PowerPC anyway, this patch consolidates the
setting of the properties into `MCAsmInfoXCOFF` except for the cases
that are dependent on the information provided via the
`PPCXCOFFMCAsmInfo` constructor.

This patch also reorders the assignments to the fields to match the
declaration order in `MCAsmInfo`.

Added: 
    

Modified: 
    llvm/lib/MC/MCAsmInfoXCOFF.cpp
    llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/MC/MCAsmInfoXCOFF.cpp b/llvm/lib/MC/MCAsmInfoXCOFF.cpp
index 8e90b72f8c52..479578fca9a8 100644
--- a/llvm/lib/MC/MCAsmInfoXCOFF.cpp
+++ b/llvm/lib/MC/MCAsmInfoXCOFF.cpp
@@ -14,17 +14,21 @@ void MCAsmInfoXCOFF::anchor() {}
 
 MCAsmInfoXCOFF::MCAsmInfoXCOFF() {
   IsLittleEndian = false;
-  HasDotTypeDotSizeDirective = false;
-  HasDotExternDirective = true;
-  COMMDirectiveAlignmentIsInBytes = false;
-  LCOMMDirectiveAlignmentType = LCOMM::Log2Alignment;
+  SupportsQuotedNames = false;
   UseDotAlignForAlignment = true;
+  ZeroDirective = "\t.space\t";
+  ZeroDirectiveSupportsNonZeroValue = false;
   AsciiDirective = nullptr; // not supported
   AscizDirective = nullptr; // not supported
-  NeedsFunctionDescriptors = true;
-  HasDotLGloblDirective = true;
   Data64bitsDirective = "\t.llong\t";
-  SupportsQuotedNames = false;
+  COMMDirectiveAlignmentIsInBytes = false;
+  LCOMMDirectiveAlignmentType = LCOMM::Log2Alignment;
+  HasDotTypeDotSizeDirective = false;
+  HasDotExternDirective = true;
+  HasDotLGloblDirective = true;
+  SymbolsHaveSMC = true;
+  UseIntegratedAssembler = false;
+  NeedsFunctionDescriptors = true;
 }
 
 bool MCAsmInfoXCOFF::isAcceptableChar(char C) const {

diff  --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp
index 8faf1bad7375..39c5c0fa9746 100644
--- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp
+++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp
@@ -58,8 +58,4 @@ void PPCXCOFFMCAsmInfo::anchor() {}
 PPCXCOFFMCAsmInfo::PPCXCOFFMCAsmInfo(bool Is64Bit, const Triple &T) {
   assert(!IsLittleEndian && "Little-endian XCOFF not supported.");
   CodePointerSize = CalleeSaveStackSlotSize = Is64Bit ? 8 : 4;
-  ZeroDirective = "\t.space\t";
-  ZeroDirectiveSupportsNonZeroValue = false;
-  SymbolsHaveSMC = true;
-  UseIntegratedAssembler = false;
 }


        


More information about the llvm-commits mailing list