summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2008-04-02 00:25:04 +0000
committerDale Johannesen <dalej@apple.com>2008-04-02 00:25:04 +0000
commitfd967cf3fafa2c6dc9ed1fb4ad7ddacc425f6f60 (patch)
tree8869d1733914f7fe6907b60aa43d90fcdae3a1c6 /llvm/lib/Target
parentac38d444e2767fd106377e6de13d561b6c436458 (diff)
downloadbcm5719-llvm-fd967cf3fafa2c6dc9ed1fb4ad7ddacc425f6f60.tar.gz
bcm5719-llvm-fd967cf3fafa2c6dc9ed1fb4ad7ddacc425f6f60.zip
Recommitting EH patch; this should answer most of the
review feedback. -enable-eh is still accepted but doesn't do anything. EH intrinsics use Dwarf EH if the target supports that, and are handled by LowerInvoke otherwise. The separation of the EH table and frame move data is, I think, logically figured out, but either one still causes full EH info to be generated (not sure how to split the metadata correctly). MachineModuleInfo::needsFrameInfo is no longer used and is removed. llvm-svn: 49064
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp3
-rw-r--r--llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp7
-rw-r--r--llvm/lib/Target/X86/X86ATTAsmPrinter.cpp5
-rw-r--r--llvm/lib/Target/X86/X86AsmPrinter.cpp4
-rw-r--r--llvm/lib/Target/X86/X86RegisterInfo.cpp7
5 files changed, 16 insertions, 10 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
index 2537d67ddaa..4cc9d2a9bd5 100644
--- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -1086,8 +1086,9 @@ bool DarwinAsmPrinter::doFinalization(Module &M) {
O << "\n";
- if (ExceptionHandling && TAI->doesSupportExceptionHandling() && MMI) {
+ if (TAI->doesSupportExceptionHandling() && MMI) {
// Add the (possibly multiple) personalities to the set of global values.
+ // Only referenced functions get into the Personalities list.
const std::vector<Function *>& Personalities = MMI->getPersonalities();
for (std::vector<Function *>::const_iterator I = Personalities.begin(),
diff --git a/llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp b/llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp
index 0e6bc69023d..3bafccde8de 100644
--- a/llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp
+++ b/llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp
@@ -20,6 +20,7 @@
#include "PPCFrameInfo.h"
#include "PPCSubtarget.h"
#include "llvm/Constants.h"
+#include "llvm/Function.h"
#include "llvm/Type.h"
#include "llvm/CodeGen/ValueTypes.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
@@ -946,6 +947,8 @@ PPCRegisterInfo::emitPrologue(MachineFunction &MF) const {
MachineBasicBlock::iterator MBBI = MBB.begin();
MachineFrameInfo *MFI = MF.getFrameInfo();
MachineModuleInfo *MMI = MFI->getMachineModuleInfo();
+ bool needsFrameInfo = (MMI && MMI->hasDebugInfo()) ||
+ !MF.getFunction()->doesNotThrow();
// Prepare for frame info.
unsigned FrameLabelId = 0;
@@ -1019,7 +1022,7 @@ PPCRegisterInfo::emitPrologue(MachineFunction &MF) const {
unsigned TargetAlign = MF.getTarget().getFrameInfo()->getStackAlignment();
unsigned MaxAlign = MFI->getMaxAlignment();
- if (MMI && MMI->needsFrameInfo()) {
+ if (needsFrameInfo) {
// Mark effective beginning of when frame pointer becomes valid.
FrameLabelId = MMI->NextLabelID();
BuildMI(MBB, MBBI, TII.get(PPC::LABEL)).addImm(FrameLabelId).addImm(0);
@@ -1095,7 +1098,7 @@ PPCRegisterInfo::emitPrologue(MachineFunction &MF) const {
}
}
- if (MMI && MMI->needsFrameInfo()) {
+ if (needsFrameInfo) {
std::vector<MachineMove> &Moves = MMI->getFrameMoves();
if (NegFrameSize) {
diff --git a/llvm/lib/Target/X86/X86ATTAsmPrinter.cpp b/llvm/lib/Target/X86/X86ATTAsmPrinter.cpp
index 06796566612..151bf119cab 100644
--- a/llvm/lib/Target/X86/X86ATTAsmPrinter.cpp
+++ b/llvm/lib/Target/X86/X86ATTAsmPrinter.cpp
@@ -150,8 +150,9 @@ bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
F->getLinkage() == Function::WeakLinkage))
O << "Lllvm$workaround$fake$stub$" << CurrentFnName << ":\n";
- if (TAI->doesSupportDebugInformation()) {
- // Emit pre-function debug information.
+ if (TAI->doesSupportDebugInformation() ||
+ TAI->doesSupportExceptionHandling()) {
+ // Emit pre-function debug and/or EH information.
DW.BeginFunction(&MF);
}
diff --git a/llvm/lib/Target/X86/X86AsmPrinter.cpp b/llvm/lib/Target/X86/X86AsmPrinter.cpp
index 98e7d9c1e81..e1bc65fc5d6 100644
--- a/llvm/lib/Target/X86/X86AsmPrinter.cpp
+++ b/llvm/lib/Target/X86/X86AsmPrinter.cpp
@@ -381,9 +381,9 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
O << "\n";
- if (ExceptionHandling && TAI->doesSupportExceptionHandling() && MMI &&
- !Subtarget->is64Bit()) {
+ if (TAI->doesSupportExceptionHandling() && MMI && !Subtarget->is64Bit()) {
// Add the (possibly multiple) personalities to the set of global values.
+ // Only referenced functions get into the Personalities list.
const std::vector<Function *>& Personalities = MMI->getPersonalities();
for (std::vector<Function *>::const_iterator I = Personalities.begin(),
diff --git a/llvm/lib/Target/X86/X86RegisterInfo.cpp b/llvm/lib/Target/X86/X86RegisterInfo.cpp
index 5cd2fbe35e6..6c3484ecfff 100644
--- a/llvm/lib/Target/X86/X86RegisterInfo.cpp
+++ b/llvm/lib/Target/X86/X86RegisterInfo.cpp
@@ -504,6 +504,7 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
MachineModuleInfo *MMI = MFI->getMachineModuleInfo();
X86MachineFunctionInfo *X86FI = MF.getInfo<X86MachineFunctionInfo>();
MachineBasicBlock::iterator MBBI = MBB.begin();
+ bool needsFrameInfo = (MMI && MMI->hasDebugInfo()) || !Fn->doesNotThrow();
// Prepare for frame info.
unsigned FrameLabelId = 0;
@@ -536,7 +537,7 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
.addReg(FramePtr);
NumBytes -= SlotSize;
- if (MMI && MMI->needsFrameInfo()) {
+ if (needsFrameInfo) {
// Mark effective beginning of when frame pointer becomes valid.
FrameLabelId = MMI->NextLabelID();
BuildMI(MBB, MBBI, TII.get(X86::LABEL)).addImm(FrameLabelId).addImm(0);
@@ -548,7 +549,7 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
}
unsigned ReadyLabelId = 0;
- if (MMI && MMI->needsFrameInfo()) {
+ if (needsFrameInfo) {
// Mark effective beginning of when frame pointer is ready.
ReadyLabelId = MMI->NextLabelID();
BuildMI(MBB, MBBI, TII.get(X86::LABEL)).addImm(ReadyLabelId).addImm(0);
@@ -607,7 +608,7 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
}
}
- if (MMI && MMI->needsFrameInfo()) {
+ if (needsFrameInfo) {
std::vector<MachineMove> &Moves = MMI->getFrameMoves();
const TargetData *TD = MF.getTarget().getTargetData();
OpenPOWER on IntegriCloud