aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2008-04-08 00:10:24 +0000
committerDale Johannesen <dalej@apple.com>2008-04-08 00:10:24 +0000
commit4e1b79459fcf72216cdc42a59953e172c60e15ca (patch)
tree6d330b1c9b9699f92a180db1468821d536b70cc8 /lib
parent9b01cc0ede3bfef32ce46159670dedc3e9769a64 (diff)
Implement new llc flag -disable-required-unwind-tables.
Corresponds to -fno-unwind-tables (usually default in gcc). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49361 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/DwarfWriter.cpp9
-rw-r--r--lib/Target/PowerPC/PPCRegisterInfo.cpp3
-rw-r--r--lib/Target/TargetMachine.cpp8
-rw-r--r--lib/Target/X86/X86RegisterInfo.cpp4
4 files changed, 19 insertions, 5 deletions
diff --git a/lib/CodeGen/DwarfWriter.cpp b/lib/CodeGen/DwarfWriter.cpp
index 947b420cd5..6cdc91e1f7 100644
--- a/lib/CodeGen/DwarfWriter.cpp
+++ b/lib/CodeGen/DwarfWriter.cpp
@@ -2905,8 +2905,11 @@ private:
// 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 @@ public:
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)
diff --git a/lib/Target/PowerPC/PPCRegisterInfo.cpp b/lib/Target/PowerPC/PPCRegisterInfo.cpp
index 8ef8b3fafa..8b4fb6a356 100644
--- a/lib/Target/PowerPC/PPCRegisterInfo.cpp
+++ b/lib/Target/PowerPC/PPCRegisterInfo.cpp
@@ -948,7 +948,8 @@ PPCRegisterInfo::emitPrologue(MachineFunction &MF) const {
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;
diff --git a/lib/Target/TargetMachine.cpp b/lib/Target/TargetMachine.cpp
index e4f633f111..e6f080d328 100644
--- a/lib/Target/TargetMachine.cpp
+++ b/lib/Target/TargetMachine.cpp
@@ -31,6 +31,7 @@ namespace llvm {
bool UseSoftFloat;
bool NoZerosInBSS;
bool ExceptionHandling;
+ bool UnwindTablesOptional;
Reloc::Model RelocationModel;
CodeModel::Model CMModel;
bool PerformTailCallOpt;
@@ -80,9 +81,14 @@ namespace {
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(
diff --git a/lib/Target/X86/X86RegisterInfo.cpp b/lib/Target/X86/X86RegisterInfo.cpp
index 0a755605d4..2668582aef 100644
--- a/lib/Target/X86/X86RegisterInfo.cpp
+++ b/lib/Target/X86/X86RegisterInfo.cpp
@@ -504,7 +504,9 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
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;