mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-28 06:24:57 +00:00
move three lowering hooks from MAI to TLOF and make one of them
semantic instead of syntactic. This completes MCization of darwin/x86[-64]! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98145 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -247,18 +247,6 @@ namespace llvm {
|
|||||||
/// encode inline subroutine information.
|
/// encode inline subroutine information.
|
||||||
bool DwarfUsesInlineInfoSection; // Defaults to false.
|
bool DwarfUsesInlineInfoSection; // Defaults to false.
|
||||||
|
|
||||||
/// Is_EHSymbolPrivate - If set, the "_foo.eh" is made private so that it
|
|
||||||
/// doesn't show up in the symbol table of the object file.
|
|
||||||
bool Is_EHSymbolPrivate; // Defaults to true.
|
|
||||||
|
|
||||||
/// GlobalEHDirective - This is the directive used to make exception frame
|
|
||||||
/// tables globally visible.
|
|
||||||
const char *GlobalEHDirective; // Defaults to NULL.
|
|
||||||
|
|
||||||
/// SupportsWeakEmptyEHFrame - True if target assembler and linker will
|
|
||||||
/// handle a weak_definition of constant 0 for an omitted EH frame.
|
|
||||||
bool SupportsWeakOmittedEHFrame; // Defaults to true.
|
|
||||||
|
|
||||||
/// DwarfSectionOffsetDirective - Special section offset directive.
|
/// DwarfSectionOffsetDirective - Special section offset directive.
|
||||||
const char* DwarfSectionOffsetDirective; // Defaults to NULL
|
const char* DwarfSectionOffsetDirective; // Defaults to NULL
|
||||||
|
|
||||||
@ -419,15 +407,6 @@ namespace llvm {
|
|||||||
bool doesDwarfUsesInlineInfoSection() const {
|
bool doesDwarfUsesInlineInfoSection() const {
|
||||||
return DwarfUsesInlineInfoSection;
|
return DwarfUsesInlineInfoSection;
|
||||||
}
|
}
|
||||||
bool is_EHSymbolPrivate() const {
|
|
||||||
return Is_EHSymbolPrivate;
|
|
||||||
}
|
|
||||||
const char *getGlobalEHDirective() const {
|
|
||||||
return GlobalEHDirective;
|
|
||||||
}
|
|
||||||
bool getSupportsWeakOmittedEHFrame() const {
|
|
||||||
return SupportsWeakOmittedEHFrame;
|
|
||||||
}
|
|
||||||
const char *getDwarfSectionOffsetDirective() const {
|
const char *getDwarfSectionOffsetDirective() const {
|
||||||
return DwarfSectionOffsetDirective;
|
return DwarfSectionOffsetDirective;
|
||||||
}
|
}
|
||||||
|
@ -87,11 +87,23 @@ protected:
|
|||||||
const MCSection *DwarfRangesSection;
|
const MCSection *DwarfRangesSection;
|
||||||
const MCSection *DwarfMacroInfoSection;
|
const MCSection *DwarfMacroInfoSection;
|
||||||
|
|
||||||
|
/// SupportsWeakEmptyEHFrame - True if target object file supports a
|
||||||
|
/// weak_definition of constant 0 for an omitted EH frame.
|
||||||
|
bool SupportsWeakOmittedEHFrame;
|
||||||
|
|
||||||
|
/// IsFunctionEHSymbolGlobal - This flag is set to true if the ".eh" symbol
|
||||||
|
/// for a function should be marked .globl.
|
||||||
|
bool IsFunctionEHSymbolGlobal;
|
||||||
|
|
||||||
|
/// IsFunctionEHFrameSymbolPrivate - This flag is set to true if the
|
||||||
|
/// "EH_frame" symbol for EH information should be an assembler temporary (aka
|
||||||
|
/// private linkage, aka an L or .L label) or false if it should be a normal
|
||||||
|
/// non-.globl label. This defaults to true.
|
||||||
|
bool IsFunctionEHFrameSymbolPrivate;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
MCContext &getContext() const { return *Ctx; }
|
MCContext &getContext() const { return *Ctx; }
|
||||||
|
|
||||||
|
|
||||||
virtual ~TargetLoweringObjectFile();
|
virtual ~TargetLoweringObjectFile();
|
||||||
|
|
||||||
/// Initialize - this method must be called before any actual lowering is
|
/// Initialize - this method must be called before any actual lowering is
|
||||||
@ -101,6 +113,15 @@ public:
|
|||||||
Ctx = &ctx;
|
Ctx = &ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isFunctionEHSymbolGlobal() const {
|
||||||
|
return IsFunctionEHSymbolGlobal;
|
||||||
|
}
|
||||||
|
bool isFunctionEHFrameSymbolPrivate() const {
|
||||||
|
return IsFunctionEHFrameSymbolPrivate;
|
||||||
|
}
|
||||||
|
bool getSupportsWeakOmittedEHFrame() const {
|
||||||
|
return SupportsWeakOmittedEHFrame;
|
||||||
|
}
|
||||||
|
|
||||||
const MCSection *getTextSection() const { return TextSection; }
|
const MCSection *getTextSection() const { return TextSection; }
|
||||||
const MCSection *getDataSection() const { return DataSection; }
|
const MCSection *getDataSection() const { return DataSection; }
|
||||||
|
@ -85,7 +85,7 @@ void DwarfException::EmitCIE(const Function *PersonalityFn, unsigned Index) {
|
|||||||
Asm->OutStreamer.SwitchSection(TLOF.getEHFrameSection());
|
Asm->OutStreamer.SwitchSection(TLOF.getEHFrameSection());
|
||||||
|
|
||||||
MCSymbol *EHFrameSym;
|
MCSymbol *EHFrameSym;
|
||||||
if (MAI->is_EHSymbolPrivate())
|
if (TLOF.isFunctionEHFrameSymbolPrivate())
|
||||||
EHFrameSym = getDWLabel("EH_frame", Index);
|
EHFrameSym = getDWLabel("EH_frame", Index);
|
||||||
else
|
else
|
||||||
EHFrameSym = Asm->OutContext.GetOrCreateSymbol(Twine("EH_frame") +
|
EHFrameSym = Asm->OutContext.GetOrCreateSymbol(Twine("EH_frame") +
|
||||||
@ -193,9 +193,8 @@ void DwarfException::EmitFDE(const FunctionEHFrameInfo &EHFrameInfo) {
|
|||||||
|
|
||||||
// Externally visible entry into the functions eh frame info. If the
|
// Externally visible entry into the functions eh frame info. If the
|
||||||
// corresponding function is static, this should not be externally visible.
|
// corresponding function is static, this should not be externally visible.
|
||||||
if (!TheFunc->hasLocalLinkage())
|
if (!TheFunc->hasLocalLinkage() && TLOF.isFunctionEHSymbolGlobal())
|
||||||
if (const char *GlobalEHDirective = MAI->getGlobalEHDirective())
|
Asm->OutStreamer.EmitSymbolAttribute(EHFrameInfo.FunctionEHSym,MCSA_Global);
|
||||||
O << GlobalEHDirective << *EHFrameInfo.FunctionEHSym << '\n';
|
|
||||||
|
|
||||||
// If corresponding function is weak definition, this should be too.
|
// If corresponding function is weak definition, this should be too.
|
||||||
if (TheFunc->isWeakForLinker() && MAI->getWeakDefDirective())
|
if (TheFunc->isWeakForLinker() && MAI->getWeakDefDirective())
|
||||||
@ -215,7 +214,7 @@ void DwarfException::EmitFDE(const FunctionEHFrameInfo &EHFrameInfo) {
|
|||||||
if (!EHFrameInfo.hasCalls && !UnwindTablesMandatory &&
|
if (!EHFrameInfo.hasCalls && !UnwindTablesMandatory &&
|
||||||
(!TheFunc->isWeakForLinker() ||
|
(!TheFunc->isWeakForLinker() ||
|
||||||
!MAI->getWeakDefDirective() ||
|
!MAI->getWeakDefDirective() ||
|
||||||
MAI->getSupportsWeakOmittedEHFrame())) {
|
TLOF.getSupportsWeakOmittedEHFrame())) {
|
||||||
Asm->OutStreamer.EmitAssignment(EHFrameInfo.FunctionEHSym,
|
Asm->OutStreamer.EmitAssignment(EHFrameInfo.FunctionEHSym,
|
||||||
MCConstantExpr::Create(0, Asm->OutContext));
|
MCConstantExpr::Create(0, Asm->OutContext));
|
||||||
// This name has no connection to the function, so it might get
|
// This name has no connection to the function, so it might get
|
||||||
@ -981,9 +980,10 @@ void DwarfException::EndFunction() {
|
|||||||
Asm->OutStreamer.EmitLabel(getDWLabel("eh_func_end", SubprogramCount));
|
Asm->OutStreamer.EmitLabel(getDWLabel("eh_func_end", SubprogramCount));
|
||||||
EmitExceptionTable();
|
EmitExceptionTable();
|
||||||
|
|
||||||
|
const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
|
||||||
MCSymbol *FunctionEHSym =
|
MCSymbol *FunctionEHSym =
|
||||||
Asm->GetSymbolWithGlobalValueBase(MF->getFunction(), ".eh",
|
Asm->GetSymbolWithGlobalValueBase(MF->getFunction(), ".eh",
|
||||||
Asm->MAI->is_EHSymbolPrivate());
|
TLOF.isFunctionEHFrameSymbolPrivate());
|
||||||
|
|
||||||
// Save EH frame information
|
// Save EH frame information
|
||||||
EHFrames.push_back(FunctionEHFrameInfo(FunctionEHSym, SubprogramCount,
|
EHFrames.push_back(FunctionEHFrameInfo(FunctionEHSym, SubprogramCount,
|
||||||
|
@ -466,6 +466,14 @@ getMachOSection(StringRef Segment, StringRef Section,
|
|||||||
|
|
||||||
void TargetLoweringObjectFileMachO::Initialize(MCContext &Ctx,
|
void TargetLoweringObjectFileMachO::Initialize(MCContext &Ctx,
|
||||||
const TargetMachine &TM) {
|
const TargetMachine &TM) {
|
||||||
|
// _foo.eh symbols are currently always exported so that the linker knows
|
||||||
|
// about them. This is not necessary on 10.6 and later, but it
|
||||||
|
// doesn't hurt anything.
|
||||||
|
// FIXME: I need to get this from Triple.
|
||||||
|
IsFunctionEHSymbolGlobal = true;
|
||||||
|
IsFunctionEHFrameSymbolPrivate = false;
|
||||||
|
SupportsWeakOmittedEHFrame = false;
|
||||||
|
|
||||||
if (UniquingMap != 0)
|
if (UniquingMap != 0)
|
||||||
((MachOUniqueMapTy*)UniquingMap)->clear();
|
((MachOUniqueMapTy*)UniquingMap)->clear();
|
||||||
TargetLoweringObjectFile::Initialize(Ctx, TM);
|
TargetLoweringObjectFile::Initialize(Ctx, TM);
|
||||||
|
@ -68,9 +68,6 @@ MCAsmInfo::MCAsmInfo() {
|
|||||||
ExceptionsType = ExceptionHandling::None;
|
ExceptionsType = ExceptionHandling::None;
|
||||||
DwarfRequiresFrameSection = true;
|
DwarfRequiresFrameSection = true;
|
||||||
DwarfUsesInlineInfoSection = false;
|
DwarfUsesInlineInfoSection = false;
|
||||||
Is_EHSymbolPrivate = true;
|
|
||||||
GlobalEHDirective = 0;
|
|
||||||
SupportsWeakOmittedEHFrame = true;
|
|
||||||
DwarfSectionOffsetDirective = 0;
|
DwarfSectionOffsetDirective = 0;
|
||||||
|
|
||||||
AsmTransCBE = 0;
|
AsmTransCBE = 0;
|
||||||
|
@ -41,18 +41,7 @@ MCAsmInfoDarwin::MCAsmInfoDarwin() {
|
|||||||
// Doesn't support protected visibility.
|
// Doesn't support protected visibility.
|
||||||
ProtectedVisibilityAttr = MCSA_Global;
|
ProtectedVisibilityAttr = MCSA_Global;
|
||||||
|
|
||||||
|
|
||||||
HasDotTypeDotSizeDirective = false;
|
HasDotTypeDotSizeDirective = false;
|
||||||
HasNoDeadStrip = true;
|
HasNoDeadStrip = true;
|
||||||
// Note: Even though darwin has the .lcomm directive, it is just a synonym for
|
|
||||||
// zerofill, so we prefer to use .zerofill.
|
|
||||||
|
|
||||||
// _foo.eh symbols are currently always exported so that the linker knows
|
|
||||||
// about them. This is not necessary on 10.6 and later, but it
|
|
||||||
// doesn't hurt anything.
|
|
||||||
// FIXME: I need to get this from Triple.
|
|
||||||
Is_EHSymbolPrivate = false;
|
|
||||||
GlobalEHDirective = "\t.globl\t";
|
|
||||||
SupportsWeakOmittedEHFrame = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,6 +56,10 @@ TargetLoweringObjectFile::TargetLoweringObjectFile() : Ctx(0) {
|
|||||||
DwarfARangesSection = 0;
|
DwarfARangesSection = 0;
|
||||||
DwarfRangesSection = 0;
|
DwarfRangesSection = 0;
|
||||||
DwarfMacroInfoSection = 0;
|
DwarfMacroInfoSection = 0;
|
||||||
|
|
||||||
|
IsFunctionEHSymbolGlobal = false;
|
||||||
|
IsFunctionEHFrameSymbolPrivate = true;
|
||||||
|
SupportsWeakOmittedEHFrame = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
TargetLoweringObjectFile::~TargetLoweringObjectFile() {
|
TargetLoweringObjectFile::~TargetLoweringObjectFile() {
|
||||||
|
Reference in New Issue
Block a user