CodeGen: indicate Windows unwind data format
authorSaleem Abdulrasool <compnerd@compnerd.org>
Mon, 1 Sep 2014 23:48:39 +0000 (23:48 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Mon, 1 Sep 2014 23:48:39 +0000 (23:48 +0000)
The structures for Windows unwinding are shared across multiple platforms.
Indicate the encoding to be used for the particular target.  Use this to switch
the unwind emitter instantiated by the AsmPrinter.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216895 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp

index c2fd91830f5245908c84a4f232edb95bddc7bc2a..4319a5771171ec65da980a9be5617f2e1318a9c4 100644 (file)
@@ -244,7 +244,12 @@ bool AsmPrinter::doInitialization(Module &M) {
     ES = new ARMException(this);
     break;
   case ExceptionHandling::WinEH:
-    ES = new Win64Exception(this);
+    switch (MAI->getWinEHEncodingType()) {
+    default: llvm_unreachable("unsupported unwinding information encoding");
+    case WinEH::EncodingType::Itanium:
+      ES = new Win64Exception(this);
+      break;
+    }
     break;
   }
   if (ES)
index 8e7e53051997bd39537cb721e6fbfeae51a85b61..63aa0861fcc6c62bb5de4e6b2c163bd62b6ce5cc 100644 (file)
@@ -142,6 +142,7 @@ X86MCAsmInfoMicrosoft::X86MCAsmInfoMicrosoft(const Triple &Triple) {
   if (Triple.getArch() == Triple::x86_64) {
     PrivateGlobalPrefix = ".L";
     PointerSize = 8;
+    WinEHEncodingType = WinEH::EncodingType::Itanium;
     ExceptionsType = ExceptionHandling::WinEH;
   }
 
@@ -161,6 +162,7 @@ X86MCAsmInfoGNUCOFF::X86MCAsmInfoGNUCOFF(const Triple &Triple) {
   if (Triple.getArch() == Triple::x86_64) {
     PrivateGlobalPrefix = ".L";
     PointerSize = 8;
+    WinEHEncodingType = WinEH::EncodingType::Itanium;
     ExceptionsType = ExceptionHandling::WinEH;
   } else {
     ExceptionsType = ExceptionHandling::DwarfCFI;