mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 22:24:07 +00:00
sink getOrCreateSection down into all the object file implementations,
now that they create *all* the sections. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78494 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -80,12 +80,11 @@ protected:
|
|||||||
const MCSection *DwarfRangesSection;
|
const MCSection *DwarfRangesSection;
|
||||||
const MCSection *DwarfMacroInfoSection;
|
const MCSection *DwarfMacroInfoSection;
|
||||||
|
|
||||||
protected:
|
|
||||||
const MCSection *getOrCreateSection(const char *Name,
|
|
||||||
bool isDirective,
|
|
||||||
SectionKind K) const;
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
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
|
||||||
@ -206,6 +205,11 @@ protected:
|
|||||||
const MCSection *MergeableConst4Section;
|
const MCSection *MergeableConst4Section;
|
||||||
const MCSection *MergeableConst8Section;
|
const MCSection *MergeableConst8Section;
|
||||||
const MCSection *MergeableConst16Section;
|
const MCSection *MergeableConst16Section;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
const MCSection *getOrCreateSection(const char *Name,
|
||||||
|
bool isDirective,
|
||||||
|
SectionKind K) const;
|
||||||
public:
|
public:
|
||||||
/// ELF Constructor - AtIsCommentChar is true if the CommentCharacter from TAI
|
/// ELF Constructor - AtIsCommentChar is true if the CommentCharacter from TAI
|
||||||
/// is "@".
|
/// is "@".
|
||||||
@ -213,9 +217,8 @@ public:
|
|||||||
// FIXME: REMOVE AFTER UNIQUING IS FIXED.
|
// FIXME: REMOVE AFTER UNIQUING IS FIXED.
|
||||||
bool hasCrazyBSS = false)
|
bool hasCrazyBSS = false)
|
||||||
: AtIsCommentChar(atIsCommentChar), HasCrazyBSS(hasCrazyBSS) {}
|
: AtIsCommentChar(atIsCommentChar), HasCrazyBSS(hasCrazyBSS) {}
|
||||||
|
|
||||||
virtual void Initialize(MCContext &Ctx, const TargetMachine &TM);
|
|
||||||
|
|
||||||
|
virtual void Initialize(MCContext &Ctx, const TargetMachine &TM);
|
||||||
|
|
||||||
/// getSectionForConstant - Given a constant with the SectionKind, return a
|
/// getSectionForConstant - Given a constant with the SectionKind, return a
|
||||||
/// section that it should be placed in.
|
/// section that it should be placed in.
|
||||||
@ -247,6 +250,10 @@ class TargetLoweringObjectFileMachO : public TargetLoweringObjectFile {
|
|||||||
const MCSection *FourByteConstantSection;
|
const MCSection *FourByteConstantSection;
|
||||||
const MCSection *EightByteConstantSection;
|
const MCSection *EightByteConstantSection;
|
||||||
const MCSection *SixteenByteConstantSection;
|
const MCSection *SixteenByteConstantSection;
|
||||||
|
protected:
|
||||||
|
const MCSection *getOrCreateSection(const char *Name,
|
||||||
|
bool isDirective,
|
||||||
|
SectionKind K) const;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual void Initialize(MCContext &Ctx, const TargetMachine &TM);
|
virtual void Initialize(MCContext &Ctx, const TargetMachine &TM);
|
||||||
@ -276,6 +283,10 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
class TargetLoweringObjectFileCOFF : public TargetLoweringObjectFile {
|
class TargetLoweringObjectFileCOFF : public TargetLoweringObjectFile {
|
||||||
|
protected:
|
||||||
|
const MCSection *getOrCreateSection(const char *Name,
|
||||||
|
bool isDirective,
|
||||||
|
SectionKind K) const;
|
||||||
public:
|
public:
|
||||||
virtual void Initialize(MCContext &Ctx, const TargetMachine &TM);
|
virtual void Initialize(MCContext &Ctx, const TargetMachine &TM);
|
||||||
|
|
||||||
|
@ -13,12 +13,21 @@
|
|||||||
#include "llvm/DerivedTypes.h"
|
#include "llvm/DerivedTypes.h"
|
||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include "llvm/MC/MCSection.h"
|
#include "llvm/MC/MCSection.h"
|
||||||
|
#include "llvm/MC/MCContext.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
PIC16TargetObjectFile::PIC16TargetObjectFile()
|
PIC16TargetObjectFile::PIC16TargetObjectFile()
|
||||||
: ExternalVarDecls(0), ExternalVarDefs(0) {
|
: ExternalVarDecls(0), ExternalVarDefs(0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const MCSection *PIC16TargetObjectFile::
|
||||||
|
getOrCreateSection(const char *Name, bool isDirective, SectionKind Kind) const {
|
||||||
|
if (MCSection *S = getContext().GetSection(Name))
|
||||||
|
return S;
|
||||||
|
return MCSection::Create(Name, isDirective, Kind, getContext());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void PIC16TargetObjectFile::Initialize(MCContext &Ctx, const TargetMachine &tm){
|
void PIC16TargetObjectFile::Initialize(MCContext &Ctx, const TargetMachine &tm){
|
||||||
TargetLoweringObjectFile::Initialize(Ctx, tm);
|
TargetLoweringObjectFile::Initialize(Ctx, tm);
|
||||||
TM = &tm;
|
TM = &tm;
|
||||||
|
@ -45,6 +45,10 @@ namespace llvm {
|
|||||||
|
|
||||||
class PIC16TargetObjectFile : public TargetLoweringObjectFile {
|
class PIC16TargetObjectFile : public TargetLoweringObjectFile {
|
||||||
const TargetMachine *TM;
|
const TargetMachine *TM;
|
||||||
|
|
||||||
|
const MCSection *getOrCreateSection(const char *Name,
|
||||||
|
bool isDirective,
|
||||||
|
SectionKind K) const;
|
||||||
public:
|
public:
|
||||||
mutable std::vector<PIC16Section*> BSSSections;
|
mutable std::vector<PIC16Section*> BSSSections;
|
||||||
mutable std::vector<PIC16Section*> IDATASections;
|
mutable std::vector<PIC16Section*> IDATASections;
|
||||||
|
@ -274,19 +274,18 @@ TargetLoweringObjectFile::getSectionForConstant(SectionKind Kind) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const MCSection *TargetLoweringObjectFile::
|
|
||||||
getOrCreateSection(const char *Name, bool isDirective, SectionKind Kind) const {
|
|
||||||
if (MCSection *S = Ctx->GetSection(Name))
|
|
||||||
return S;
|
|
||||||
return MCSection::Create(Name, isDirective, Kind, *Ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// ELF
|
// ELF
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
const MCSection *TargetLoweringObjectFileELF::
|
||||||
|
getOrCreateSection(const char *Name, bool isDirective, SectionKind Kind) const {
|
||||||
|
if (MCSection *S = getContext().GetSection(Name))
|
||||||
|
return S;
|
||||||
|
return MCSection::Create(Name, isDirective, Kind, getContext());
|
||||||
|
}
|
||||||
|
|
||||||
void TargetLoweringObjectFileELF::Initialize(MCContext &Ctx,
|
void TargetLoweringObjectFileELF::Initialize(MCContext &Ctx,
|
||||||
const TargetMachine &TM) {
|
const TargetMachine &TM) {
|
||||||
TargetLoweringObjectFile::Initialize(Ctx, TM);
|
TargetLoweringObjectFile::Initialize(Ctx, TM);
|
||||||
@ -575,6 +574,13 @@ getSectionForConstant(SectionKind Kind) const {
|
|||||||
// MachO
|
// MachO
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
const MCSection *TargetLoweringObjectFileMachO::
|
||||||
|
getOrCreateSection(const char *Name, bool isDirective, SectionKind Kind) const {
|
||||||
|
if (MCSection *S = getContext().GetSection(Name))
|
||||||
|
return S;
|
||||||
|
return MCSection::Create(Name, isDirective, Kind, getContext());
|
||||||
|
}
|
||||||
|
|
||||||
const MCSection *TargetLoweringObjectFileMachO::
|
const MCSection *TargetLoweringObjectFileMachO::
|
||||||
getMachOSection(const char *Name, bool isDirective, SectionKind K) {
|
getMachOSection(const char *Name, bool isDirective, SectionKind K) {
|
||||||
// FOR NOW, Just forward.
|
// FOR NOW, Just forward.
|
||||||
@ -788,6 +794,13 @@ shouldEmitUsedDirectiveFor(const GlobalValue *GV, Mangler *Mang) const {
|
|||||||
// COFF
|
// COFF
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
const MCSection *TargetLoweringObjectFileCOFF::
|
||||||
|
getOrCreateSection(const char *Name, bool isDirective, SectionKind Kind) const {
|
||||||
|
if (MCSection *S = getContext().GetSection(Name))
|
||||||
|
return S;
|
||||||
|
return MCSection::Create(Name, isDirective, Kind, getContext());
|
||||||
|
}
|
||||||
|
|
||||||
const MCSection *TargetLoweringObjectFileCOFF::
|
const MCSection *TargetLoweringObjectFileCOFF::
|
||||||
getCOFFSection(const char *Name, bool isDirective, SectionKind K) {
|
getCOFFSection(const char *Name, bool isDirective, SectionKind K) {
|
||||||
return getOrCreateSection(Name, isDirective, K);
|
return getOrCreateSection(Name, isDirective, K);
|
||||||
|
Reference in New Issue
Block a user