mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-05 14:34:55 +00:00
switch off of 'Section' onto MCSection. We're not properly using
MCSection subclasses yet, but this is a step in the right direction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77708 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5e5337a833
commit
a87dea4f8c
@ -34,10 +34,10 @@ namespace llvm {
|
|||||||
class MachineModuleInfo;
|
class MachineModuleInfo;
|
||||||
class MCInst;
|
class MCInst;
|
||||||
class MCContext;
|
class MCContext;
|
||||||
|
class MCSection;
|
||||||
class MCStreamer;
|
class MCStreamer;
|
||||||
class DwarfWriter;
|
class DwarfWriter;
|
||||||
class Mangler;
|
class Mangler;
|
||||||
class Section;
|
|
||||||
class TargetAsmInfo;
|
class TargetAsmInfo;
|
||||||
class TargetLoweringObjectFile;
|
class TargetLoweringObjectFile;
|
||||||
class Type;
|
class Type;
|
||||||
@ -113,7 +113,7 @@ namespace llvm {
|
|||||||
/// CurrentSection - The current section we are emitting to. This is
|
/// CurrentSection - The current section we are emitting to. This is
|
||||||
/// controlled and used by the SwitchSection method.
|
/// controlled and used by the SwitchSection method.
|
||||||
std::string CurrentSection;
|
std::string CurrentSection;
|
||||||
const Section* CurrentSection_;
|
const MCSection *CurrentSection_;
|
||||||
|
|
||||||
/// IsInTextSection - True if the current section we are emitting to is a
|
/// IsInTextSection - True if the current section we are emitting to is a
|
||||||
/// text section.
|
/// text section.
|
||||||
@ -173,7 +173,7 @@ namespace llvm {
|
|||||||
|
|
||||||
/// SwitchToSection - Switch to the specified section of the executable if
|
/// SwitchToSection - Switch to the specified section of the executable if
|
||||||
/// we are not already in it!
|
/// we are not already in it!
|
||||||
void SwitchToSection(const Section* NS);
|
void SwitchToSection(const MCSection *NS);
|
||||||
|
|
||||||
/// getGlobalLinkName - Returns the asm/link name of of the specified
|
/// getGlobalLinkName - Returns the asm/link name of of the specified
|
||||||
/// global variable. Should be overridden by each target asm printer to
|
/// global variable. Should be overridden by each target asm printer to
|
||||||
|
@ -32,30 +32,35 @@ namespace llvm {
|
|||||||
void operator=(const MCSection&); // DO NOT IMPLEMENT
|
void operator=(const MCSection&); // DO NOT IMPLEMENT
|
||||||
protected:
|
protected:
|
||||||
MCSection(const StringRef &Name, MCContext &Ctx);
|
MCSection(const StringRef &Name, MCContext &Ctx);
|
||||||
|
// FIXME: HACK.
|
||||||
|
SectionKind Kind;
|
||||||
public:
|
public:
|
||||||
virtual ~MCSection();
|
virtual ~MCSection();
|
||||||
|
|
||||||
static MCSection *Create(const StringRef &Name, MCContext &Ctx);
|
static MCSection *Create(const StringRef &Name, MCContext &Ctx);
|
||||||
|
|
||||||
const std::string &getName() const { return Name; }
|
const std::string &getName() const { return Name; }
|
||||||
|
SectionKind getKind() const { return Kind; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/// MCSectionWithKind - This is used by targets that use the SectionKind enum
|
/// MCSectionWithKind - This is used by targets that use the SectionKind enum
|
||||||
/// to classify their sections.
|
/// to classify their sections.
|
||||||
class MCSectionWithKind : public MCSection {
|
class MCSectionWithKind : public MCSection {
|
||||||
SectionKind Kind;
|
|
||||||
MCSectionWithKind(const StringRef &Name, SectionKind K, MCContext &Ctx)
|
MCSectionWithKind(const StringRef &Name, SectionKind K, MCContext &Ctx)
|
||||||
: MCSection(Name, Ctx), Kind(K) {}
|
: MCSection(Name, Ctx) {
|
||||||
|
Kind = K;
|
||||||
|
}
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static MCSectionWithKind *Create(const StringRef &Name, SectionKind K,
|
static MCSectionWithKind *Create(const StringRef &Name, SectionKind K,
|
||||||
MCContext &Ctx);
|
MCContext &Ctx);
|
||||||
|
|
||||||
SectionKind getKind() const { return Kind; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef MCSectionWithKind MCSectionELF;
|
||||||
|
|
||||||
} // end namespace llvm
|
} // end namespace llvm
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
#ifndef LLVM_TARGET_ASM_INFO_H
|
#ifndef LLVM_TARGET_ASM_INFO_H
|
||||||
#define LLVM_TARGET_ASM_INFO_H
|
#define LLVM_TARGET_ASM_INFO_H
|
||||||
|
|
||||||
#include "llvm/ADT/StringMap.h"
|
|
||||||
#include "llvm/Support/DataTypes.h"
|
#include "llvm/Support/DataTypes.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -15,11 +15,15 @@
|
|||||||
#ifndef LLVM_TARGET_TARGETLOWERINGOBJECTFILE_H
|
#ifndef LLVM_TARGET_TARGETLOWERINGOBJECTFILE_H
|
||||||
#define LLVM_TARGET_TARGETLOWERINGOBJECTFILE_H
|
#define LLVM_TARGET_TARGETLOWERINGOBJECTFILE_H
|
||||||
|
|
||||||
// FIXME: Switch to MC.
|
#include "llvm/ADT/SmallVector.h"
|
||||||
#include "llvm/Target/TargetAsmInfo.h"
|
#include "llvm/ADT/StringMap.h"
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
class MCSection;
|
||||||
class MCContext;
|
class MCContext;
|
||||||
|
class GlobalValue;
|
||||||
|
class Mangler;
|
||||||
|
class TargetMachine;
|
||||||
|
|
||||||
/// SectionKind - This is a simple POD value that classifies the properties of
|
/// SectionKind - This is a simple POD value that classifies the properties of
|
||||||
/// a section. A global variable is classified into the deepest possible
|
/// a section. A global variable is classified into the deepest possible
|
||||||
@ -199,60 +203,47 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class Section {
|
|
||||||
public:
|
|
||||||
|
|
||||||
std::string Name;
|
|
||||||
SectionKind Kind;
|
|
||||||
|
|
||||||
explicit Section() { }
|
|
||||||
Section(const std::string &N, SectionKind K) : Name(N), Kind(K) {}
|
|
||||||
const std::string &getName() const { return Name; }
|
|
||||||
SectionKind getKind() const { return Kind; }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class TargetLoweringObjectFile {
|
class TargetLoweringObjectFile {
|
||||||
private:
|
MCContext *Ctx;
|
||||||
mutable StringMap<Section> Sections;
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
TargetLoweringObjectFile();
|
TargetLoweringObjectFile();
|
||||||
|
|
||||||
/// TextSection - Section directive for standard text.
|
/// TextSection - Section directive for standard text.
|
||||||
///
|
///
|
||||||
const Section *TextSection; // Defaults to ".text".
|
const MCSection *TextSection; // Defaults to ".text".
|
||||||
|
|
||||||
/// DataSection - Section directive for standard data.
|
/// DataSection - Section directive for standard data.
|
||||||
///
|
///
|
||||||
const Section *DataSection; // Defaults to ".data".
|
const MCSection *DataSection; // Defaults to ".data".
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// FIXME: SINK THESE.
|
// FIXME: SINK THESE.
|
||||||
const Section *BSSSection_;
|
const MCSection *BSSSection_;
|
||||||
|
|
||||||
/// ReadOnlySection - This is the directive that is emitted to switch to a
|
/// ReadOnlySection - This is the directive that is emitted to switch to a
|
||||||
/// read-only section for constant data (e.g. data declared const,
|
/// read-only section for constant data (e.g. data declared const,
|
||||||
/// jump tables).
|
/// jump tables).
|
||||||
const Section *ReadOnlySection; // Defaults to NULL
|
const MCSection *ReadOnlySection; // Defaults to NULL
|
||||||
|
|
||||||
/// TLSDataSection - Section directive for Thread Local data.
|
/// TLSDataSection - Section directive for Thread Local data.
|
||||||
///
|
///
|
||||||
const Section *TLSDataSection; // Defaults to ".tdata".
|
const MCSection *TLSDataSection; // Defaults to ".tdata".
|
||||||
|
|
||||||
/// TLSBSSSection - Section directive for Thread Local uninitialized data.
|
/// TLSBSSSection - Section directive for Thread Local uninitialized data.
|
||||||
/// Null if this target doesn't support a BSS section.
|
/// Null if this target doesn't support a BSS section.
|
||||||
///
|
///
|
||||||
const Section *TLSBSSSection; // Defaults to ".tbss".
|
const MCSection *TLSBSSSection; // Defaults to ".tbss".
|
||||||
|
|
||||||
const Section *CStringSection_;
|
const MCSection *CStringSection_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// FIXME: NONPUB.
|
// FIXME: NONPUB.
|
||||||
const Section *getOrCreateSection(const char *Name,
|
const MCSection *getOrCreateSection(const char *Name,
|
||||||
bool isDirective,
|
bool isDirective,
|
||||||
SectionKind::Kind K) const;
|
SectionKind::Kind K) const;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual ~TargetLoweringObjectFile();
|
virtual ~TargetLoweringObjectFile();
|
||||||
@ -260,17 +251,19 @@ public:
|
|||||||
/// Initialize - this method must be called before any actual lowering is
|
/// Initialize - this method must be called before any actual lowering is
|
||||||
/// done. This specifies the current context for codegen, and gives the
|
/// done. This specifies the current context for codegen, and gives the
|
||||||
/// lowering implementations a chance to set up their default sections.
|
/// lowering implementations a chance to set up their default sections.
|
||||||
virtual void Initialize(MCContext &Ctx, const TargetMachine &TM) {}
|
virtual void Initialize(MCContext &ctx, const TargetMachine &TM) {
|
||||||
|
Ctx = &ctx;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const Section *getTextSection() const { return TextSection; }
|
const MCSection *getTextSection() const { return TextSection; }
|
||||||
const Section *getDataSection() const { return DataSection; }
|
const MCSection *getDataSection() const { return DataSection; }
|
||||||
|
|
||||||
|
|
||||||
/// getSectionForMergeableConstant - Given a mergeable constant with the
|
/// getSectionForMergeableConstant - Given a mergeable constant with the
|
||||||
/// specified size and relocation information, return a section that it
|
/// specified size and relocation information, return a section that it
|
||||||
/// should be placed in.
|
/// should be placed in.
|
||||||
virtual const Section *
|
virtual const MCSection *
|
||||||
getSectionForMergeableConstant(SectionKind Kind) const;
|
getSectionForMergeableConstant(SectionKind Kind) const;
|
||||||
|
|
||||||
/// getKindForNamedSection - If this target wants to be able to override
|
/// getKindForNamedSection - If this target wants to be able to override
|
||||||
@ -285,15 +278,15 @@ public:
|
|||||||
/// SectionForGlobal - This method computes the appropriate section to emit
|
/// SectionForGlobal - This method computes the appropriate section to emit
|
||||||
/// the specified global variable or function definition. This should not
|
/// the specified global variable or function definition. This should not
|
||||||
/// be passed external (or available externally) globals.
|
/// be passed external (or available externally) globals.
|
||||||
const Section *SectionForGlobal(const GlobalValue *GV,
|
const MCSection *SectionForGlobal(const GlobalValue *GV,
|
||||||
Mangler *Mang,
|
Mangler *Mang,
|
||||||
const TargetMachine &TM) const;
|
const TargetMachine &TM) const;
|
||||||
|
|
||||||
/// getSpecialCasedSectionGlobals - Allow the target to completely override
|
/// getSpecialCasedSectionGlobals - Allow the target to completely override
|
||||||
/// section assignment of a global.
|
/// section assignment of a global.
|
||||||
/// FIXME: ELIMINATE this by making PIC16 implement ADDRESS with
|
/// FIXME: ELIMINATE this by making PIC16 implement ADDRESS with
|
||||||
/// getFlagsForNamedSection.
|
/// getFlagsForNamedSection.
|
||||||
virtual const Section *
|
virtual const MCSection *
|
||||||
getSpecialCasedSectionGlobals(const GlobalValue *GV, Mangler *Mang,
|
getSpecialCasedSectionGlobals(const GlobalValue *GV, Mangler *Mang,
|
||||||
SectionKind Kind) const {
|
SectionKind Kind) const {
|
||||||
return 0;
|
return 0;
|
||||||
@ -307,7 +300,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual const Section *
|
virtual const MCSection *
|
||||||
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||||
Mangler *Mang, const TargetMachine &TM) const;
|
Mangler *Mang, const TargetMachine &TM) const;
|
||||||
};
|
};
|
||||||
@ -332,7 +325,7 @@ public:
|
|||||||
/// getSectionForMergeableConstant - Given a mergeable constant with the
|
/// getSectionForMergeableConstant - Given a mergeable constant with the
|
||||||
/// specified size and relocation information, return a section that it
|
/// specified size and relocation information, return a section that it
|
||||||
/// should be placed in.
|
/// should be placed in.
|
||||||
virtual const Section *
|
virtual const MCSection *
|
||||||
getSectionForMergeableConstant(SectionKind Kind) const;
|
getSectionForMergeableConstant(SectionKind Kind) const;
|
||||||
|
|
||||||
virtual SectionKind::Kind getKindForNamedSection(const char *Section,
|
virtual SectionKind::Kind getKindForNamedSection(const char *Section,
|
||||||
@ -340,40 +333,40 @@ public:
|
|||||||
void getSectionFlagsAsString(SectionKind Kind,
|
void getSectionFlagsAsString(SectionKind Kind,
|
||||||
SmallVectorImpl<char> &Str) const;
|
SmallVectorImpl<char> &Str) const;
|
||||||
|
|
||||||
virtual const Section *
|
virtual const MCSection *
|
||||||
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||||
Mangler *Mang, const TargetMachine &TM) const;
|
Mangler *Mang, const TargetMachine &TM) const;
|
||||||
protected:
|
protected:
|
||||||
const Section *DataRelSection;
|
const MCSection *DataRelSection;
|
||||||
const Section *DataRelLocalSection;
|
const MCSection *DataRelLocalSection;
|
||||||
const Section *DataRelROSection;
|
const MCSection *DataRelROSection;
|
||||||
const Section *DataRelROLocalSection;
|
const MCSection *DataRelROLocalSection;
|
||||||
|
|
||||||
const Section *MergeableConst4Section;
|
const MCSection *MergeableConst4Section;
|
||||||
const Section *MergeableConst8Section;
|
const MCSection *MergeableConst8Section;
|
||||||
const Section *MergeableConst16Section;
|
const MCSection *MergeableConst16Section;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class TargetLoweringObjectFileMachO : public TargetLoweringObjectFile {
|
class TargetLoweringObjectFileMachO : public TargetLoweringObjectFile {
|
||||||
const Section *TextCoalSection;
|
const MCSection *TextCoalSection;
|
||||||
const Section *ConstTextCoalSection;
|
const MCSection *ConstTextCoalSection;
|
||||||
const Section *ConstDataCoalSection;
|
const MCSection *ConstDataCoalSection;
|
||||||
const Section *ConstDataSection;
|
const MCSection *ConstDataSection;
|
||||||
const Section *DataCoalSection;
|
const MCSection *DataCoalSection;
|
||||||
const Section *FourByteConstantSection;
|
const MCSection *FourByteConstantSection;
|
||||||
const Section *EightByteConstantSection;
|
const MCSection *EightByteConstantSection;
|
||||||
const Section *SixteenByteConstantSection;
|
const MCSection *SixteenByteConstantSection;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual void Initialize(MCContext &Ctx, const TargetMachine &TM);
|
virtual void Initialize(MCContext &Ctx, const TargetMachine &TM);
|
||||||
|
|
||||||
virtual const Section *
|
virtual const MCSection *
|
||||||
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||||
Mangler *Mang, const TargetMachine &TM) const;
|
Mangler *Mang, const TargetMachine &TM) const;
|
||||||
|
|
||||||
virtual const Section *
|
virtual const MCSection *
|
||||||
getSectionForMergeableConstant(SectionKind Kind) const;
|
getSectionForMergeableConstant(SectionKind Kind) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -386,7 +379,7 @@ public:
|
|||||||
virtual void getSectionFlagsAsString(SectionKind Kind,
|
virtual void getSectionFlagsAsString(SectionKind Kind,
|
||||||
SmallVectorImpl<char> &Str) const;
|
SmallVectorImpl<char> &Str) const;
|
||||||
|
|
||||||
virtual const Section *
|
virtual const MCSection *
|
||||||
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||||
Mangler *Mang, const TargetMachine &TM) const;
|
Mangler *Mang, const TargetMachine &TM) const;
|
||||||
};
|
};
|
||||||
|
@ -23,8 +23,9 @@
|
|||||||
#include "llvm/CodeGen/DwarfWriter.h"
|
#include "llvm/CodeGen/DwarfWriter.h"
|
||||||
#include "llvm/Analysis/DebugInfo.h"
|
#include "llvm/Analysis/DebugInfo.h"
|
||||||
#include "llvm/MC/MCContext.h"
|
#include "llvm/MC/MCContext.h"
|
||||||
#include "llvm/MC/MCStreamer.h"
|
|
||||||
#include "llvm/MC/MCInst.h"
|
#include "llvm/MC/MCInst.h"
|
||||||
|
#include "llvm/MC/MCSection.h"
|
||||||
|
#include "llvm/MC/MCStreamer.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
#include "llvm/Support/FormattedStream.h"
|
#include "llvm/Support/FormattedStream.h"
|
||||||
@ -132,7 +133,7 @@ void AsmPrinter::SwitchToDataSection(const char *NewSection,
|
|||||||
|
|
||||||
/// SwitchToSection - Switch to the specified section of the executable if we
|
/// SwitchToSection - Switch to the specified section of the executable if we
|
||||||
/// are not already in it!
|
/// are not already in it!
|
||||||
void AsmPrinter::SwitchToSection(const Section *NS) {
|
void AsmPrinter::SwitchToSection(const MCSection *NS) {
|
||||||
const std::string &NewSection = NS->getName();
|
const std::string &NewSection = NS->getName();
|
||||||
|
|
||||||
// If we're already in this section, we're done.
|
// If we're already in this section, we're done.
|
||||||
@ -308,10 +309,10 @@ void AsmPrinter::SetupMachineFunction(MachineFunction &MF) {
|
|||||||
namespace {
|
namespace {
|
||||||
// SectionCPs - Keep track the alignment, constpool entries per Section.
|
// SectionCPs - Keep track the alignment, constpool entries per Section.
|
||||||
struct SectionCPs {
|
struct SectionCPs {
|
||||||
const Section *S;
|
const MCSection *S;
|
||||||
unsigned Alignment;
|
unsigned Alignment;
|
||||||
SmallVector<unsigned, 4> CPEs;
|
SmallVector<unsigned, 4> CPEs;
|
||||||
SectionCPs(const Section *s, unsigned a) : S(s), Alignment(a) {};
|
SectionCPs(const MCSection *s, unsigned a) : S(s), Alignment(a) {};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -347,7 +348,8 @@ void AsmPrinter::EmitConstantPool(MachineConstantPool *MCP) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const Section *S =getObjFileLowering().getSectionForMergeableConstant(Kind);
|
const MCSection *S =
|
||||||
|
getObjFileLowering().getSectionForMergeableConstant(Kind);
|
||||||
|
|
||||||
// The number of sections are small, just do a linear search from the
|
// The number of sections are small, just do a linear search from the
|
||||||
// last section to the first.
|
// last section to the first.
|
||||||
@ -419,7 +421,7 @@ void AsmPrinter::EmitJumpTableInfo(MachineJumpTableInfo *MJTI,
|
|||||||
const char *JumpTableDataSection = TAI->getJumpTableDataSection();
|
const char *JumpTableDataSection = TAI->getJumpTableDataSection();
|
||||||
const Function *F = MF.getFunction();
|
const Function *F = MF.getFunction();
|
||||||
|
|
||||||
const Section *FuncSection =
|
const MCSection *FuncSection =
|
||||||
getObjFileLowering().SectionForGlobal(F, Mang, TM);
|
getObjFileLowering().SectionForGlobal(F, Mang, TM);
|
||||||
|
|
||||||
bool JTInDiffSection = false;
|
bool JTInDiffSection = false;
|
||||||
|
@ -14,13 +14,14 @@
|
|||||||
#include "DwarfDebug.h"
|
#include "DwarfDebug.h"
|
||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include "llvm/CodeGen/MachineModuleInfo.h"
|
#include "llvm/CodeGen/MachineModuleInfo.h"
|
||||||
#include "llvm/Support/Timer.h"
|
#include "llvm/MC/MCSection.h"
|
||||||
#include "llvm/System/Path.h"
|
|
||||||
#include "llvm/Target/TargetAsmInfo.h"
|
#include "llvm/Target/TargetAsmInfo.h"
|
||||||
#include "llvm/Target/TargetData.h"
|
#include "llvm/Target/TargetData.h"
|
||||||
#include "llvm/Target/TargetFrameInfo.h"
|
#include "llvm/Target/TargetFrameInfo.h"
|
||||||
#include "llvm/Target/TargetLoweringObjectFile.h"
|
#include "llvm/Target/TargetLoweringObjectFile.h"
|
||||||
#include "llvm/Target/TargetRegisterInfo.h"
|
#include "llvm/Target/TargetRegisterInfo.h"
|
||||||
|
#include "llvm/Support/Timer.h"
|
||||||
|
#include "llvm/System/Path.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
static TimerGroup &getDwarfTimerGroup() {
|
static TimerGroup &getDwarfTimerGroup() {
|
||||||
@ -224,7 +225,7 @@ DbgScope::~DbgScope() {
|
|||||||
DwarfDebug::DwarfDebug(raw_ostream &OS, AsmPrinter *A, const TargetAsmInfo *T)
|
DwarfDebug::DwarfDebug(raw_ostream &OS, AsmPrinter *A, const TargetAsmInfo *T)
|
||||||
: Dwarf(OS, A, T, "dbg"), ModuleCU(0),
|
: Dwarf(OS, A, T, "dbg"), ModuleCU(0),
|
||||||
AbbreviationsSet(InitAbbreviationsSetSize), Abbreviations(),
|
AbbreviationsSet(InitAbbreviationsSetSize), Abbreviations(),
|
||||||
ValuesSet(InitValuesSetSize), Values(), StringPool(), SectionMap(),
|
ValuesSet(InitValuesSetSize), Values(), StringPool(),
|
||||||
SectionSourceLines(), didInitial(false), shouldEmit(false),
|
SectionSourceLines(), didInitial(false), shouldEmit(false),
|
||||||
FunctionDbgScope(0), DebugTimer(0) {
|
FunctionDbgScope(0), DebugTimer(0) {
|
||||||
if (TimePassesIsEnabled)
|
if (TimePassesIsEnabled)
|
||||||
@ -2132,7 +2133,7 @@ void DwarfDebug::EmitDebugLines() {
|
|||||||
const std::vector<SrcLineInfo> &LineInfos = SectionSourceLines[j];
|
const std::vector<SrcLineInfo> &LineInfos = SectionSourceLines[j];
|
||||||
|
|
||||||
if (Asm->isVerbose()) {
|
if (Asm->isVerbose()) {
|
||||||
const Section* S = SectionMap[j + 1];
|
const MCSection *S = SectionMap[j + 1];
|
||||||
O << '\t' << TAI->getCommentString() << " Section"
|
O << '\t' << TAI->getCommentString() << " Section"
|
||||||
<< S->getName() << '\n';
|
<< S->getName() << '\n';
|
||||||
} else {
|
} else {
|
||||||
|
@ -120,7 +120,7 @@ class VISIBILITY_HIDDEN DwarfDebug : public Dwarf {
|
|||||||
|
|
||||||
/// SectionMap - Provides a unique id per text section.
|
/// SectionMap - Provides a unique id per text section.
|
||||||
///
|
///
|
||||||
UniqueVector<const Section*> SectionMap;
|
UniqueVector<const MCSection*> SectionMap;
|
||||||
|
|
||||||
/// SectionSourceLines - Tracks line numbers per text section.
|
/// SectionSourceLines - Tracks line numbers per text section.
|
||||||
///
|
///
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
#include "llvm/CodeGen/MachineCodeEmitter.h"
|
#include "llvm/CodeGen/MachineCodeEmitter.h"
|
||||||
#include "llvm/CodeGen/MachineConstantPool.h"
|
#include "llvm/CodeGen/MachineConstantPool.h"
|
||||||
#include "llvm/MC/MCContext.h"
|
#include "llvm/MC/MCContext.h"
|
||||||
|
#include "llvm/MC/MCSection.h"
|
||||||
#include "llvm/Target/TargetAsmInfo.h"
|
#include "llvm/Target/TargetAsmInfo.h"
|
||||||
#include "llvm/Target/TargetData.h"
|
#include "llvm/Target/TargetData.h"
|
||||||
#include "llvm/Target/TargetELFWriterInfo.h"
|
#include "llvm/Target/TargetELFWriterInfo.h"
|
||||||
@ -334,8 +335,8 @@ void ELFWriter::EmitGlobal(const GlobalValue *GV) {
|
|||||||
TM.getTargetLowering()->getObjFileLowering();
|
TM.getTargetLowering()->getObjFileLowering();
|
||||||
|
|
||||||
// Get the ELF section where this global belongs from TLOF
|
// Get the ELF section where this global belongs from TLOF
|
||||||
const Section *S = TLOF.SectionForGlobal(GV, Mang, TM);
|
const MCSection *S = TLOF.SectionForGlobal(GV, Mang, TM);
|
||||||
unsigned SectionFlags = getElfSectionFlags(S->getKind());
|
unsigned SectionFlags = getElfSectionFlags(((MCSectionELF*)S)->getKind());
|
||||||
|
|
||||||
// The symbol align should update the section alignment if needed
|
// The symbol align should update the section alignment if needed
|
||||||
const TargetData *TD = TM.getTargetData();
|
const TargetData *TD = TM.getTargetData();
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "llvm/CodeGen/MachineModuleInfo.h"
|
#include "llvm/CodeGen/MachineModuleInfo.h"
|
||||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||||
#include "llvm/CodeGen/MachineJumpTableInfo.h"
|
#include "llvm/CodeGen/MachineJumpTableInfo.h"
|
||||||
|
#include "llvm/MC/MCSection.h"
|
||||||
#include "llvm/Target/TargetAsmInfo.h"
|
#include "llvm/Target/TargetAsmInfo.h"
|
||||||
#include "llvm/Target/TargetData.h"
|
#include "llvm/Target/TargetData.h"
|
||||||
#include "llvm/Target/TargetLoweringObjectFile.h"
|
#include "llvm/Target/TargetLoweringObjectFile.h"
|
||||||
@ -1159,7 +1160,7 @@ void ARMAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
|
|||||||
if (Subtarget->isTargetELF())
|
if (Subtarget->isTargetELF())
|
||||||
O << "\t.type " << name << ",%object\n";
|
O << "\t.type " << name << ",%object\n";
|
||||||
|
|
||||||
const Section *TheSection =
|
const MCSection *TheSection =
|
||||||
getObjFileLowering().SectionForGlobal(GVar, Mang, TM);
|
getObjFileLowering().SectionForGlobal(GVar, Mang, TM);
|
||||||
SwitchToSection(TheSection);
|
SwitchToSection(TheSection);
|
||||||
|
|
||||||
|
@ -31,14 +31,16 @@
|
|||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
|
namespace {
|
||||||
class TargetLoweringObjectFileAlpha : public TargetLoweringObjectFile {
|
class TargetLoweringObjectFileAlpha : public TargetLoweringObjectFile {
|
||||||
public:
|
public:
|
||||||
TargetLoweringObjectFileAlpha() {
|
void Initialize(MCContext &Ctx, const TargetMachine &TM) {
|
||||||
|
TargetLoweringObjectFile::Initialize(Ctx, TM);
|
||||||
TextSection = getOrCreateSection("_text", true, SectionKind::Text);
|
TextSection = getOrCreateSection("_text", true, SectionKind::Text);
|
||||||
DataSection = getOrCreateSection("_data", true, SectionKind::DataRel);
|
DataSection = getOrCreateSection("_data", true, SectionKind::DataRel);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,15 +18,15 @@
|
|||||||
#include "llvm/Function.h"
|
#include "llvm/Function.h"
|
||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include "llvm/CodeGen/DwarfWriter.h"
|
#include "llvm/CodeGen/DwarfWriter.h"
|
||||||
#include "llvm/Support/FormattedStream.h"
|
|
||||||
#include "llvm/CodeGen/MachineFrameInfo.h"
|
#include "llvm/CodeGen/MachineFrameInfo.h"
|
||||||
#include "llvm/Support/Mangler.h"
|
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
|
||||||
#include "llvm/CodeGen/DwarfWriter.h"
|
#include "llvm/CodeGen/DwarfWriter.h"
|
||||||
#include "llvm/CodeGen/MachineModuleInfo.h"
|
#include "llvm/CodeGen/MachineModuleInfo.h"
|
||||||
|
#include "llvm/MC/MCSection.h"
|
||||||
#include "llvm/Target/TargetRegistry.h"
|
#include "llvm/Target/TargetRegistry.h"
|
||||||
#include "llvm/Target/TargetLoweringObjectFile.h"
|
#include "llvm/Target/TargetLoweringObjectFile.h"
|
||||||
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
|
#include "llvm/Support/FormattedStream.h"
|
||||||
|
#include "llvm/Support/Mangler.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
#include "PIC16GenAsmWriter.inc"
|
#include "PIC16GenAsmWriter.inc"
|
||||||
@ -71,7 +71,7 @@ bool PIC16AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
std::string T = PAN::getCodeSectionName(CurrentFnName);
|
std::string T = PAN::getCodeSectionName(CurrentFnName);
|
||||||
const char *codeSection = T.c_str();
|
const char *codeSection = T.c_str();
|
||||||
|
|
||||||
const Section *fCodeSection =
|
const MCSection *fCodeSection =
|
||||||
getObjFileLowering().getOrCreateSection(codeSection, false,
|
getObjFileLowering().getOrCreateSection(codeSection, false,
|
||||||
SectionKind::Text);
|
SectionKind::Text);
|
||||||
// Start the Code Section.
|
// Start the Code Section.
|
||||||
@ -348,7 +348,7 @@ void PIC16AsmPrinter::EmitFunctionFrame(MachineFunction &MF) {
|
|||||||
std::string T = PAN::getFrameSectionName(CurrentFnName);
|
std::string T = PAN::getFrameSectionName(CurrentFnName);
|
||||||
const char *SectionName = T.c_str();
|
const char *SectionName = T.c_str();
|
||||||
|
|
||||||
const Section *fPDataSection =
|
const MCSection *fPDataSection =
|
||||||
getObjFileLowering().getOrCreateSection(SectionName, false,
|
getObjFileLowering().getOrCreateSection(SectionName, false,
|
||||||
SectionKind::DataRel);
|
SectionKind::DataRel);
|
||||||
SwitchToSection(fPDataSection);
|
SwitchToSection(fPDataSection);
|
||||||
|
@ -143,7 +143,7 @@ static const char *getStdLibCallName(unsigned opcode) {
|
|||||||
|
|
||||||
// PIC16TargetLowering Constructor.
|
// PIC16TargetLowering Constructor.
|
||||||
PIC16TargetLowering::PIC16TargetLowering(PIC16TargetMachine &TM)
|
PIC16TargetLowering::PIC16TargetLowering(PIC16TargetMachine &TM)
|
||||||
: TargetLowering(TM, new PIC16TargetObjectFile(TM)), TmpSize(0) {
|
: TargetLowering(TM, new PIC16TargetObjectFile()), TmpSize(0) {
|
||||||
|
|
||||||
Subtarget = &TM.getSubtarget<PIC16Subtarget>();
|
Subtarget = &TM.getSubtarget<PIC16Subtarget>();
|
||||||
|
|
||||||
|
@ -12,11 +12,13 @@
|
|||||||
#include "PIC16TargetMachine.h"
|
#include "PIC16TargetMachine.h"
|
||||||
#include "llvm/DerivedTypes.h"
|
#include "llvm/DerivedTypes.h"
|
||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
|
#include "llvm/MC/MCSection.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
|
void PIC16TargetObjectFile::Initialize(MCContext &Ctx, const TargetMachine &tm){
|
||||||
|
TargetLoweringObjectFile::Initialize(Ctx, tm);
|
||||||
|
TM = &tm;
|
||||||
|
|
||||||
PIC16TargetObjectFile::PIC16TargetObjectFile(const PIC16TargetMachine &tm)
|
|
||||||
: TM (tm) {
|
|
||||||
BSSSection_ = getOrCreateSection("udata.# UDATA", false, SectionKind::BSS);
|
BSSSection_ = getOrCreateSection("udata.# UDATA", false, SectionKind::BSS);
|
||||||
ReadOnlySection = getOrCreateSection("romdata.# ROMDATA", false,
|
ReadOnlySection = getOrCreateSection("romdata.# ROMDATA", false,
|
||||||
SectionKind::ReadOnly);
|
SectionKind::ReadOnly);
|
||||||
@ -26,9 +28,7 @@ PIC16TargetObjectFile::PIC16TargetObjectFile(const PIC16TargetMachine &tm)
|
|||||||
// in BeginModule, and gpasm cribbs for that .text symbol.
|
// in BeginModule, and gpasm cribbs for that .text symbol.
|
||||||
TextSection = getOrCreateSection("", true, SectionKind::Text);
|
TextSection = getOrCreateSection("", true, SectionKind::Text);
|
||||||
|
|
||||||
|
ROSections.push_back(new PIC16Section(ReadOnlySection));
|
||||||
PIC16Section *ROSection = new PIC16Section(ReadOnlySection);
|
|
||||||
ROSections.push_back(ROSection);
|
|
||||||
|
|
||||||
// FIXME: I don't know what the classification of these sections really is.
|
// FIXME: I don't know what the classification of these sections really is.
|
||||||
ExternalVarDecls = new PIC16Section(getOrCreateSection("ExternalVarDecls",
|
ExternalVarDecls = new PIC16Section(getOrCreateSection("ExternalVarDecls",
|
||||||
@ -40,14 +40,14 @@ PIC16TargetObjectFile::PIC16TargetObjectFile(const PIC16TargetMachine &tm)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const Section *
|
const MCSection *
|
||||||
PIC16TargetObjectFile::getBSSSectionForGlobal(const GlobalVariable *GV) const {
|
PIC16TargetObjectFile::getBSSSectionForGlobal(const GlobalVariable *GV) const {
|
||||||
assert(GV->hasInitializer() && "This global doesn't need space");
|
assert(GV->hasInitializer() && "This global doesn't need space");
|
||||||
Constant *C = GV->getInitializer();
|
Constant *C = GV->getInitializer();
|
||||||
assert(C->isNullValue() && "Unitialized globals has non-zero initializer");
|
assert(C->isNullValue() && "Unitialized globals has non-zero initializer");
|
||||||
|
|
||||||
// Find how much space this global needs.
|
// Find how much space this global needs.
|
||||||
const TargetData *TD = TM.getTargetData();
|
const TargetData *TD = TM->getTargetData();
|
||||||
const Type *Ty = C->getType();
|
const Type *Ty = C->getType();
|
||||||
unsigned ValSize = TD->getTypeAllocSize(Ty);
|
unsigned ValSize = TD->getTypeAllocSize(Ty);
|
||||||
|
|
||||||
@ -64,9 +64,9 @@ PIC16TargetObjectFile::getBSSSectionForGlobal(const GlobalVariable *GV) const {
|
|||||||
// No BSS section spacious enough was found. Crate a new one.
|
// No BSS section spacious enough was found. Crate a new one.
|
||||||
if (!FoundBSS) {
|
if (!FoundBSS) {
|
||||||
std::string name = PAN::getUdataSectionName(BSSSections.size());
|
std::string name = PAN::getUdataSectionName(BSSSections.size());
|
||||||
const Section *NewSection = getOrCreateSection(name.c_str(), false,
|
const MCSection *NewSection = getOrCreateSection(name.c_str(), false,
|
||||||
// FIXME.
|
// FIXME.
|
||||||
SectionKind::Metadata);
|
SectionKind::Metadata);
|
||||||
|
|
||||||
FoundBSS = new PIC16Section(NewSection);
|
FoundBSS = new PIC16Section(NewSection);
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ PIC16TargetObjectFile::getBSSSectionForGlobal(const GlobalVariable *GV) const {
|
|||||||
return FoundBSS->S_;
|
return FoundBSS->S_;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Section *
|
const MCSection *
|
||||||
PIC16TargetObjectFile::getIDATASectionForGlobal(const GlobalVariable *GV) const{
|
PIC16TargetObjectFile::getIDATASectionForGlobal(const GlobalVariable *GV) const{
|
||||||
assert(GV->hasInitializer() && "This global doesn't need space");
|
assert(GV->hasInitializer() && "This global doesn't need space");
|
||||||
Constant *C = GV->getInitializer();
|
Constant *C = GV->getInitializer();
|
||||||
@ -89,7 +89,7 @@ PIC16TargetObjectFile::getIDATASectionForGlobal(const GlobalVariable *GV) const{
|
|||||||
"can split initialized RAM data only");
|
"can split initialized RAM data only");
|
||||||
|
|
||||||
// Find how much space this global needs.
|
// Find how much space this global needs.
|
||||||
const TargetData *TD = TM.getTargetData();
|
const TargetData *TD = TM->getTargetData();
|
||||||
const Type *Ty = C->getType();
|
const Type *Ty = C->getType();
|
||||||
unsigned ValSize = TD->getTypeAllocSize(Ty);
|
unsigned ValSize = TD->getTypeAllocSize(Ty);
|
||||||
|
|
||||||
@ -106,8 +106,7 @@ PIC16TargetObjectFile::getIDATASectionForGlobal(const GlobalVariable *GV) const{
|
|||||||
// No IDATA section spacious enough was found. Crate a new one.
|
// No IDATA section spacious enough was found. Crate a new one.
|
||||||
if (!FoundIDATA) {
|
if (!FoundIDATA) {
|
||||||
std::string name = PAN::getIdataSectionName(IDATASections.size());
|
std::string name = PAN::getIdataSectionName(IDATASections.size());
|
||||||
const Section *NewSection = getOrCreateSection(name.c_str(),
|
const MCSection *NewSection = getOrCreateSection(name.c_str(), false,
|
||||||
false,
|
|
||||||
// FIXME.
|
// FIXME.
|
||||||
SectionKind::Metadata);
|
SectionKind::Metadata);
|
||||||
|
|
||||||
@ -125,7 +124,7 @@ PIC16TargetObjectFile::getIDATASectionForGlobal(const GlobalVariable *GV) const{
|
|||||||
|
|
||||||
// Get the section for an automatic variable of a function.
|
// Get the section for an automatic variable of a function.
|
||||||
// For PIC16 they are globals only with mangled names.
|
// For PIC16 they are globals only with mangled names.
|
||||||
const Section *
|
const MCSection *
|
||||||
PIC16TargetObjectFile::getSectionForAuto(const GlobalVariable *GV) const {
|
PIC16TargetObjectFile::getSectionForAuto(const GlobalVariable *GV) const {
|
||||||
|
|
||||||
const std::string name = PAN::getSectionNameForSym(GV->getName());
|
const std::string name = PAN::getSectionNameForSym(GV->getName());
|
||||||
@ -142,10 +141,10 @@ PIC16TargetObjectFile::getSectionForAuto(const GlobalVariable *GV) const {
|
|||||||
|
|
||||||
// No Auto section was found. Crate a new one.
|
// No Auto section was found. Crate a new one.
|
||||||
if (!FoundAutoSec) {
|
if (!FoundAutoSec) {
|
||||||
const Section *NewSection = getOrCreateSection(name.c_str(),
|
const MCSection *NewSection = getOrCreateSection(name.c_str(),
|
||||||
// FIXME.
|
// FIXME.
|
||||||
false,
|
false,
|
||||||
SectionKind::Metadata);
|
SectionKind::Metadata);
|
||||||
|
|
||||||
FoundAutoSec = new PIC16Section(NewSection);
|
FoundAutoSec = new PIC16Section(NewSection);
|
||||||
|
|
||||||
@ -162,7 +161,7 @@ PIC16TargetObjectFile::getSectionForAuto(const GlobalVariable *GV) const {
|
|||||||
|
|
||||||
// Override default implementation to put the true globals into
|
// Override default implementation to put the true globals into
|
||||||
// multiple data sections if required.
|
// multiple data sections if required.
|
||||||
const Section*
|
const MCSection *
|
||||||
PIC16TargetObjectFile::SelectSectionForGlobal(const GlobalValue *GV1,
|
PIC16TargetObjectFile::SelectSectionForGlobal(const GlobalValue *GV1,
|
||||||
SectionKind Kind,
|
SectionKind Kind,
|
||||||
Mangler *Mang,
|
Mangler *Mang,
|
||||||
@ -224,7 +223,7 @@ PIC16TargetObjectFile::~PIC16TargetObjectFile() {
|
|||||||
|
|
||||||
/// getSpecialCasedSectionGlobals - Allow the target to completely override
|
/// getSpecialCasedSectionGlobals - Allow the target to completely override
|
||||||
/// section assignment of a global.
|
/// section assignment of a global.
|
||||||
const Section *
|
const MCSection *
|
||||||
PIC16TargetObjectFile::getSpecialCasedSectionGlobals(const GlobalValue *GV,
|
PIC16TargetObjectFile::getSpecialCasedSectionGlobals(const GlobalValue *GV,
|
||||||
Mangler *Mang,
|
Mangler *Mang,
|
||||||
SectionKind Kind) const {
|
SectionKind Kind) const {
|
||||||
@ -250,7 +249,7 @@ PIC16TargetObjectFile::getSpecialCasedSectionGlobals(const GlobalValue *GV,
|
|||||||
|
|
||||||
// Create a new section for global variable. If Addr is given then create
|
// Create a new section for global variable. If Addr is given then create
|
||||||
// section at that address else create by name.
|
// section at that address else create by name.
|
||||||
const Section *
|
const MCSection *
|
||||||
PIC16TargetObjectFile::CreateSectionForGlobal(const GlobalVariable *GV,
|
PIC16TargetObjectFile::CreateSectionForGlobal(const GlobalVariable *GV,
|
||||||
Mangler *Mang,
|
Mangler *Mang,
|
||||||
const std::string &Addr) const {
|
const std::string &Addr) const {
|
||||||
@ -268,11 +267,11 @@ PIC16TargetObjectFile::CreateSectionForGlobal(const GlobalVariable *GV,
|
|||||||
return CreateROSectionForGlobal(GV, Addr);
|
return CreateROSectionForGlobal(GV, Addr);
|
||||||
|
|
||||||
// Else let the default implementation take care of it.
|
// Else let the default implementation take care of it.
|
||||||
return TargetLoweringObjectFile::SectionForGlobal(GV, Mang, TM);
|
return TargetLoweringObjectFile::SectionForGlobal(GV, Mang, *TM);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create uninitialized section for a variable.
|
// Create uninitialized section for a variable.
|
||||||
const Section *
|
const MCSection *
|
||||||
PIC16TargetObjectFile::CreateBSSSectionForGlobal(const GlobalVariable *GV,
|
PIC16TargetObjectFile::CreateBSSSectionForGlobal(const GlobalVariable *GV,
|
||||||
std::string Addr) const {
|
std::string Addr) const {
|
||||||
assert(GV->hasInitializer() && "This global doesn't need space");
|
assert(GV->hasInitializer() && "This global doesn't need space");
|
||||||
@ -297,8 +296,8 @@ PIC16TargetObjectFile::CreateBSSSectionForGlobal(const GlobalVariable *GV,
|
|||||||
|
|
||||||
PIC16Section *NewBSS = FoundBSS;
|
PIC16Section *NewBSS = FoundBSS;
|
||||||
if (NewBSS == NULL) {
|
if (NewBSS == NULL) {
|
||||||
const Section *NewSection = getOrCreateSection(Name.c_str(),
|
const MCSection *NewSection = getOrCreateSection(Name.c_str(), false,
|
||||||
false, SectionKind::BSS);
|
SectionKind::BSS);
|
||||||
NewBSS = new PIC16Section(NewSection);
|
NewBSS = new PIC16Section(NewSection);
|
||||||
BSSSections.push_back(NewBSS);
|
BSSSections.push_back(NewBSS);
|
||||||
}
|
}
|
||||||
@ -314,14 +313,14 @@ PIC16TargetObjectFile::CreateBSSSectionForGlobal(const GlobalVariable *GV,
|
|||||||
|
|
||||||
// Get rom section for a variable. Currently there can be only one rom section
|
// Get rom section for a variable. Currently there can be only one rom section
|
||||||
// unless a variable explicitly requests a section.
|
// unless a variable explicitly requests a section.
|
||||||
const Section *
|
const MCSection *
|
||||||
PIC16TargetObjectFile::getROSectionForGlobal(const GlobalVariable *GV) const {
|
PIC16TargetObjectFile::getROSectionForGlobal(const GlobalVariable *GV) const {
|
||||||
ROSections[0]->Items.push_back(GV);
|
ROSections[0]->Items.push_back(GV);
|
||||||
return ROSections[0]->S_;
|
return ROSections[0]->S_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create initialized data section for a variable.
|
// Create initialized data section for a variable.
|
||||||
const Section *
|
const MCSection *
|
||||||
PIC16TargetObjectFile::CreateIDATASectionForGlobal(const GlobalVariable *GV,
|
PIC16TargetObjectFile::CreateIDATASectionForGlobal(const GlobalVariable *GV,
|
||||||
std::string Addr) const {
|
std::string Addr) const {
|
||||||
assert(GV->hasInitializer() && "This global doesn't need space");
|
assert(GV->hasInitializer() && "This global doesn't need space");
|
||||||
@ -349,8 +348,7 @@ PIC16TargetObjectFile::CreateIDATASectionForGlobal(const GlobalVariable *GV,
|
|||||||
|
|
||||||
PIC16Section *NewIDATASec = FoundIDATASec;
|
PIC16Section *NewIDATASec = FoundIDATASec;
|
||||||
if (NewIDATASec == NULL) {
|
if (NewIDATASec == NULL) {
|
||||||
const Section *NewSection = getOrCreateSection(Name.c_str(),
|
const MCSection *NewSection = getOrCreateSection(Name.c_str(), false,
|
||||||
false,
|
|
||||||
// FIXME:
|
// FIXME:
|
||||||
SectionKind::Metadata);
|
SectionKind::Metadata);
|
||||||
NewIDATASec = new PIC16Section(NewSection);
|
NewIDATASec = new PIC16Section(NewSection);
|
||||||
@ -365,7 +363,7 @@ PIC16TargetObjectFile::CreateIDATASectionForGlobal(const GlobalVariable *GV,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create a section in rom for a variable.
|
// Create a section in rom for a variable.
|
||||||
const Section *
|
const MCSection *
|
||||||
PIC16TargetObjectFile::CreateROSectionForGlobal(const GlobalVariable *GV,
|
PIC16TargetObjectFile::CreateROSectionForGlobal(const GlobalVariable *GV,
|
||||||
std::string Addr) const {
|
std::string Addr) const {
|
||||||
assert(GV->getType()->getAddressSpace() == PIC16ISD::ROM_SPACE &&
|
assert(GV->getType()->getAddressSpace() == PIC16ISD::ROM_SPACE &&
|
||||||
@ -390,9 +388,8 @@ PIC16TargetObjectFile::CreateROSectionForGlobal(const GlobalVariable *GV,
|
|||||||
|
|
||||||
PIC16Section *NewRomSec = FoundROSec;
|
PIC16Section *NewRomSec = FoundROSec;
|
||||||
if (NewRomSec == NULL) {
|
if (NewRomSec == NULL) {
|
||||||
const Section *NewSection = getOrCreateSection(Name.c_str(),
|
const MCSection *NewSection = getOrCreateSection(Name.c_str(), false,
|
||||||
false,
|
SectionKind::ReadOnly);
|
||||||
SectionKind::ReadOnly);
|
|
||||||
NewRomSec = new PIC16Section(NewSection);
|
NewRomSec = new PIC16Section(NewSection);
|
||||||
ROSections.push_back(NewRomSec);
|
ROSections.push_back(NewRomSec);
|
||||||
}
|
}
|
||||||
|
@ -29,12 +29,12 @@ namespace llvm {
|
|||||||
/// FIXME: Reimplement by inheriting from MCSection.
|
/// FIXME: Reimplement by inheriting from MCSection.
|
||||||
///
|
///
|
||||||
struct PIC16Section {
|
struct PIC16Section {
|
||||||
const Section *S_; // Connection to actual Section.
|
const MCSection *S_; // Connection to actual Section.
|
||||||
unsigned Size; // Total size of the objects contained.
|
unsigned Size; // Total size of the objects contained.
|
||||||
bool SectionPrinted;
|
bool SectionPrinted;
|
||||||
std::vector<const GlobalVariable*> Items;
|
std::vector<const GlobalVariable*> Items;
|
||||||
|
|
||||||
PIC16Section(const Section *s) {
|
PIC16Section(const MCSection *s) {
|
||||||
S_ = s;
|
S_ = s;
|
||||||
Size = 0;
|
Size = 0;
|
||||||
SectionPrinted = false;
|
SectionPrinted = false;
|
||||||
@ -44,7 +44,7 @@ namespace llvm {
|
|||||||
};
|
};
|
||||||
|
|
||||||
class PIC16TargetObjectFile : public TargetLoweringObjectFile {
|
class PIC16TargetObjectFile : public TargetLoweringObjectFile {
|
||||||
const PIC16TargetMachine &TM;
|
const TargetMachine *TM;
|
||||||
public:
|
public:
|
||||||
mutable std::vector<PIC16Section*> BSSSections;
|
mutable std::vector<PIC16Section*> BSSSections;
|
||||||
mutable std::vector<PIC16Section*> IDATASections;
|
mutable std::vector<PIC16Section*> IDATASections;
|
||||||
@ -53,34 +53,36 @@ namespace llvm {
|
|||||||
mutable PIC16Section *ExternalVarDecls;
|
mutable PIC16Section *ExternalVarDecls;
|
||||||
mutable PIC16Section *ExternalVarDefs;
|
mutable PIC16Section *ExternalVarDefs;
|
||||||
|
|
||||||
PIC16TargetObjectFile(const PIC16TargetMachine &TM);
|
|
||||||
~PIC16TargetObjectFile();
|
~PIC16TargetObjectFile();
|
||||||
|
|
||||||
|
void Initialize(MCContext &Ctx, const TargetMachine &TM);
|
||||||
|
|
||||||
|
|
||||||
/// getSpecialCasedSectionGlobals - Allow the target to completely override
|
/// getSpecialCasedSectionGlobals - Allow the target to completely override
|
||||||
/// section assignment of a global.
|
/// section assignment of a global.
|
||||||
virtual const Section *
|
virtual const MCSection *
|
||||||
getSpecialCasedSectionGlobals(const GlobalValue *GV, Mangler *Mang,
|
getSpecialCasedSectionGlobals(const GlobalValue *GV, Mangler *Mang,
|
||||||
SectionKind Kind) const;
|
SectionKind Kind) const;
|
||||||
virtual const Section *SelectSectionForGlobal(const GlobalValue *GV,
|
virtual const MCSection *SelectSectionForGlobal(const GlobalValue *GV,
|
||||||
SectionKind Kind,
|
SectionKind Kind,
|
||||||
Mangler *Mang,
|
Mangler *Mang,
|
||||||
const TargetMachine&) const;
|
const TargetMachine&) const;
|
||||||
private:
|
private:
|
||||||
std::string getSectionNameForSym(const std::string &Sym) const;
|
std::string getSectionNameForSym(const std::string &Sym) const;
|
||||||
|
|
||||||
const Section *getBSSSectionForGlobal(const GlobalVariable *GV) const;
|
const MCSection *getBSSSectionForGlobal(const GlobalVariable *GV) const;
|
||||||
const Section *getIDATASectionForGlobal(const GlobalVariable *GV) const;
|
const MCSection *getIDATASectionForGlobal(const GlobalVariable *GV) const;
|
||||||
const Section *getSectionForAuto(const GlobalVariable *GV) const;
|
const MCSection *getSectionForAuto(const GlobalVariable *GV) const;
|
||||||
const Section *CreateBSSSectionForGlobal(const GlobalVariable *GV,
|
const MCSection *CreateBSSSectionForGlobal(const GlobalVariable *GV,
|
||||||
std::string Addr = "") const;
|
|
||||||
const Section *CreateIDATASectionForGlobal(const GlobalVariable *GV,
|
|
||||||
std::string Addr = "") const;
|
std::string Addr = "") const;
|
||||||
const Section *getROSectionForGlobal(const GlobalVariable *GV) const;
|
const MCSection *CreateIDATASectionForGlobal(const GlobalVariable *GV,
|
||||||
const Section *CreateROSectionForGlobal(const GlobalVariable *GV,
|
std::string Addr = "") const;
|
||||||
std::string Addr = "") const;
|
const MCSection *getROSectionForGlobal(const GlobalVariable *GV) const;
|
||||||
const Section *CreateSectionForGlobal(const GlobalVariable *GV,
|
const MCSection *CreateROSectionForGlobal(const GlobalVariable *GV,
|
||||||
Mangler *Mang,
|
std::string Addr = "") const;
|
||||||
const std::string &Addr = "") const;
|
const MCSection *CreateSectionForGlobal(const GlobalVariable *GV,
|
||||||
|
Mangler *Mang,
|
||||||
|
const std::string &Addr = "") const;
|
||||||
public:
|
public:
|
||||||
void SetSectionForGVs(Module &M);
|
void SetSectionForGVs(Module &M);
|
||||||
const std::vector<PIC16Section*> &getBSSSections() const {
|
const std::vector<PIC16Section*> &getBSSSections() const {
|
||||||
|
@ -32,6 +32,13 @@
|
|||||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||||
#include "llvm/CodeGen/MachineInstr.h"
|
#include "llvm/CodeGen/MachineInstr.h"
|
||||||
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
||||||
|
#include "llvm/MC/MCSection.h"
|
||||||
|
#include "llvm/Target/TargetAsmInfo.h"
|
||||||
|
#include "llvm/Target/TargetLoweringObjectFile.h"
|
||||||
|
#include "llvm/Target/TargetRegisterInfo.h"
|
||||||
|
#include "llvm/Target/TargetInstrInfo.h"
|
||||||
|
#include "llvm/Target/TargetOptions.h"
|
||||||
|
#include "llvm/Target/TargetRegistry.h"
|
||||||
#include "llvm/Support/Mangler.h"
|
#include "llvm/Support/Mangler.h"
|
||||||
#include "llvm/Support/MathExtras.h"
|
#include "llvm/Support/MathExtras.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
@ -39,12 +46,6 @@
|
|||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
#include "llvm/Support/Compiler.h"
|
#include "llvm/Support/Compiler.h"
|
||||||
#include "llvm/Support/FormattedStream.h"
|
#include "llvm/Support/FormattedStream.h"
|
||||||
#include "llvm/Target/TargetAsmInfo.h"
|
|
||||||
#include "llvm/Target/TargetLoweringObjectFile.h"
|
|
||||||
#include "llvm/Target/TargetRegisterInfo.h"
|
|
||||||
#include "llvm/Target/TargetInstrInfo.h"
|
|
||||||
#include "llvm/Target/TargetOptions.h"
|
|
||||||
#include "llvm/Target/TargetRegistry.h"
|
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
#include "llvm/ADT/StringExtras.h"
|
#include "llvm/ADT/StringExtras.h"
|
||||||
#include "llvm/ADT/StringSet.h"
|
#include "llvm/ADT/StringSet.h"
|
||||||
@ -892,7 +893,7 @@ void PPCDarwinAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) {
|
|||||||
unsigned Size = TD->getTypeAllocSize(Type);
|
unsigned Size = TD->getTypeAllocSize(Type);
|
||||||
unsigned Align = TD->getPreferredAlignmentLog(GVar);
|
unsigned Align = TD->getPreferredAlignmentLog(GVar);
|
||||||
|
|
||||||
const Section *TheSection =
|
const MCSection *TheSection =
|
||||||
getObjFileLowering().SectionForGlobal(GVar, Mang, TM);
|
getObjFileLowering().SectionForGlobal(GVar, Mang, TM);
|
||||||
SwitchToSection(TheSection);
|
SwitchToSection(TheSection);
|
||||||
|
|
||||||
|
@ -16,10 +16,12 @@
|
|||||||
#include "llvm/Constants.h"
|
#include "llvm/Constants.h"
|
||||||
#include "llvm/DerivedTypes.h"
|
#include "llvm/DerivedTypes.h"
|
||||||
#include "llvm/GlobalVariable.h"
|
#include "llvm/GlobalVariable.h"
|
||||||
#include "llvm/Support/Mangler.h"
|
#include "llvm/MC/MCContext.h"
|
||||||
|
#include "llvm/MC/MCSection.h"
|
||||||
#include "llvm/Target/TargetMachine.h"
|
#include "llvm/Target/TargetMachine.h"
|
||||||
#include "llvm/Target/TargetData.h"
|
#include "llvm/Target/TargetData.h"
|
||||||
#include "llvm/Target/TargetOptions.h"
|
#include "llvm/Target/TargetOptions.h"
|
||||||
|
#include "llvm/Support/Mangler.h"
|
||||||
#include "llvm/ADT/StringExtras.h"
|
#include "llvm/ADT/StringExtras.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
@ -27,7 +29,7 @@ using namespace llvm;
|
|||||||
// Generic Code
|
// Generic Code
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
TargetLoweringObjectFile::TargetLoweringObjectFile() {
|
TargetLoweringObjectFile::TargetLoweringObjectFile() : Ctx(0) {
|
||||||
TextSection = 0;
|
TextSection = 0;
|
||||||
DataSection = 0;
|
DataSection = 0;
|
||||||
BSSSection_ = 0;
|
BSSSection_ = 0;
|
||||||
@ -176,7 +178,7 @@ static SectionKind::Kind SectionKindForGlobal(const GlobalValue *GV,
|
|||||||
/// SectionForGlobal - This method computes the appropriate section to emit
|
/// SectionForGlobal - This method computes the appropriate section to emit
|
||||||
/// the specified global variable or function definition. This should not
|
/// the specified global variable or function definition. This should not
|
||||||
/// be passed external (or available externally) globals.
|
/// be passed external (or available externally) globals.
|
||||||
const Section *TargetLoweringObjectFile::
|
const MCSection *TargetLoweringObjectFile::
|
||||||
SectionForGlobal(const GlobalValue *GV, Mangler *Mang,
|
SectionForGlobal(const GlobalValue *GV, Mangler *Mang,
|
||||||
const TargetMachine &TM) const {
|
const TargetMachine &TM) const {
|
||||||
assert(!GV->isDeclaration() && !GV->hasAvailableExternallyLinkage() &&
|
assert(!GV->isDeclaration() && !GV->hasAvailableExternallyLinkage() &&
|
||||||
@ -192,7 +194,7 @@ SectionForGlobal(const GlobalValue *GV, Mangler *Mang,
|
|||||||
if (GV->hasSection()) {
|
if (GV->hasSection()) {
|
||||||
// If the target has special section hacks for specifically named globals,
|
// If the target has special section hacks for specifically named globals,
|
||||||
// return them now.
|
// return them now.
|
||||||
if (const Section *TS = getSpecialCasedSectionGlobals(GV, Mang, Kind))
|
if (const MCSection *TS = getSpecialCasedSectionGlobals(GV, Mang, Kind))
|
||||||
return TS;
|
return TS;
|
||||||
|
|
||||||
// If the target has magic semantics for certain section names, make sure to
|
// If the target has magic semantics for certain section names, make sure to
|
||||||
@ -209,7 +211,7 @@ SectionForGlobal(const GlobalValue *GV, Mangler *Mang,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Lame default implementation. Calculate the section name for global.
|
// Lame default implementation. Calculate the section name for global.
|
||||||
const Section*
|
const MCSection *
|
||||||
TargetLoweringObjectFile::SelectSectionForGlobal(const GlobalValue *GV,
|
TargetLoweringObjectFile::SelectSectionForGlobal(const GlobalValue *GV,
|
||||||
SectionKind Kind,
|
SectionKind Kind,
|
||||||
Mangler *Mang,
|
Mangler *Mang,
|
||||||
@ -231,7 +233,7 @@ TargetLoweringObjectFile::SelectSectionForGlobal(const GlobalValue *GV,
|
|||||||
/// getSectionForMergableConstant - Given a mergable constant with the
|
/// getSectionForMergableConstant - Given a mergable constant with the
|
||||||
/// specified size and relocation information, return a section that it
|
/// specified size and relocation information, return a section that it
|
||||||
/// should be placed in.
|
/// should be placed in.
|
||||||
const Section *
|
const MCSection *
|
||||||
TargetLoweringObjectFile::
|
TargetLoweringObjectFile::
|
||||||
getSectionForMergeableConstant(SectionKind Kind) const {
|
getSectionForMergeableConstant(SectionKind Kind) const {
|
||||||
if (Kind.isReadOnly() && ReadOnlySection != 0)
|
if (Kind.isReadOnly() && ReadOnlySection != 0)
|
||||||
@ -241,18 +243,13 @@ getSectionForMergeableConstant(SectionKind Kind) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const Section *TargetLoweringObjectFile::
|
const MCSection *TargetLoweringObjectFile::
|
||||||
getOrCreateSection(const char *Name, bool isDirective,
|
getOrCreateSection(const char *Name, bool isDirective,
|
||||||
SectionKind::Kind Kind) const {
|
SectionKind::Kind Kind) const {
|
||||||
Section &S = Sections[Name];
|
if (MCSection *S = Ctx->GetSection(Name))
|
||||||
|
return S;
|
||||||
// This is newly-created section, set it up properly.
|
SectionKind K = SectionKind::get(Kind, false /*weak*/, !isDirective);
|
||||||
if (S.Name.empty()) {
|
return MCSectionWithKind::Create(Name, K, *Ctx);
|
||||||
S.Kind = SectionKind::get(Kind, false /*weak*/, !isDirective);
|
|
||||||
S.Name = Name;
|
|
||||||
}
|
|
||||||
|
|
||||||
return &S;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -263,6 +260,7 @@ getOrCreateSection(const char *Name, bool isDirective,
|
|||||||
|
|
||||||
void TargetLoweringObjectFileELF::Initialize(MCContext &Ctx,
|
void TargetLoweringObjectFileELF::Initialize(MCContext &Ctx,
|
||||||
const TargetMachine &TM) {
|
const TargetMachine &TM) {
|
||||||
|
TargetLoweringObjectFile::Initialize(Ctx, TM);
|
||||||
if (!HasCrazyBSS)
|
if (!HasCrazyBSS)
|
||||||
BSSSection_ = getOrCreateSection("\t.bss", true, SectionKind::BSS);
|
BSSSection_ = getOrCreateSection("\t.bss", true, SectionKind::BSS);
|
||||||
else
|
else
|
||||||
@ -401,7 +399,7 @@ static const char *getSectionPrefixForUniqueGlobal(SectionKind Kind) {
|
|||||||
return ".gnu.linkonce.d.rel.ro.";
|
return ".gnu.linkonce.d.rel.ro.";
|
||||||
}
|
}
|
||||||
|
|
||||||
const Section *TargetLoweringObjectFileELF::
|
const MCSection *TargetLoweringObjectFileELF::
|
||||||
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||||
Mangler *Mang, const TargetMachine &TM) const {
|
Mangler *Mang, const TargetMachine &TM) const {
|
||||||
|
|
||||||
@ -458,7 +456,7 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
|||||||
/// getSectionForMergeableConstant - Given a mergeable constant with the
|
/// getSectionForMergeableConstant - Given a mergeable constant with the
|
||||||
/// specified size and relocation information, return a section that it
|
/// specified size and relocation information, return a section that it
|
||||||
/// should be placed in.
|
/// should be placed in.
|
||||||
const Section *TargetLoweringObjectFileELF::
|
const MCSection *TargetLoweringObjectFileELF::
|
||||||
getSectionForMergeableConstant(SectionKind Kind) const {
|
getSectionForMergeableConstant(SectionKind Kind) const {
|
||||||
if (Kind.isMergeableConst4())
|
if (Kind.isMergeableConst4())
|
||||||
return MergeableConst4Section;
|
return MergeableConst4Section;
|
||||||
@ -480,6 +478,7 @@ getSectionForMergeableConstant(SectionKind Kind) const {
|
|||||||
|
|
||||||
void TargetLoweringObjectFileMachO::Initialize(MCContext &Ctx,
|
void TargetLoweringObjectFileMachO::Initialize(MCContext &Ctx,
|
||||||
const TargetMachine &TM) {
|
const TargetMachine &TM) {
|
||||||
|
TargetLoweringObjectFile::Initialize(Ctx, TM);
|
||||||
TextSection = getOrCreateSection("\t.text", true, SectionKind::Text);
|
TextSection = getOrCreateSection("\t.text", true, SectionKind::Text);
|
||||||
DataSection = getOrCreateSection("\t.data", true, SectionKind::DataRel);
|
DataSection = getOrCreateSection("\t.data", true, SectionKind::DataRel);
|
||||||
|
|
||||||
@ -514,7 +513,7 @@ void TargetLoweringObjectFileMachO::Initialize(MCContext &Ctx,
|
|||||||
false, SectionKind::DataRel);
|
false, SectionKind::DataRel);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Section *TargetLoweringObjectFileMachO::
|
const MCSection *TargetLoweringObjectFileMachO::
|
||||||
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||||
Mangler *Mang, const TargetMachine &TM) const {
|
Mangler *Mang, const TargetMachine &TM) const {
|
||||||
assert(!Kind.isThreadLocal() && "Darwin doesn't support TLS");
|
assert(!Kind.isThreadLocal() && "Darwin doesn't support TLS");
|
||||||
@ -569,7 +568,7 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
|||||||
return DataSection;
|
return DataSection;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Section *
|
const MCSection *
|
||||||
TargetLoweringObjectFileMachO::
|
TargetLoweringObjectFileMachO::
|
||||||
getSectionForMergeableConstant(SectionKind Kind) const {
|
getSectionForMergeableConstant(SectionKind Kind) const {
|
||||||
// If this constant requires a relocation, we have to put it in the data
|
// If this constant requires a relocation, we have to put it in the data
|
||||||
@ -592,6 +591,7 @@ getSectionForMergeableConstant(SectionKind Kind) const {
|
|||||||
|
|
||||||
void TargetLoweringObjectFileCOFF::Initialize(MCContext &Ctx,
|
void TargetLoweringObjectFileCOFF::Initialize(MCContext &Ctx,
|
||||||
const TargetMachine &TM) {
|
const TargetMachine &TM) {
|
||||||
|
TargetLoweringObjectFile::Initialize(Ctx, TM);
|
||||||
TextSection = getOrCreateSection("\t.text", true, SectionKind::Text);
|
TextSection = getOrCreateSection("\t.text", true, SectionKind::Text);
|
||||||
DataSection = getOrCreateSection("\t.data", true, SectionKind::DataRel);
|
DataSection = getOrCreateSection("\t.data", true, SectionKind::DataRel);
|
||||||
}
|
}
|
||||||
@ -618,7 +618,7 @@ static const char *getCOFFSectionPrefixForUniqueGlobal(SectionKind Kind) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const Section *TargetLoweringObjectFileCOFF::
|
const MCSection *TargetLoweringObjectFileCOFF::
|
||||||
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||||
Mangler *Mang, const TargetMachine &TM) const {
|
Mangler *Mang, const TargetMachine &TM) const {
|
||||||
assert(!Kind.isThreadLocal() && "Doesn't support TLS");
|
assert(!Kind.isThreadLocal() && "Doesn't support TLS");
|
||||||
@ -635,9 +635,8 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
|||||||
if (Kind.isText())
|
if (Kind.isText())
|
||||||
return getTextSection();
|
return getTextSection();
|
||||||
|
|
||||||
if (Kind.isBSS())
|
if (Kind.isBSS() && BSSSection_ != 0)
|
||||||
if (const Section *S = BSSSection_)
|
return BSSSection_;
|
||||||
return S;
|
|
||||||
|
|
||||||
if (Kind.isReadOnly() && ReadOnlySection != 0)
|
if (Kind.isReadOnly() && ReadOnlySection != 0)
|
||||||
return ReadOnlySection;
|
return ReadOnlySection;
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "llvm/ADT/StringExtras.h"
|
#include "llvm/ADT/StringExtras.h"
|
||||||
#include "llvm/MC/MCContext.h"
|
#include "llvm/MC/MCContext.h"
|
||||||
#include "llvm/MC/MCInst.h"
|
#include "llvm/MC/MCInst.h"
|
||||||
|
#include "llvm/MC/MCSection.h"
|
||||||
#include "llvm/MC/MCStreamer.h"
|
#include "llvm/MC/MCStreamer.h"
|
||||||
#include "llvm/CodeGen/DwarfWriter.h"
|
#include "llvm/CodeGen/DwarfWriter.h"
|
||||||
#include "llvm/CodeGen/MachineJumpTableInfo.h"
|
#include "llvm/CodeGen/MachineJumpTableInfo.h"
|
||||||
@ -783,7 +784,7 @@ void X86ATTAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
|
|||||||
if (Subtarget->isTargetELF())
|
if (Subtarget->isTargetELF())
|
||||||
O << "\t.type\t" << name << ",@object\n";
|
O << "\t.type\t" << name << ",@object\n";
|
||||||
|
|
||||||
const Section *TheSection =
|
const MCSection *TheSection =
|
||||||
getObjFileLowering().SectionForGlobal(GVar, Mang, TM);
|
getObjFileLowering().SectionForGlobal(GVar, Mang, TM);
|
||||||
SwitchToSection(TheSection);
|
SwitchToSection(TheSection);
|
||||||
|
|
||||||
|
@ -56,8 +56,7 @@ getTargetNodeName(unsigned Opcode) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
XCoreTargetLowering::XCoreTargetLowering(XCoreTargetMachine &XTM)
|
XCoreTargetLowering::XCoreTargetLowering(XCoreTargetMachine &XTM)
|
||||||
: TargetLowering(XTM,
|
: TargetLowering(XTM, new XCoreTargetObjectFile()),
|
||||||
new XCoreTargetObjectFile(XTM.getSubtargetImpl()->isXS1A())),
|
|
||||||
TM(XTM),
|
TM(XTM),
|
||||||
Subtarget(*XTM.getSubtargetImpl()) {
|
Subtarget(*XTM.getSubtargetImpl()) {
|
||||||
|
|
||||||
|
@ -8,10 +8,14 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#include "XCoreTargetObjectFile.h"
|
#include "XCoreTargetObjectFile.h"
|
||||||
|
#include "XCoreSubtarget.h"
|
||||||
|
#include "llvm/Target/TargetMachine.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
|
|
||||||
XCoreTargetObjectFile::XCoreTargetObjectFile(bool isXS1A) {
|
void XCoreTargetObjectFile::Initialize(MCContext &Ctx, const TargetMachine &TM){
|
||||||
|
TargetLoweringObjectFileELF::Initialize(Ctx, TM);
|
||||||
|
|
||||||
TextSection = getOrCreateSection("\t.text", true, SectionKind::Text);
|
TextSection = getOrCreateSection("\t.text", true, SectionKind::Text);
|
||||||
DataSection = getOrCreateSection("\t.dp.data", false, SectionKind::DataRel);
|
DataSection = getOrCreateSection("\t.dp.data", false, SectionKind::DataRel);
|
||||||
BSSSection_ = getOrCreateSection("\t.dp.bss", false, SectionKind::BSS);
|
BSSSection_ = getOrCreateSection("\t.dp.bss", false, SectionKind::BSS);
|
||||||
@ -22,7 +26,7 @@ XCoreTargetObjectFile::XCoreTargetObjectFile(bool isXS1A) {
|
|||||||
TLSDataSection = DataSection;
|
TLSDataSection = DataSection;
|
||||||
TLSBSSSection = BSSSection_;
|
TLSBSSSection = BSSSection_;
|
||||||
|
|
||||||
if (isXS1A)
|
if (TM.getSubtarget<XCoreSubtarget>().isXS1A())
|
||||||
// FIXME: Why is this writable ("datarel")???
|
// FIXME: Why is this writable ("datarel")???
|
||||||
ReadOnlySection = getOrCreateSection("\t.dp.rodata", false,
|
ReadOnlySection = getOrCreateSection("\t.dp.rodata", false,
|
||||||
SectionKind::DataRel);
|
SectionKind::DataRel);
|
||||||
|
@ -16,7 +16,8 @@ namespace llvm {
|
|||||||
|
|
||||||
class XCoreTargetObjectFile : public TargetLoweringObjectFileELF {
|
class XCoreTargetObjectFile : public TargetLoweringObjectFileELF {
|
||||||
public:
|
public:
|
||||||
XCoreTargetObjectFile(bool isXS1A);
|
|
||||||
|
void Initialize(MCContext &Ctx, const TargetMachine &TM);
|
||||||
|
|
||||||
// TODO: Classify globals as xcore wishes.
|
// TODO: Classify globals as xcore wishes.
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
; RUN: llvm-as < %s | llc -march=xcore > %t1.s
|
; RUN: llvm-as < %s | llc -march=xcore | grep "xor" | count 1
|
||||||
; RUN: grep "xor" %t1.s | count 1
|
|
||||||
define i1 @test(double %F) nounwind {
|
define i1 @test(double %F) nounwind {
|
||||||
entry:
|
entry:
|
||||||
%0 = fsub double -0.000000e+00, %F
|
%0 = fsub double -0.000000e+00, %F
|
||||||
|
Loading…
x
Reference in New Issue
Block a user