Move most user of TargetMachine::getDataLayout to the Module one
[oota-llvm.git] / lib / Target / XCore / XCoreTargetObjectFile.cpp
index 76d4363520494428205f709d1c16ebf9537ef41e..eb3072195dc0e5b37696b9abd1ff0a21e2f3c440 100644 (file)
@@ -123,8 +123,9 @@ XCoreTargetObjectFile::SelectSectionForGlobal(const GlobalValue *GV,
     if (Kind.isMergeableConst16())      return MergeableConst16Section;
   }
   Type *ObjType = GV->getType()->getPointerElementType();
+  auto &DL = GV->getParent()->getDataLayout();
   if (TM.getCodeModel() == CodeModel::Small || !ObjType->isSized() ||
-      TM.getDataLayout()->getTypeAllocSize(ObjType) < CodeModelLargeSize) {
+      DL.getTypeAllocSize(ObjType) < CodeModelLargeSize) {
     if (Kind.isReadOnly())              return UseCPRel? ReadOnlySection
                                                        : DataRelROSection;
     if (Kind.isBSS() || Kind.isCommon())return BSSSection;