aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/AsmPrinter/AsmPrinter.cpp9
-rw-r--r--lib/CodeGen/ELFWriter.cpp4
2 files changed, 10 insertions, 3 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 7b7a9a5a97..e31a39c7a3 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -302,13 +302,18 @@ void AsmPrinter::EmitConstantPool(MachineConstantPool *MCP) {
const std::vector<MachineConstantPoolEntry> &CP = MCP->getConstants();
if (CP.empty()) return;
+ const TargetData &TD = *TM.getTargetData();
+
// Calculate sections for constant pool entries. We collect entries to go into
// the same section together to reduce amount of section switch statements.
SmallVector<SectionCPs, 4> CPSections;
for (unsigned i = 0, e = CP.size(); i != e; ++i) {
- MachineConstantPoolEntry CPE = CP[i];
+ const MachineConstantPoolEntry &CPE = CP[i];
unsigned Align = CPE.getAlignment();
- const Section* S = TAI->SelectSectionForMachineConst(CPE.getType());
+ uint64_t Size = TD.getTypeAllocSize(CPE.getType());
+ const Section *S =
+ TAI->getSectionForMergableConstant(Size, CPE.getRelocationInfo());
+
// The number of sections are small, just do a linear search from the
// last section to the first.
bool Found = false;
diff --git a/lib/CodeGen/ELFWriter.cpp b/lib/CodeGen/ELFWriter.cpp
index f4cd94a988..8cbaf6f13b 100644
--- a/lib/CodeGen/ELFWriter.cpp
+++ b/lib/CodeGen/ELFWriter.cpp
@@ -155,8 +155,10 @@ ELFSection &ELFWriter::getJumpTableSection() {
// Get a constant pool section based on the section name returned by TAI
ELFSection &ELFWriter::getConstantPoolSection(MachineConstantPoolEntry &CPE) {
+ uint64_t Size = TM.getTargetData()->getTypeAllocSize(CPE.getType());
+
std::string CstPoolName =
- TAI->SelectSectionForMachineConst(CPE.getType())->getName();
+ TAI->getSectionForMergableConstant(Size,CPE.getRelocationInfo())->getName();
return getSection(CstPoolName,
ELFSection::SHT_PROGBITS,
ELFSection::SHF_MERGE | ELFSection::SHF_ALLOC,