[llvm] r212000 - CodeGen: rename Win64 ExceptionHandling to WinEH

Saleem Abdulrasool compnerd at compnerd.org
Sun Jun 29 14:43:48 PDT 2014


Author: compnerd
Date: Sun Jun 29 16:43:47 2014
New Revision: 212000

URL: http://llvm.org/viewvc/llvm-project?rev=212000&view=rev
Log:
CodeGen: rename Win64 ExceptionHandling to WinEH

This exception format is not specific to Windows x64.  A similar approach is
taken on nearly all architectures.  Generalise the name to reflect reality.
This will eventually be used for Windows on ARM data emission as well.

Switch the enum and namespace into an enum class.

Modified:
    llvm/trunk/include/llvm/MC/MCAsmInfo.h
    llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
    llvm/trunk/lib/CodeGen/Passes.cpp
    llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp
    llvm/trunk/lib/Target/X86/X86FrameLowering.cpp

Modified: llvm/trunk/include/llvm/MC/MCAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAsmInfo.h?rev=212000&r1=211999&r2=212000&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCAsmInfo.h (original)
+++ llvm/trunk/include/llvm/MC/MCAsmInfo.h Sun Jun 29 16:43:47 2014
@@ -41,9 +41,13 @@ enum class EncodingType {
 };
 }
 
-namespace ExceptionHandling {
-enum ExceptionsType { None, DwarfCFI, SjLj, ARM, Win64 };
-}
+enum class ExceptionHandling {
+  None,     /// No exception support
+  DwarfCFI, /// DWARF-like instruction based exceptions
+  SjLj,     /// setjmp/longjmp based exceptions
+  ARM,      /// ARM EHABI
+  WinEH,    /// Windows Exception Handling
+};
 
 namespace LCOMM {
 enum LCOMMType { NoAlignment, ByteAlignment, Log2Alignment };
@@ -299,7 +303,7 @@ protected:
   bool SupportsDebugInformation;
 
   /// Exception handling format for the target.  Defaults to None.
-  ExceptionHandling::ExceptionsType ExceptionsType;
+  ExceptionHandling ExceptionsType;
 
   /// Windows exception handling data (.pdata) encoding.  Defaults to Invalid.
   WinEH::EncodingType WinEHEncodingType;
@@ -472,17 +476,13 @@ public:
   bool doesSupportExceptionHandling() const {
     return ExceptionsType != ExceptionHandling::None;
   }
-  ExceptionHandling::ExceptionsType getExceptionHandlingType() const {
-    return ExceptionsType;
-  }
-  WinEH::EncodingType getWinEHEncodingType() const {
-    return WinEHEncodingType;
-  }
+  ExceptionHandling getExceptionHandlingType() const { return ExceptionsType; }
+  WinEH::EncodingType getWinEHEncodingType() const { return WinEHEncodingType; }
   bool isExceptionHandlingDwarf() const {
     return (ExceptionsType == ExceptionHandling::DwarfCFI ||
             ExceptionsType == ExceptionHandling::ARM ||
-            // Win64 handler data still uses DWARF LSDA encoding.
-            ExceptionsType == ExceptionHandling::Win64);
+            // Windows handler data still uses DWARF LSDA encoding.
+            ExceptionsType == ExceptionHandling::WinEH);
   }
   bool doesDwarfUseRelocationsAcrossSections() const {
     return DwarfUsesRelocationsAcrossSections;

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=212000&r1=211999&r2=212000&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Sun Jun 29 16:43:47 2014
@@ -243,7 +243,7 @@ bool AsmPrinter::doInitialization(Module
   case ExceptionHandling::ARM:
     ES = new ARMException(this);
     break;
-  case ExceptionHandling::Win64:
+  case ExceptionHandling::WinEH:
     ES = new Win64Exception(this);
     break;
   }
@@ -709,13 +709,12 @@ AsmPrinter::CFIMoveType AsmPrinter::need
 }
 
 bool AsmPrinter::needsSEHMoves() {
-  return MAI->getExceptionHandlingType() == ExceptionHandling::Win64 &&
+  return MAI->getExceptionHandlingType() == ExceptionHandling::WinEH &&
     MF->getFunction()->needsUnwindTableEntry();
 }
 
 void AsmPrinter::emitCFIInstruction(const MachineInstr &MI) {
-  ExceptionHandling::ExceptionsType ExceptionHandlingType =
-      MAI->getExceptionHandlingType();
+  ExceptionHandling ExceptionHandlingType = MAI->getExceptionHandlingType();
   if (ExceptionHandlingType != ExceptionHandling::DwarfCFI &&
       ExceptionHandlingType != ExceptionHandling::ARM)
     return;

Modified: llvm/trunk/lib/CodeGen/Passes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/Passes.cpp?rev=212000&r1=211999&r2=212000&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/Passes.cpp (original)
+++ llvm/trunk/lib/CodeGen/Passes.cpp Sun Jun 29 16:43:47 2014
@@ -416,7 +416,7 @@ void TargetPassConfig::addPassesToHandle
     // FALLTHROUGH
   case ExceptionHandling::DwarfCFI:
   case ExceptionHandling::ARM:
-  case ExceptionHandling::Win64:
+  case ExceptionHandling::WinEH:
     addPass(createDwarfEHPass(TM));
     break;
   case ExceptionHandling::None:

Modified: llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp?rev=212000&r1=211999&r2=212000&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp Sun Jun 29 16:43:47 2014
@@ -146,7 +146,7 @@ X86MCAsmInfoMicrosoft::X86MCAsmInfoMicro
   if (Triple.getArch() == Triple::x86_64) {
     PrivateGlobalPrefix = ".L";
     PointerSize = 8;
-    ExceptionsType = ExceptionHandling::Win64;
+    ExceptionsType = ExceptionHandling::WinEH;
   }
 
   AssemblerDialect = AsmWriterFlavor;
@@ -165,7 +165,7 @@ X86MCAsmInfoGNUCOFF::X86MCAsmInfoGNUCOFF
   if (Triple.getArch() == Triple::x86_64) {
     PrivateGlobalPrefix = ".L";
     PointerSize = 8;
-    ExceptionsType = ExceptionHandling::Win64;
+    ExceptionsType = ExceptionHandling::WinEH;
   } else {
     ExceptionsType = ExceptionHandling::DwarfCFI;
   }

Modified: llvm/trunk/lib/Target/X86/X86FrameLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FrameLowering.cpp?rev=212000&r1=211999&r2=212000&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86FrameLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86FrameLowering.cpp Sun Jun 29 16:43:47 2014
@@ -451,12 +451,12 @@ void X86FrameLowering::emitPrologue(Mach
   bool Is64Bit = STI.is64Bit();
   bool IsLP64 = STI.isTarget64BitLP64();
   bool IsWin64 = STI.isTargetWin64();
-  bool IsSEH =
+  bool IsWinEH =
       MF.getTarget().getMCAsmInfo()->getExceptionHandlingType() ==
-      ExceptionHandling::Win64; // Not necessarily synonymous with IsWin64.
-  bool NeedsWin64SEH = IsSEH && Fn->needsUnwindTableEntry();
+      ExceptionHandling::WinEH; // Not necessarily synonymous with IsWin64.
+  bool NeedsWinEH = IsWinEH && Fn->needsUnwindTableEntry();
   bool NeedsDwarfCFI =
-      !IsSEH && (MMI.hasDebugInfo() || Fn->needsUnwindTableEntry());
+      !IsWinEH && (MMI.hasDebugInfo() || Fn->needsUnwindTableEntry());
   bool UseLEA = STI.useLeaForSP();
   unsigned StackAlign = getStackAlignment();
   unsigned SlotSize = RegInfo->getSlotSize();
@@ -572,7 +572,7 @@ void X86FrameLowering::emitPrologue(Mach
           .addCFIIndex(CFIIndex);
     }
 
-    if (NeedsWin64SEH) {
+    if (NeedsWinEH) {
       BuildMI(MBB, MBBI, DL, TII.get(X86::SEH_PushReg))
           .addImm(FramePtr)
           .setMIFlag(MachineInstr::FrameSetup);
@@ -623,7 +623,7 @@ void X86FrameLowering::emitPrologue(Mach
       StackOffset += stackGrowth;
     }
 
-    if (NeedsWin64SEH) {
+    if (NeedsWinEH) {
       BuildMI(MBB, MBBI, DL, TII.get(X86::SEH_PushReg)).addImm(Reg).setMIFlag(
           MachineInstr::FrameSetup);
     }
@@ -735,7 +735,7 @@ void X86FrameLowering::emitPrologue(Mach
   }
 
   int SEHFrameOffset = 0;
-  if (NeedsWin64SEH) {
+  if (NeedsWinEH) {
     if (HasFP) {
       // We need to set frame base offset low enough such that all saved
       // register offsets would be positive relative to it, but we can't
@@ -775,7 +775,7 @@ void X86FrameLowering::emitPrologue(Mach
     ++MBBI;
 
   // Emit SEH info for non-GPRs
-  if (NeedsWin64SEH) {
+  if (NeedsWinEH) {
     for (const CalleeSavedInfo &Info : MFI->getCalleeSavedInfo()) {
       unsigned Reg = Info.getReg();
       if (X86::GR64RegClass.contains(Reg) || X86::GR32RegClass.contains(Reg))





More information about the llvm-commits mailing list