diff options
author | Anton Korobeynikov <asl@math.spbu.ru> | 2008-02-27 23:49:15 +0000 |
---|---|---|
committer | Anton Korobeynikov <asl@math.spbu.ru> | 2008-02-27 23:49:15 +0000 |
commit | 7b1b7f5c5a3fa4ece1d64a5e86a3d59622c282f6 (patch) | |
tree | 9b63f5873d1c3d77d1184e0c2c1e5849c29a2ed4 | |
parent | 26c22cfbcd432dfc83c64331077a7ec034e92f51 (diff) | |
download | external_llvm-7b1b7f5c5a3fa4ece1d64a5e86a3d59622c282f6.tar.gz external_llvm-7b1b7f5c5a3fa4ece1d64a5e86a3d59622c282f6.tar.bz2 external_llvm-7b1b7f5c5a3fa4ece1d64a5e86a3d59622c282f6.zip |
EHPreferredDataFormat hook for PPC targets. Looks like Darwin
uses the same encoding everywhere. Linux FIXME'ed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47701 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/PowerPC/PPCTargetAsmInfo.cpp | 29 | ||||
-rw-r--r-- | lib/Target/PowerPC/PPCTargetAsmInfo.h | 2 |
2 files changed, 30 insertions, 1 deletions
diff --git a/lib/Target/PowerPC/PPCTargetAsmInfo.cpp b/lib/Target/PowerPC/PPCTargetAsmInfo.cpp index 8728def217..34ea8c37e9 100644 --- a/lib/Target/PowerPC/PPCTargetAsmInfo.cpp +++ b/lib/Target/PowerPC/PPCTargetAsmInfo.cpp @@ -14,7 +14,10 @@ #include "PPCTargetAsmInfo.h" #include "PPCTargetMachine.h" #include "llvm/Function.h" +#include "llvm/Support/Dwarf.h" + using namespace llvm; +using namespace llvm::dwarf; PPCTargetAsmInfo::PPCTargetAsmInfo(const PPCTargetMachine &TM) { bool isPPC64 = TM.getSubtargetImpl()->isPPC64(); @@ -27,7 +30,6 @@ PPCTargetAsmInfo::PPCTargetAsmInfo(const PPCTargetMachine &TM) { InlineAsmStart = "# InlineAsm Start"; InlineAsmEnd = "# InlineAsm End"; AssemblerDialect = TM.getSubtargetImpl()->getAsmFlavor(); - } DarwinTargetAsmInfo::DarwinTargetAsmInfo(const PPCTargetMachine &TM) @@ -86,6 +88,21 @@ DarwinTargetAsmInfo::DarwinTargetAsmInfo(const PPCTargetMachine &TM) } } +/// PreferredEHDataFormat - This hook allows the target to select data +/// format used for encoding pointers in exception handling data. Reason is +/// 0 for data, 1 for code labels, 2 for function pointers. Global is true +/// if the symbol can be relocated. +unsigned DarwinTargetAsmInfo::PreferredEHDataFormat(unsigned Reason, + bool Global) const { + if (Reason == 2 && Global) + return (DW_EH_PE_pcrel | DW_EH_PE_indirect | DW_EH_PE_sdata4); + else if (Reason == 1 || !Global) + return DW_EH_PE_pcrel; + else + return DW_EH_PE_absptr; +} + + LinuxTargetAsmInfo::LinuxTargetAsmInfo(const PPCTargetMachine &TM) : PPCTargetAsmInfo(TM) { @@ -132,3 +149,13 @@ LinuxTargetAsmInfo::LinuxTargetAsmInfo(const PPCTargetMachine &TM) DwarfEHFrameSection = "\t.section\t.eh_frame,\"aw\",@progbits"; DwarfExceptionSection = "\t.section\t.gcc_except_table,\"a\",@progbits"; } + +/// PreferredEHDataFormat - This hook allows the target to select data +/// format used for encoding pointers in exception handling data. Reason is +/// 0 for data, 1 for code labels, 2 for function pointers. Global is true +/// if the symbol can be relocated. +unsigned LinuxTargetAsmInfo::PreferredEHDataFormat(unsigned Reason, + bool Global) const { + // We really need to write something here. + return TargetAsmInfo::PreferredEHDataFormat(Reason, Global); +} diff --git a/lib/Target/PowerPC/PPCTargetAsmInfo.h b/lib/Target/PowerPC/PPCTargetAsmInfo.h index 92cb3e7112..c13063c812 100644 --- a/lib/Target/PowerPC/PPCTargetAsmInfo.h +++ b/lib/Target/PowerPC/PPCTargetAsmInfo.h @@ -27,10 +27,12 @@ namespace llvm { struct DarwinTargetAsmInfo : public PPCTargetAsmInfo { explicit DarwinTargetAsmInfo(const PPCTargetMachine &TM); + virtual unsigned PreferredEHDataFormat(unsigned Reason, bool Global) const; }; struct LinuxTargetAsmInfo : public PPCTargetAsmInfo { explicit LinuxTargetAsmInfo(const PPCTargetMachine &TM); + virtual unsigned PreferredEHDataFormat(unsigned Reason, bool Global) const; }; } // namespace llvm |