+SectionKind
+MachineConstantPoolEntry::getSectionKind(const DataLayout *DL) const {
+ SectionKind Kind;
+ switch (getRelocationInfo()) {
+ 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 Kind;
+}
+