const Section* DataCoalSection;
explicit DarwinTargetAsmInfo(const TargetMachine &TM);
- virtual const Section* SelectSectionForGlobal(const GlobalValue *GV,
- bool NoCoalesce = false) const;
+ virtual const Section* SelectSectionForGlobal(const GlobalValue *GV) const;
virtual std::string UniqueSectionForGlobal(const GlobalValue* GV,
SectionKind::Kind kind) const;
const Section* MergeableConstSection(const GlobalVariable *GV) const;
struct ELFTargetAsmInfo: public virtual TargetAsmInfo {
explicit ELFTargetAsmInfo(const TargetMachine &TM);
- virtual const Section* SelectSectionForGlobal(const GlobalValue *GV,
- bool NoCoalesce = false) const;
+ virtual const Section* SelectSectionForGlobal(const GlobalValue *GV) const;
virtual std::string PrintSectionFlags(unsigned flags) const;
const Section* MergeableConstSection(const GlobalVariable *GV) const;
inline const Section* MergeableConstSection(const Type *Ty) const;
const char* name = NULL) const;
/// SectionForGlobal - This hooks returns proper section name for given
- /// global with all necessary flags and marks. If NoCoalesce is true,
- /// do not use coalesced section.
- virtual std::string SectionForGlobal(const GlobalValue *GV,
- bool NoCoalesce = false) const;
+ /// global with all necessary flags and marks.
+ virtual std::string SectionForGlobal(const GlobalValue *GV) const;
// Helper methods for SectionForGlobal
virtual std::string UniqueSectionForGlobal(const GlobalValue* GV,
virtual std::string PrintSectionFlags(unsigned flags) const { return ""; }
- virtual const Section* SelectSectionForGlobal(const GlobalValue *GV,
- bool NoCoalesce = false) const;
+ virtual const Section* SelectSectionForGlobal(const GlobalValue *GV) const;
virtual const Section* SelectSectionForMachineConst(const Type *Ty) const;
return;
}
- bool NoCoalesc = PCRelGVs.count(GVar);
- std::string SectionName = TAI->SectionForGlobal(GVar, NoCoalesc);
+ std::string SectionName = TAI->SectionForGlobal(GVar);
std::string name = Mang->getValueName(GVar);
Constant *C = GVar->getInitializer();
const Type *Type = C->getType();
if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
if (TAI->getLCOMMDirective() != NULL) {
- if (NoCoalesc || GVar->hasInternalLinkage()) {
+ if (PCRelGVs.count(GVar) || GVar->hasInternalLinkage()) {
O << TAI->getLCOMMDirective() << name << "," << Size;
if (Subtarget->isTargetDarwin())
O << "," << Align;
}
const Section*
-DarwinTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV,
- bool NoCoalesce) const {
+DarwinTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const {
SectionKind::Kind Kind = SectionKindForGlobal(GV);
- bool CanCoalesce = !NoCoalesce && GV->isWeakForLinker();
+ bool isWeak = GV->isWeakForLinker();
bool isNonStatic = (DTM->getRelocationModel() != Reloc::Static);
switch (Kind) {
case SectionKind::Text:
- if (CanCoalesce)
+ if (isWeak)
return TextCoalSection;
else
return getTextSection_();
case SectionKind::BSS:
case SectionKind::ThreadBSS:
if (cast<GlobalVariable>(GV)->isConstant())
- return (CanCoalesce ? ConstDataCoalSection : ConstDataSection);
+ return (isWeak ? ConstDataCoalSection : ConstDataSection);
else
- return (CanCoalesce ? DataCoalSection : getDataSection_());
+ return (isWeak ? DataCoalSection : getDataSection_());
case SectionKind::ROData:
- return (CanCoalesce ? ConstDataCoalSection :
+ return (isWeak ? ConstDataCoalSection :
(isNonStatic ? ConstDataSection : getReadOnlySection_()));
case SectionKind::RODataMergeStr:
- return (CanCoalesce ?
+ return (isWeak ?
ConstDataCoalSection :
MergeableStringSection(cast<GlobalVariable>(GV)));
case SectionKind::RODataMergeConst:
- return (CanCoalesce ?
+ return (isWeak ?
ConstDataCoalSection:
MergeableConstSection(cast<GlobalVariable>(GV)));
default:
}
const Section*
-ELFTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV,
- bool NoCoalesce) const {
+ELFTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const {
SectionKind::Kind Kind = SectionKindForGlobal(GV);
if (const Function *F = dyn_cast<Function>(GV)) {
}
const Section* MipsTargetAsmInfo::
-SelectSectionForGlobal(const GlobalValue *GV, bool NoCoalesce) const {
+SelectSectionForGlobal(const GlobalValue *GV) const {
SectionKind::Kind K = SectionKindForGlobal(GV);
const GlobalVariable *GVA = dyn_cast<GlobalVariable>(GV);
SectionFlagsForGlobal(const GlobalValue *GV = NULL,
const char* name = NULL) const;
- virtual const Section* SelectSectionForGlobal(const GlobalValue *GV,
- bool NoCoalesce) const;
+ virtual const Section* SelectSectionForGlobal(const GlobalValue *GV) const;
private:
const MipsSubtarget *Subtarget;
}
std::string
-TargetAsmInfo::SectionForGlobal(const GlobalValue *GV, bool NoCoalesce) const {
+TargetAsmInfo::SectionForGlobal(const GlobalValue *GV) const {
const Section* S;
// Select section name
if (GV->hasSection()) {
S = getNamedSection(GV->getSection().c_str(), Flags);
} else {
// Use default section depending on the 'type' of global
- S = SelectSectionForGlobal(GV, NoCoalesce);
+ S = SelectSectionForGlobal(GV);
}
if (!S->isNamed())
}
// Lame default implementation. Calculate the section name for global.
-const Section* TargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV,
- bool NoCoalesce) const {
+const Section*
+TargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const {
SectionKind::Kind Kind = SectionKindForGlobal(GV);
if (GV->isWeakForLinker()) {