summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp10
-rw-r--r--llvm/lib/CodeGen/MachineFunction.cpp42
-rw-r--r--llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp5
3 files changed, 17 insertions, 40 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 5ec451e512b..f1e4cb813df 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -357,10 +357,10 @@ void AsmPrinter::EmitEmulatedTLSControlVariable(const GlobalVariable *GV,
bool AllZeroInitValue) {
// If there is init value, use .data.rel.local section;
// otherwise use the .data section.
- MCSection *TLSVarSection = const_cast<MCSection*>(
- (GV->hasInitializer() && !AllZeroInitValue)
- ? getObjFileLowering().getDataRelLocalSection()
- : getObjFileLowering().getDataSection());
+ MCSection *TLSVarSection =
+ const_cast<MCSection *>((GV->hasInitializer() && !AllZeroInitValue)
+ ? getObjFileLowering().getDataRelSection()
+ : getObjFileLowering().getDataSection());
OutStreamer->SwitchSection(TLSVarSection);
MCSymbol *GVSym = getSymbol(GV);
EmitLinkage(GV, EmittedSym); // same linkage as GV
@@ -390,8 +390,6 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
bool IsEmuTLSVar =
GV->getThreadLocalMode() != llvm::GlobalVariable::NotThreadLocal &&
TM.Options.EmulatedTLS;
- assert((!IsEmuTLSVar || getObjFileLowering().getDataRelLocalSection()) &&
- "Need relocatable local section for emulated TLS variables");
assert(!(IsEmuTLSVar && GV->hasCommonLinkage()) &&
"No emulated TLS variables in the common section");
diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp
index 5e614c6cb2e..fa6849fcfdc 100644
--- a/llvm/lib/CodeGen/MachineFunction.cpp
+++ b/llvm/lib/CodeGen/MachineFunction.cpp
@@ -816,42 +816,26 @@ Type *MachineConstantPoolEntry::getType() const {
return Val.ConstVal->getType();
}
-
-unsigned MachineConstantPoolEntry::getRelocationInfo() const {
+bool MachineConstantPoolEntry::needsRelocation() const {
if (isMachineConstantPoolEntry())
- return Val.MachineCPVal->getRelocationInfo();
- return Val.ConstVal->getRelocationInfo();
+ return true;
+ return Val.ConstVal->needsRelocation();
}
SectionKind
MachineConstantPoolEntry::getSectionKind(const DataLayout *DL) const {
- SectionKind Kind;
- switch (getRelocationInfo()) {
+ if (needsRelocation())
+ return SectionKind::getReadOnlyWithRel();
+ switch (DL->getTypeAllocSize(getType())) {
+ case 4:
+ return SectionKind::getMergeableConst4();
+ case 8:
+ return SectionKind::getMergeableConst8();
+ case 16:
+ return SectionKind::getMergeableConst16();
default:
- llvm_unreachable("Unknown section kind");
- case Constant::GlobalRelocations:
- Kind = SectionKind::getReadOnlyWithRel();
- break;
- case Constant::LocalRelocation:
- Kind = SectionKind::getReadOnlyWithRelLocal();
- break;
- case Constant::NoRelocation:
- switch (DL->getTypeAllocSize(getType())) {
- case 4:
- Kind = SectionKind::getMergeableConst4();
- break;
- case 8:
- Kind = SectionKind::getMergeableConst8();
- break;
- case 16:
- Kind = SectionKind::getMergeableConst16();
- break;
- default:
- Kind = SectionKind::getReadOnly();
- break;
- }
+ return SectionKind::getReadOnly();
}
- return Kind;
}
MachineConstantPool::~MachineConstantPool() {
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index 372ac403769..7043f7911a3 100644
--- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -235,12 +235,8 @@ static StringRef getSectionPrefixForGlobal(SectionKind Kind) {
return ".tbss";
if (Kind.isDataNoRel())
return ".data";
- if (Kind.isDataRelLocal())
- return ".data.rel.local";
if (Kind.isDataRel())
return ".data.rel";
- if (Kind.isReadOnlyWithRelLocal())
- return ".data.rel.ro.local";
assert(Kind.isReadOnlyWithRel() && "Unknown section kind");
return ".data.rel.ro";
}
@@ -362,7 +358,6 @@ MCSection *TargetLoweringObjectFileELF::getSectionForConstant(
if (Kind.isReadOnly())
return ReadOnlySection;
- if (Kind.isReadOnlyWithRelLocal()) return DataRelROLocalSection;
assert(Kind.isReadOnlyWithRel() && "Unknown section kind");
return DataRelROSection;
}
OpenPOWER on IntegriCloud