diff options
author | Anton Korobeynikov <asl@math.spbu.ru> | 2008-02-29 22:09:08 +0000 |
---|---|---|
committer | Anton Korobeynikov <asl@math.spbu.ru> | 2008-02-29 22:09:08 +0000 |
commit | 8213f9cf94c740d078b444ecb125b9a581350837 (patch) | |
tree | 25cf8aa3105f09b8b194bd1e6a6132de78d39421 | |
parent | 05548eb174dd694b651de334b73197a62e5071f1 (diff) | |
download | external_llvm-8213f9cf94c740d078b444ecb125b9a581350837.zip external_llvm-8213f9cf94c740d078b444ecb125b9a581350837.tar.gz external_llvm-8213f9cf94c740d078b444ecb125b9a581350837.tar.bz2 |
Use enumeration for preffered EH dwarf encoding reason
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47770 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/Target/TargetAsmInfo.h | 12 | ||||
-rw-r--r-- | lib/Target/PowerPC/PPCTargetAsmInfo.cpp | 8 | ||||
-rw-r--r-- | lib/Target/PowerPC/PPCTargetAsmInfo.h | 6 | ||||
-rw-r--r-- | lib/Target/TargetAsmInfo.cpp | 2 | ||||
-rw-r--r-- | lib/Target/X86/X86TargetAsmInfo.cpp | 11 | ||||
-rw-r--r-- | lib/Target/X86/X86TargetAsmInfo.h | 3 |
6 files changed, 28 insertions, 14 deletions
diff --git a/include/llvm/Target/TargetAsmInfo.h b/include/llvm/Target/TargetAsmInfo.h index f1d29ac..e55c243 100644 --- a/include/llvm/Target/TargetAsmInfo.h +++ b/include/llvm/Target/TargetAsmInfo.h @@ -20,6 +20,15 @@ #include "llvm/Support/DataTypes.h" namespace llvm { + // DWARF encoding query type + namespace DwarfEncoding { + enum Target { + Data = 0, + CodeLabels = 1, + Functions = 2 + }; + } + class TargetMachine; class CallInst; @@ -401,7 +410,8 @@ namespace llvm { /// 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. - virtual unsigned PreferredEHDataFormat(unsigned Reason, bool Global) const; + virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason, + bool Global) const; // Accessors. // diff --git a/lib/Target/PowerPC/PPCTargetAsmInfo.cpp b/lib/Target/PowerPC/PPCTargetAsmInfo.cpp index 34ea8c3..85ead11 100644 --- a/lib/Target/PowerPC/PPCTargetAsmInfo.cpp +++ b/lib/Target/PowerPC/PPCTargetAsmInfo.cpp @@ -92,11 +92,11 @@ DarwinTargetAsmInfo::DarwinTargetAsmInfo(const PPCTargetMachine &TM) /// 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, +unsigned DarwinTargetAsmInfo::PreferredEHDataFormat(DwarfEncoding::Target Reason, bool Global) const { - if (Reason == 2 && Global) + if (Reason == DwarfEncoding::Functions && Global) return (DW_EH_PE_pcrel | DW_EH_PE_indirect | DW_EH_PE_sdata4); - else if (Reason == 1 || !Global) + else if (Reason == DwarfEncoding::CodeLabels || !Global) return DW_EH_PE_pcrel; else return DW_EH_PE_absptr; @@ -154,7 +154,7 @@ LinuxTargetAsmInfo::LinuxTargetAsmInfo(const PPCTargetMachine &TM) /// 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, +unsigned LinuxTargetAsmInfo::PreferredEHDataFormat(DwarfEncoding::Target 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 c13063c..4884628 100644 --- a/lib/Target/PowerPC/PPCTargetAsmInfo.h +++ b/lib/Target/PowerPC/PPCTargetAsmInfo.h @@ -27,12 +27,14 @@ namespace llvm { struct DarwinTargetAsmInfo : public PPCTargetAsmInfo { explicit DarwinTargetAsmInfo(const PPCTargetMachine &TM); - virtual unsigned PreferredEHDataFormat(unsigned Reason, bool Global) const; + virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason, + bool Global) const; }; struct LinuxTargetAsmInfo : public PPCTargetAsmInfo { explicit LinuxTargetAsmInfo(const PPCTargetMachine &TM); - virtual unsigned PreferredEHDataFormat(unsigned Reason, bool Global) const; + virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason, + bool Global) const; }; } // namespace llvm diff --git a/lib/Target/TargetAsmInfo.cpp b/lib/Target/TargetAsmInfo.cpp index 3f01c9a..2169945 100644 --- a/lib/Target/TargetAsmInfo.cpp +++ b/lib/Target/TargetAsmInfo.cpp @@ -136,7 +136,7 @@ unsigned TargetAsmInfo::getInlineAsmLength(const char *Str) const { return Length; } -unsigned TargetAsmInfo::PreferredEHDataFormat(unsigned Reason, +unsigned TargetAsmInfo::PreferredEHDataFormat(DwarfEncoding::Target Reason, bool Global) const { return dwarf::DW_EH_PE_absptr; } diff --git a/lib/Target/X86/X86TargetAsmInfo.cpp b/lib/Target/X86/X86TargetAsmInfo.cpp index acc13ba..68185ed 100644 --- a/lib/Target/X86/X86TargetAsmInfo.cpp +++ b/lib/Target/X86/X86TargetAsmInfo.cpp @@ -313,15 +313,15 @@ bool X86TargetAsmInfo::ExpandInlineAsm(CallInst *CI) const { /// 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 X86TargetAsmInfo::PreferredEHDataFormat(unsigned Reason, +unsigned X86TargetAsmInfo::PreferredEHDataFormat(DwarfEncoding::Target Reason, bool Global) const { const X86Subtarget *Subtarget = &X86TM->getSubtarget<X86Subtarget>(); switch (Subtarget->TargetType) { case X86Subtarget::isDarwin: - if (Reason == 2 && Global) + if (Reason == DwarfEncoding::Functions && Global) return (DW_EH_PE_pcrel | DW_EH_PE_indirect | DW_EH_PE_sdata4); - else if (Reason == 1 || !Global) + else if (Reason == DwarfEncoding::CodeLabels || !Global) return DW_EH_PE_pcrel; else return DW_EH_PE_absptr; @@ -343,7 +343,8 @@ unsigned X86TargetAsmInfo::PreferredEHDataFormat(unsigned Reason, // - code model is medium and we're emitting externally visible symbols or // any code symbols if (CM == CodeModel::Small || - (CM == CodeModel::Medium && (Global || Reason))) + (CM == CodeModel::Medium && (Global || + Reason != DwarfEncoding::Data))) Format = DW_EH_PE_sdata4; else Format = DW_EH_PE_sdata8; @@ -356,7 +357,7 @@ unsigned X86TargetAsmInfo::PreferredEHDataFormat(unsigned Reason, } else { if (Subtarget->is64Bit() && (CM == CodeModel::Small || - (CM == CodeModel::Medium && Reason))) + (CM == CodeModel::Medium && Reason != DwarfEncoding::Data))) return DW_EH_PE_udata4; else return DW_EH_PE_absptr; diff --git a/lib/Target/X86/X86TargetAsmInfo.h b/lib/Target/X86/X86TargetAsmInfo.h index 9a5d142..d9dd275 100644 --- a/lib/Target/X86/X86TargetAsmInfo.h +++ b/lib/Target/X86/X86TargetAsmInfo.h @@ -25,7 +25,8 @@ namespace llvm { explicit X86TargetAsmInfo(const X86TargetMachine &TM); virtual bool ExpandInlineAsm(CallInst *CI) const; - virtual unsigned PreferredEHDataFormat(unsigned Reason, bool Global) const; + virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason, + bool Global) const; private: const X86TargetMachine* X86TM; |