mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-08 18:31:23 +00:00
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
This commit is contained in:
parent
05548eb174
commit
8213f9cf94
@ -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.
|
||||
//
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user