diff options
author | Bill Wendling <isanbard@gmail.com> | 2009-08-29 12:20:54 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2009-08-29 12:20:54 +0000 |
commit | 39bb29f7fef8bd17d5f684fedb376b55a07b4f14 (patch) | |
tree | 7ee6677bbfe1a0622a0bbae4d229cc4c23416afd /llvm/lib/Target/PowerPC | |
parent | f8b28e43272f06cb067000b2d40503c21203d1ed (diff) | |
download | bcm5719-llvm-39bb29f7fef8bd17d5f684fedb376b55a07b4f14.tar.gz bcm5719-llvm-39bb29f7fef8bd17d5f684fedb376b55a07b4f14.zip |
- Add target lowering methods to get the preferred format for the FDE and LSDA
encodings.
- Make some of the values emitted by the FDEs dependent upon the pointer
size. This is in line with how GCC does things. And it has the benefit of
working for Darwin in 64-bit mode now.
llvm-svn: 80428
Diffstat (limited to 'llvm/lib/Target/PowerPC')
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCISelLowering.cpp | 34 | ||||
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCISelLowering.h | 8 |
2 files changed, 42 insertions, 0 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp index ad9bbe1d311..1f51d048597 100644 --- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp @@ -464,6 +464,40 @@ 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. //===----------------------------------------------------------------------===// diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.h b/llvm/lib/Target/PowerPC/PPCISelLowering.h index 19fef4da0b4..9e5e36ad14e 100644 --- a/llvm/lib/Target/PowerPC/PPCISelLowering.h +++ b/llvm/lib/Target/PowerPC/PPCISelLowering.h @@ -346,6 +346,14 @@ 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; |