diff options
author | Chris Lattner <sabre@nondot.org> | 2009-07-22 00:28:43 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-07-22 00:28:43 +0000 |
commit | 680c6f69828e44b73f2dbea9922c35c8cd481f52 (patch) | |
tree | 603a6eb1a17ad2fa32f99daa34a77c5e7e42de9f /lib/CodeGen/AsmPrinter | |
parent | 5454456ad84ec6080b09188456f27493d9ca4b87 (diff) | |
download | external_llvm-680c6f69828e44b73f2dbea9922c35c8cd481f52.zip external_llvm-680c6f69828e44b73f2dbea9922c35c8cd481f52.tar.gz external_llvm-680c6f69828e44b73f2dbea9922c35c8cd481f52.tar.bz2 |
remove the SelectSectionForMachineConst hook, replacing it with
a new getSectionForMergableConstant hook. This removes one dependence
of TAI on Type, and provides the hook with enough info to make the
right decision based on whether the global has relocations etc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76705 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter')
-rw-r--r-- | lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 7b7a9a5..e31a39c 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; |