aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2008-08-07 09:50:34 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2008-08-07 09:50:34 +0000
commit93cacf131d64dccdfb04b215ca8a8909447f80cd (patch)
tree1898c81a34fb88b3d660225ec018f875b3ad9a34 /lib/Target
parentd829e6fdee7a26f97433d7946e22acd774a3e8fd (diff)
downloadexternal_llvm-93cacf131d64dccdfb04b215ca8a8909447f80cd.zip
external_llvm-93cacf131d64dccdfb04b215ca8a8909447f80cd.tar.gz
external_llvm-93cacf131d64dccdfb04b215ca8a8909447f80cd.tar.bz2
Select section for constant pool entries
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54448 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r--lib/Target/ELFTargetAsmInfo.cpp19
-rw-r--r--lib/Target/TargetAsmInfo.cpp7
2 files changed, 23 insertions, 3 deletions
diff --git a/lib/Target/ELFTargetAsmInfo.cpp b/lib/Target/ELFTargetAsmInfo.cpp
index 6ce01a8..3b89c3f 100644
--- a/lib/Target/ELFTargetAsmInfo.cpp
+++ b/lib/Target/ELFTargetAsmInfo.cpp
@@ -17,6 +17,7 @@
#include "llvm/Function.h"
#include "llvm/GlobalVariable.h"
#include "llvm/ADT/StringExtras.h"
+#include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/Target/ELFTargetAsmInfo.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetData.h"
@@ -90,15 +91,27 @@ ELFTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const {
}
const Section*
+ELFTargetAsmInfo::SelectSectionForMachineConst(const Type *Ty) const {
+ // FIXME: Support data.rel stuff someday
+ return MergeableConstSection(Ty);
+}
+
+const Section*
ELFTargetAsmInfo::MergeableConstSection(const GlobalVariable *GV) const {
- const TargetData *TD = ETM->getTargetData();
Constant *C = cast<GlobalVariable>(GV)->getInitializer();
- const Type *Type = C->getType();
+ const Type *Ty = C->getType();
+
+ return MergeableConstSection(Ty);
+}
+
+inline const Section*
+ELFTargetAsmInfo::MergeableConstSection(const Type *Ty) const {
+ const TargetData *TD = ETM->getTargetData();
// FIXME: string here is temporary, until stuff will fully land in.
// We cannot use {Four,Eight,Sixteen}ByteConstantSection here, since it's
// currently directly used by asmprinter.
- unsigned Size = TD->getABITypeSize(Type);
+ unsigned Size = TD->getABITypeSize(Ty);
if (Size == 4 || Size == 8 || Size == 16) {
std::string Name = ".rodata.cst" + utostr(Size);
diff --git a/lib/Target/TargetAsmInfo.cpp b/lib/Target/TargetAsmInfo.cpp
index ad80413..eb74836 100644
--- a/lib/Target/TargetAsmInfo.cpp
+++ b/lib/Target/TargetAsmInfo.cpp
@@ -321,6 +321,13 @@ TargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const {
return getDataSection_();
}
+// Lame default implementation. Calculate the section name for machine const.
+const Section*
+TargetAsmInfo::SelectSectionForMachineConst(const Type *Ty) const {
+ // FIXME: Support data.rel stuff someday
+ return getDataSection_();
+}
+
std::string
TargetAsmInfo::UniqueSectionForGlobal(const GlobalValue* GV,
SectionKind::Kind Kind) const {