[llvm-commits] [llvm] r47770 - in /llvm/trunk: include/llvm/Target/TargetAsmInfo.h lib/Target/PowerPC/PPCTargetAsmInfo.cpp lib/Target/PowerPC/PPCTargetAsmInfo.h lib/Target/TargetAsmInfo.cpp lib/Target/X86/X86TargetAsmInfo.cpp lib/Target/X86/X86TargetAsmInfo.h
Anton Korobeynikov
asl at math.spbu.ru
Fri Feb 29 14:09:09 PST 2008
Author: asl
Date: Fri Feb 29 16:09:08 2008
New Revision: 47770
URL: http://llvm.org/viewvc/llvm-project?rev=47770&view=rev
Log:
Use enumeration for preffered EH dwarf encoding reason
Modified:
llvm/trunk/include/llvm/Target/TargetAsmInfo.h
llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.h
llvm/trunk/lib/Target/TargetAsmInfo.cpp
llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp
llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h
Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=47770&r1=47769&r2=47770&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Fri Feb 29 16:09:08 2008
@@ -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 @@
/// 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.
//
Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp?rev=47770&r1=47769&r2=47770&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Fri Feb 29 16:09:08 2008
@@ -92,11 +92,11 @@
/// 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 @@
/// 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);
Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.h?rev=47770&r1=47769&r2=47770&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.h (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.h Fri Feb 29 16:09:08 2008
@@ -27,12 +27,14 @@
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
Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetAsmInfo.cpp?rev=47770&r1=47769&r2=47770&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Fri Feb 29 16:09:08 2008
@@ -136,7 +136,7 @@
return Length;
}
-unsigned TargetAsmInfo::PreferredEHDataFormat(unsigned Reason,
+unsigned TargetAsmInfo::PreferredEHDataFormat(DwarfEncoding::Target Reason,
bool Global) const {
return dwarf::DW_EH_PE_absptr;
}
Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp?rev=47770&r1=47769&r2=47770&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Fri Feb 29 16:09:08 2008
@@ -313,15 +313,15 @@
/// 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 @@
// - 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 @@
} 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;
Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h?rev=47770&r1=47769&r2=47770&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h (original)
+++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h Fri Feb 29 16:09:08 2008
@@ -25,7 +25,8 @@
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;
More information about the llvm-commits
mailing list