[llvm-commits] [llvm] r49361 - in /llvm/trunk: include/llvm/Target/TargetOptions.h lib/CodeGen/DwarfWriter.cpp lib/Target/PowerPC/PPCRegisterInfo.cpp lib/Target/TargetMachine.cpp lib/Target/X86/X86RegisterInfo.cpp
Dale Johannesen
dalej at apple.com
Mon Apr 7 17:10:24 PDT 2008
Author: johannes
Date: Mon Apr 7 19:10:24 2008
New Revision: 49361
URL: http://llvm.org/viewvc/llvm-project?rev=49361&view=rev
Log:
Implement new llc flag -disable-required-unwind-tables.
Corresponds to -fno-unwind-tables (usually default in gcc).
Modified:
llvm/trunk/include/llvm/Target/TargetOptions.h
llvm/trunk/lib/CodeGen/DwarfWriter.cpp
llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp
llvm/trunk/lib/Target/TargetMachine.cpp
llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
Modified: llvm/trunk/include/llvm/Target/TargetOptions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetOptions.h?rev=49361&r1=49360&r2=49361&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetOptions.h (original)
+++ llvm/trunk/include/llvm/Target/TargetOptions.h Mon Apr 7 19:10:24 2008
@@ -74,13 +74,18 @@
/// be emitted.
extern bool ExceptionHandling;
+ /// UnwindTablesOptional - This flag indicates that unwind tables need not
+ /// be emitted for all functions. Exception handling may still require them
+ /// for some functions.
+ extern bool UnwindTablesOptional;
+
/// PerformTailCallOpt - This flag is enabled when -tailcallopt is specified
/// on the commandline. When the flag is on, the target will perform tail call
/// optimization (pop the caller's stack) providing it supports it.
extern bool PerformTailCallOpt;
- /// OptimizeForSize - When this flags is set, code generator avoids optimization
- /// that increases size.
+ /// OptimizeForSize - When this flag is set, the code generator avoids
+ /// optimizations that increase size.
extern bool OptimizeForSize;
} // End llvm namespace
Modified: llvm/trunk/lib/CodeGen/DwarfWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DwarfWriter.cpp?rev=49361&r1=49360&r2=49361&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/DwarfWriter.cpp (original)
+++ llvm/trunk/lib/CodeGen/DwarfWriter.cpp Mon Apr 7 19:10:24 2008
@@ -2905,8 +2905,11 @@
// If there are no calls then you can't unwind. This may mean we can
// omit the EH Frame, but some environments do not handle weak absolute
- // symbols.
+ // symbols.
+ // If UnwindTablesOptional is not set we cannot do this optimization; the
+ // unwind info is to be available for non-EH uses.
if (!EHFrameInfo.hasCalls &&
+ UnwindTablesOptional &&
((linkage != Function::WeakLinkage &&
linkage != Function::LinkOnceLinkage) ||
!TAI->getWeakDefDirective() ||
@@ -3427,7 +3430,9 @@
shouldEmitTable = true;
// See if we need frame move info.
- if (MMI->hasDebugInfo() || !MF->getFunction()->doesNotThrow())
+ if (MMI->hasDebugInfo() ||
+ !MF->getFunction()->doesNotThrow() ||
+ !UnwindTablesOptional)
shouldEmitMoves = true;
if (shouldEmitMoves || shouldEmitTable)
Modified: llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp?rev=49361&r1=49360&r2=49361&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp Mon Apr 7 19:10:24 2008
@@ -948,7 +948,8 @@
MachineFrameInfo *MFI = MF.getFrameInfo();
MachineModuleInfo *MMI = MFI->getMachineModuleInfo();
bool needsFrameMoves = (MMI && MMI->hasDebugInfo()) ||
- !MF.getFunction()->doesNotThrow();
+ !MF.getFunction()->doesNotThrow() ||
+ !UnwindTablesOptional;
// Prepare for frame info.
unsigned FrameLabelId = 0;
Modified: llvm/trunk/lib/Target/TargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetMachine.cpp?rev=49361&r1=49360&r2=49361&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/TargetMachine.cpp Mon Apr 7 19:10:24 2008
@@ -31,6 +31,7 @@
bool UseSoftFloat;
bool NoZerosInBSS;
bool ExceptionHandling;
+ bool UnwindTablesOptional;
Reloc::Model RelocationModel;
CodeModel::Model CMModel;
bool PerformTailCallOpt;
@@ -80,9 +81,14 @@
cl::init(false));
cl::opt<bool, true>
EnableExceptionHandling("enable-eh",
- cl::desc("Exception handling should be emitted."),
+ cl::desc("Emit DWARF exception handling (default if target supports)"),
cl::location(ExceptionHandling),
cl::init(false));
+ cl::opt<bool, true>
+ DisableUnwindTables("disable-required-unwind-tables",
+ cl::desc("Do not require unwinding info for all functions"),
+ cl::location(UnwindTablesOptional),
+ cl::init(false));
cl::opt<llvm::Reloc::Model, true>
DefRelocationModel(
Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=49361&r1=49360&r2=49361&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Mon Apr 7 19:10:24 2008
@@ -504,7 +504,9 @@
MachineModuleInfo *MMI = MFI->getMachineModuleInfo();
X86MachineFunctionInfo *X86FI = MF.getInfo<X86MachineFunctionInfo>();
MachineBasicBlock::iterator MBBI = MBB.begin();
- bool needsFrameMoves = (MMI && MMI->hasDebugInfo()) || !Fn->doesNotThrow();
+ bool needsFrameMoves = (MMI && MMI->hasDebugInfo()) ||
+ !Fn->doesNotThrow() ||
+ !UnwindTablesOptional;
// Prepare for frame info.
unsigned FrameLabelId = 0;
More information about the llvm-commits
mailing list