summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fa6e5cb)
raw | patch | inline | side by side (parent: fa6e5cb)
author | Eric Christopher <echristo@gmail.com> | |
Thu, 23 Jan 2014 06:47:25 +0000 (06:47 +0000) | ||
committer | Eric Christopher <echristo@gmail.com> | |
Thu, 23 Jan 2014 06:47:25 +0000 (06:47 +0000) |
e.g. linkonce, to TargetMachine and set it when we've done so
for ELF targets currently. This involved making TargetMachine
non-const in a TLOF use and propagating that change around - I'm
open to other ideas.
This will be used in a future commit to handle emitting debug
information with ranges.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199871 91177308-0d34-0410-b5e6-96231b3b80d8
for ELF targets currently. This involved making TargetMachine
non-const in a TLOF use and propagating that change around - I'm
open to other ideas.
This will be used in a future commit to handle emitting debug
information with ranges.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199871 91177308-0d34-0410-b5e6-96231b3b80d8
14 files changed:
diff --git a/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h b/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
index 4e90e141ce16adcc8f576a08edd6e68daa3641b9..717ebdb2f71d6b40b6ea88a95d89637de9011e1c 100644 (file)
virtual const MCSection *
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
- Mangler *Mang, const TargetMachine &TM) const;
+ Mangler *Mang, TargetMachine &TM) const;
/// getTTypeGlobalReference - Return an MCExpr to use for a reference to the
/// specified type info global variable from exception handling information.
virtual const MCSection *
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
- Mangler *Mang, const TargetMachine &TM) const;
+ Mangler *Mang, TargetMachine &TM) const;
virtual const MCSection *
getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
virtual const MCSection *
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
- Mangler *Mang, const TargetMachine &TM) const;
+ Mangler *Mang, TargetMachine &TM) const;
/// getDepLibFromLinkerOpt - Extract the dependent library name from a linker
/// option string. Returns StringRef() if the option does not specify a library.
diff --git a/include/llvm/Target/TargetLoweringObjectFile.h b/include/llvm/Target/TargetLoweringObjectFile.h
index 5bf9a13563ed4e0630f1a738ba6a51ff4a4e7f8d..e7e16ace8947ada5ffb1605e89c78a38ac018d6c 100644 (file)
const DataLayout *DL;
TargetLoweringObjectFile(
- const TargetLoweringObjectFile&) LLVM_DELETED_FUNCTION;
+ const TargetLoweringObjectFile &) LLVM_DELETED_FUNCTION;
void operator=(const TargetLoweringObjectFile&) LLVM_DELETED_FUNCTION;
public:
/// be passed external (or available externally) globals.
const MCSection *SectionForGlobal(const GlobalValue *GV,
SectionKind Kind, Mangler *Mang,
- const TargetMachine &TM) const;
+ TargetMachine &TM) const;
/// SectionForGlobal - This method computes the appropriate section to emit
/// the specified global variable or function definition. This should not
/// be passed external (or available externally) globals.
const MCSection *SectionForGlobal(const GlobalValue *GV,
Mangler *Mang,
- const TargetMachine &TM) const {
+ TargetMachine &TM) const {
return SectionForGlobal(GV, getKindForGlobal(GV, TM), Mang, TM);
}
protected:
virtual const MCSection *
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
- Mangler *Mang, const TargetMachine &TM) const;
+ Mangler *Mang, TargetMachine &TM) const;
};
} // end namespace llvm
index c27ffdfcd77b3b74f0914e08162916eace43dd45..7cbc87d9a8b472b576f5eb29b11a0574267335c1 100644 (file)
unsigned MCUseLoc : 1;
unsigned MCUseCFI : 1;
unsigned MCUseDwarfDirectory : 1;
+ unsigned DebugUseUniqueSections : 1;
unsigned RequireStructuredCFG : 1;
public:
bool requiresStructuredCFG() const { return RequireStructuredCFG; }
void setRequiresStructuredCFG(bool Value) { RequireStructuredCFG = Value; }
+ bool debugUseUniqueSections() const { return DebugUseUniqueSections; }
+ void setDebugUseUniqueSections(bool Value) { DebugUseUniqueSections = Value; }
+
/// hasMCRelaxAll - Check whether all machine code instructions should be
/// relaxed.
bool hasMCRelaxAll() const { return MCRelaxAll; }
diff --git a/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index 3621b5828780cfb96ae3f7be9282b60e3e9d39f0..7f534acb70a7aef73e484a38d07d17b111e4745d 100644 (file)
const MCSection *TargetLoweringObjectFileELF::
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
- Mangler *Mang, const TargetMachine &TM) const {
+ Mangler *Mang, TargetMachine &TM) const {
// If we have -ffunction-section or -fdata-section then we should emit the
// global value to a uniqued section specifically for it.
bool EmitUniquedSection;
Flags |= ELF::SHF_GROUP;
}
+ // Set that we've used a unique section name in the target machine.
+ TM.setDebugUseUniqueSections(true);
return getContext().getELFSection(Name.str(),
getELFSectionType(Name.str(), Kind),
Flags, Kind, 0, Group);
const MCSection *TargetLoweringObjectFileMachO::
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
- Mangler *Mang, const TargetMachine &TM) const {
+ Mangler *Mang, TargetMachine &TM) const {
// Handle thread local data.
if (Kind.isThreadBSS()) return TLSBSSSection;
const MCSection *TargetLoweringObjectFileCOFF::
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
- Mangler *Mang, const TargetMachine &TM) const {
+ Mangler *Mang, TargetMachine &TM) const {
// If this global is linkonce/weak and the target handles this by emitting it
// into a 'uniqued' section name, create and return the section now.
diff --git a/lib/Target/Hexagon/HexagonTargetObjectFile.cpp b/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
index 7773cff2d21ae1932ad6e302c78b074a070fed3c..a26b81de06c5d9e886b13dfc1773edd6d9fd37a8 100644 (file)
const MCSection *HexagonTargetObjectFile::
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
- Mangler *Mang, const TargetMachine &TM) const {
+ Mangler *Mang, TargetMachine &TM) const {
// Handle Small Section classification here.
if (Kind.isBSS() && IsGlobalInSmallSection(GV, TM, Kind))
diff --git a/lib/Target/Hexagon/HexagonTargetObjectFile.h b/lib/Target/Hexagon/HexagonTargetObjectFile.h
index 41f6792ca8e51179a067ad9bd400c7f3bec9f417..ac87814b4b63b3a1fe98e48c49da644a57f8cbe5 100644 (file)
const TargetMachine &TM) const;
bool IsSmallDataEnabled () const;
- const MCSection* SelectSectionForGlobal(const GlobalValue *GV,
- SectionKind Kind,
- Mangler *Mang,
- const TargetMachine &TM) const;
+ const MCSection *SelectSectionForGlobal(const GlobalValue *GV,
+ SectionKind Kind, Mangler *Mang,
+ TargetMachine &TM) const;
};
} // namespace llvm
index 4c748c5b57cde4efa2b507274b9b8d3e5e626c0a..90808bcb05239150ba8c0d163ae21604a2d83391 100644 (file)
const MCSection *MipsTargetObjectFile::
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
- Mangler *Mang, const TargetMachine &TM) const {
+ Mangler *Mang, TargetMachine &TM) const {
// TODO: Could also support "weak" symbols as well with ".gnu.linkonce.s.*"
// sections?
index c0e9140c829cb92169e47d4500e5d14cc9e978ec..9aaf7941abfa6019723506cdef0fddf5c779aeed 100644 (file)
const TargetMachine &TM) const;
const MCSection *SelectSectionForGlobal(const GlobalValue *GV,
- SectionKind Kind,
- Mangler *Mang,
- const TargetMachine &TM) const;
+ SectionKind Kind, Mangler *Mang,
+ TargetMachine &TM) const;
// TODO: Classify globals as mips wishes.
const MCSection *getReginfoSection() const { return ReginfoSection; }
diff --git a/lib/Target/PowerPC/PPCTargetObjectFile.cpp b/lib/Target/PowerPC/PPCTargetObjectFile.cpp
index 32678674f9a658cbca4b6af9c1d405047e95d0d9..b9cfe7c9a84c23d74ca47f2b0448a026ade73a92 100644 (file)
const MCSection * PPC64LinuxTargetObjectFile::
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
- Mangler *Mang, const TargetMachine &TM) const {
+ Mangler *Mang, TargetMachine &TM) const {
const MCSection *DefaultSection =
TargetLoweringObjectFileELF::SelectSectionForGlobal(GV, Kind, Mang, TM);
index 262c52213d29ce5658818375ab580651982ea6f5..571954535db8227ec507454e5cdec20c175373d8 100644 (file)
virtual void Initialize(MCContext &Ctx, const TargetMachine &TM);
- virtual const MCSection *
- SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
- Mangler *Mang, const TargetMachine &TM) const;
+ virtual const MCSection *SelectSectionForGlobal(const GlobalValue *GV,
+ SectionKind Kind,
+ Mangler *Mang,
+ TargetMachine &TM) const;
/// \brief Describe a TLS variable address within debug info.
virtual const MCExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const;
index b62577e0801a634834688fa0b9b8f188f96af180..8d73a3ab34778b49d84719f99f129239cd7fc2d6 100644 (file)
/// be passed external (or available externally) globals.
const MCSection *TargetLoweringObjectFile::
SectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler *Mang,
- const TargetMachine &TM) const {
+ TargetMachine &TM) const {
// Select section name.
if (GV->hasSection())
return getExplicitSectionGlobal(GV, Kind, Mang, TM);
// Lame default implementation. Calculate the section name for global.
-const MCSection *
-TargetLoweringObjectFile::SelectSectionForGlobal(const GlobalValue *GV,
- SectionKind Kind,
- Mangler *Mang,
- const TargetMachine &TM) const{
+const MCSection *TargetLoweringObjectFile::SelectSectionForGlobal(
+ const GlobalValue *GV, SectionKind Kind, Mangler *Mang,
+ TargetMachine &TM) const {
assert(!Kind.isThreadLocal() && "Doesn't support TLS");
if (Kind.isText())
index a2350352071e5cdaba11d9e0ab2e52dc3f39c7fc..39ade0a2b852f640807295df88a0be47afe1d09d 100644 (file)
MCUseLoc(true),
MCUseCFI(true),
MCUseDwarfDirectory(false),
+ DebugUseUniqueSections(false),
RequireStructuredCFG(false),
Options(Options) {
}
diff --git a/lib/Target/XCore/XCoreTargetObjectFile.cpp b/lib/Target/XCore/XCoreTargetObjectFile.cpp
index 61eb2b51f3ebf744437490e3e4a8c09cabece476..fec79d759c80745e14bb391af5765ccaa3aedea9 100644 (file)
const MCSection *XCoreTargetObjectFile::
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler *Mang,
- const TargetMachine &TM) const{
+ TargetMachine &TM) const{
if (Kind.isText()) return TextSection;
if (Kind.isMergeable1ByteCString()) return CStringSection;
if (Kind.isMergeableConst4()) return MergeableConst4Section;
index bf9798d5085da22101d78537c7443d5f0c882d12..127ff0704c14c92459fcd768a444a863bcfb94ff 100644 (file)
getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
Mangler *Mang, const TargetMachine &TM) const;
- virtual const MCSection *
- SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
- Mangler *Mang, const TargetMachine &TM) const;
+ virtual const MCSection *SelectSectionForGlobal(const GlobalValue *GV,
+ SectionKind Kind,
+ Mangler *Mang,
+ TargetMachine &TM) const;
virtual const MCSection *getSectionForConstant(SectionKind Kind) const;
};