Use .cfi_sections to put the unwind info in .debug_frame when possible. With
this clang will use .debug_frame in, for example,
clang -g -c -m32 test.c
This matches gcc's behaviour. It looks like .debug_frame is a bit bigger
than .eh_frame, but has the big advantage of not being allocated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131140 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index d88f05b..7f39cef 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -592,17 +592,17 @@
return true;
}
-bool AsmPrinter::needsCFIMoves() {
+AsmPrinter::CFIMoveType AsmPrinter::needsCFIMoves() {
if (UnwindTablesMandatory)
- return true;
+ return CFI_M_EH;
+
+ if (!MF->getFunction()->doesNotThrow())
+ return CFI_M_EH;
if (MMI->hasDebugInfo())
- return true;
+ return CFI_M_Debug;
- if (MF->getFunction()->doesNotThrow())
- return false;
-
- return true;
+ return CFI_M_None;
}
void AsmPrinter::emitPrologLabel(const MachineInstr &MI) {
@@ -611,7 +611,7 @@
if (MAI->getExceptionHandlingType() != ExceptionHandling::DwarfCFI)
return;
- if (!needsCFIMoves())
+ if (needsCFIMoves() == CFI_M_None)
return;
MachineModuleInfo &MMI = MF->getMMI();