Revert commit 80428. It completely broke exception

handling on x86-32 linux.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80592 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan Sands 2009-08-31 16:45:16 +00:00
parent 2cd5155c0e
commit c69d74a5d4
6 changed files with 18 additions and 137 deletions

View File

@ -32,7 +32,6 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/DebugLoc.h"
#include "llvm/Support/Dwarf.h"
#include "llvm/Target/TargetMachine.h"
#include <climits>
#include <map>
@ -751,7 +750,7 @@ public:
/// getPICJumpTableRelocaBase - Returns relocation base for the given PIC
/// jumptable.
virtual SDValue getPICJumpTableRelocBase(SDValue Table,
SelectionDAG &DAG) const;
SelectionDAG &DAG) const;
/// isOffsetFoldingLegal - Return true if folding a constant offset
/// with the given GlobalAddress is legal. It is frequently not legal in
@ -761,18 +760,6 @@ public:
/// getFunctionAlignment - Return the Log2 alignment of this function.
virtual unsigned getFunctionAlignment(const Function *) const = 0;
/// getPreferredLSDADataFormat - Return the preferred exception handling data
/// format for the LSDA.
virtual unsigned getPreferredLSDADataFormat() const {
return dwarf::DW_EH_PE_absptr;
}
/// getPreferredFDEDataFormat - Return the preferred exception handling data
/// format for the FDE.
virtual unsigned getPreferredFDEDataFormat() const {
return dwarf::DW_EH_PE_absptr;
}
//===--------------------------------------------------------------------===//
// TargetLowering Optimization Methods
//

View File

@ -22,7 +22,6 @@
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetFrameInfo.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Support/Dwarf.h"
@ -81,7 +80,6 @@ void DwarfException::EmitCIE(const Function *Personality, unsigned Index) {
EmitLabel("eh_frame_common_begin", Index);
Asm->EmitInt32((int)0);
Asm->EOL("CIE Identifier Tag");
Asm->EmitInt8(dwarf::DW_CIE_VERSION);
Asm->EOL("CIE Version");
@ -93,29 +91,23 @@ void DwarfException::EmitCIE(const Function *Personality, unsigned Index) {
// Round out reader.
Asm->EmitULEB128Bytes(1);
Asm->EOL("CIE Code Alignment Factor");
Asm->EmitSLEB128Bytes(stackGrowth);
Asm->EOL("CIE Data Alignment Factor");
Asm->EmitInt8(RI->getDwarfRegNum(RI->getRARegister(), true));
Asm->EOL("CIE Return Address Column");
unsigned Encoding = 0;
// If there is a personality, we need to indicate the function's location.
if (Personality) {
Asm->EmitULEB128Bytes(7);
Asm->EOL("Augmentation Size");
if (MAI->getNeedsIndirectEncoding()) {
Encoding = dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4 |
dwarf::DW_EH_PE_indirect;
Asm->EmitInt8(Encoding);
Asm->EOL("Personality", Encoding);
Asm->EmitInt8(dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4 |
dwarf::DW_EH_PE_indirect);
Asm->EOL("Personality (pcrel sdata4 indirect)");
} else {
Encoding = dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4;
Asm->EmitInt8(Encoding);
Asm->EOL("Personality", Encoding);
Asm->EmitInt8(dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4);
Asm->EOL("Personality (pcrel sdata4)");
}
PrintRelDirective(true);
@ -126,20 +118,17 @@ void DwarfException::EmitCIE(const Function *Personality, unsigned Index) {
O << "-" << MAI->getPCSymbol();
Asm->EOL("Personality");
Encoding = Asm->TM.getTargetLowering()->getPreferredLSDADataFormat();
Asm->EmitInt8(Encoding);
Asm->EOL("LSDA Encoding", Encoding);
Asm->EmitInt8(dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4);
Asm->EOL("LSDA Encoding (pcrel sdata4)");
Encoding = Asm->TM.getTargetLowering()->getPreferredFDEDataFormat();
Asm->EmitInt8(Encoding);
Asm->EOL("FDE Encoding", Encoding);
Asm->EmitInt8(dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4);
Asm->EOL("FDE Encoding (pcrel sdata4)");
} else {
Asm->EmitULEB128Bytes(1);
Asm->EOL("Augmentation Size");
Encoding = Asm->TM.getTargetLowering()->getPreferredFDEDataFormat();
Asm->EmitInt8(Encoding);
Asm->EOL("FDE Encoding", Encoding);
Asm->EmitInt8(dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4);
Asm->EOL("FDE Encoding (pcrel sdata4)");
}
// Indicate locations of general callee saved registers in frame.
@ -163,7 +152,6 @@ void DwarfException::EmitFDE(const FunctionEHFrameInfo &EHFrameInfo) {
"Should not emit 'available externally' functions at all");
const Function *TheFunc = EHFrameInfo.function;
bool is4Byte = TD->getPointerSize() == sizeof(int32_t);
Asm->OutStreamer.SwitchSection(Asm->getObjFileLowering().getEHFrameSection());
@ -207,22 +195,23 @@ void DwarfException::EmitFDE(const FunctionEHFrameInfo &EHFrameInfo) {
Asm->EOL("FDE CIE offset");
EmitReference("eh_func_begin", EHFrameInfo.Number, true, is4Byte);
EmitReference("eh_func_begin", EHFrameInfo.Number, true, true);
Asm->EOL("FDE initial location");
EmitDifference("eh_func_end", EHFrameInfo.Number,
"eh_func_begin", EHFrameInfo.Number, is4Byte);
"eh_func_begin", EHFrameInfo.Number, true);
Asm->EOL("FDE address range");
// If there is a personality and landing pads then point to the language
// specific data area in the exception table.
if (MMI->getPersonalities()[0] != NULL) {
bool is4Byte = TD->getPointerSize() == sizeof(int32_t);
Asm->EmitULEB128Bytes(is4Byte ? 4 : 8);
Asm->EOL("Augmentation size");
if (EHFrameInfo.hasLandingPads) {
if (EHFrameInfo.hasLandingPads)
EmitReference("exception", EHFrameInfo.Number, true, false);
} else {
else {
if (is4Byte)
Asm->EmitInt32((int)0);
else
@ -930,8 +919,6 @@ void DwarfException::EndFunction() {
MF->getFunction()));
}
MF = 0;
if (TimePassesIsEnabled)
ExceptionTimer->stopTimer();
}

View File

@ -464,40 +464,6 @@ unsigned PPCTargetLowering::getFunctionAlignment(const Function *F) const {
return 2;
}
/// getPreferredLSDADataFormat - Return the preferred exception handling data
/// format for the LSDA.
unsigned PPCTargetLowering::getPreferredLSDADataFormat() const {
if (getTargetMachine().getSubtarget<PPCSubtarget>().isDarwin())
return dwarf::DW_EH_PE_pcrel;
if (PPCSubTarget.isPPC64() ||
getTargetMachine().getRelocationModel() == Reloc::PIC_) {
unsigned DataTy =
(PPCSubTarget.isPPC64() ?
dwarf::DW_EH_PE_udata8 : dwarf::DW_EH_PE_udata4);
return dwarf::DW_EH_PE_pcrel | DataTy;
}
return dwarf::DW_EH_PE_absptr;
}
/// getPreferredFDEDataFormat - Return the preferred exception handling data
/// format for the FDE.
unsigned PPCTargetLowering::getPreferredFDEDataFormat() const {
if (getTargetMachine().getSubtarget<PPCSubtarget>().isDarwin())
return dwarf::DW_EH_PE_pcrel;
if (PPCSubTarget.isPPC64() ||
getTargetMachine().getRelocationModel() == Reloc::PIC_) {
unsigned DataTy =
(PPCSubTarget.isPPC64() ?
dwarf::DW_EH_PE_udata8 : dwarf::DW_EH_PE_udata4);
return dwarf::DW_EH_PE_pcrel | DataTy;
}
return dwarf::DW_EH_PE_absptr;
}
//===----------------------------------------------------------------------===//
// Node matching predicates, for use by the tblgen matching code.
//===----------------------------------------------------------------------===//

View File

@ -346,14 +346,6 @@ namespace llvm {
/// getFunctionAlignment - Return the Log2 alignment of this function.
virtual unsigned getFunctionAlignment(const Function *F) const;
/// getPreferredLSDADataFormat - Return the preferred exception handling data
/// format for the LSDA.
virtual unsigned getPreferredLSDADataFormat() const;
/// getPreferredFDEDataFormat - Return the preferred exception handling data
/// format for the FDE.
virtual unsigned getPreferredFDEDataFormat() const;
private:
SDValue getFramePointerFrameIndex(SelectionDAG & DAG) const;
SDValue getReturnAddrFrameIndex(SelectionDAG & DAG) const;

View File

@ -1055,49 +1055,6 @@ unsigned X86TargetLowering::getFunctionAlignment(const Function *F) const {
return F->hasFnAttr(Attribute::OptimizeForSize) ? 0 : 4;
}
/// getPreferredLSDADataFormat - Return the preferred exception handling data
/// format for the LSDA.
unsigned X86TargetLowering::getPreferredLSDADataFormat() const {
if (Subtarget->isTargetDarwin())
return dwarf::DW_EH_PE_pcrel;
CodeModel::Model M = getTargetMachine().getCodeModel();
if (getTargetMachine().getRelocationModel() == Reloc::PIC_) {
if (!Subtarget->is64Bit() || M == CodeModel::Small)
return dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4;
return dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata8;
}
if (M == CodeModel::Small)
return dwarf::DW_EH_PE_sdata4;
return dwarf::DW_EH_PE_absptr;
}
/// getPreferredFDEDataFormat - Return the preferred exception handling data
/// format for the FDE.
unsigned X86TargetLowering::getPreferredFDEDataFormat() const {
if (Subtarget->isTargetDarwin())
return dwarf::DW_EH_PE_pcrel;
CodeModel::Model M = getTargetMachine().getCodeModel();
if (getTargetMachine().getRelocationModel() == Reloc::PIC_) {
if (!Subtarget->is64Bit() ||
M == CodeModel::Small || M == CodeModel::Medium)
return dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4;
return dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata8;
}
if (M == CodeModel::Small || M == CodeModel::Medium)
return dwarf::DW_EH_PE_sdata4;
return dwarf::DW_EH_PE_absptr;
}
//===----------------------------------------------------------------------===//
// Return Value Calling Convention Implementation
//===----------------------------------------------------------------------===//

View File

@ -560,14 +560,6 @@ namespace llvm {
/// getFunctionAlignment - Return the Log2 alignment of this function.
virtual unsigned getFunctionAlignment(const Function *F) const;
/// getPreferredLSDADataFormat - Return the preferred exception handling data
/// format for the LSDA.
virtual unsigned getPreferredLSDADataFormat() const;
/// getPreferredFDEDataFormat - Return the preferred exception handling data
/// format for the FDE.
virtual unsigned getPreferredFDEDataFormat() const;
private:
/// Subtarget - Keep a pointer to the X86Subtarget around so that we can
/// make the right decision when generating code for different targets.