aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/DarwinTargetAsmInfo.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-11-03 18:22:42 +0000
committerDan Gohman <gohman@apple.com>2008-11-03 18:22:42 +0000
commit8f092252d3fe75064abe330e0e6f75e213f4ac06 (patch)
tree80a1db4e72aaefe86e2c512f7bac67993fae7cfb /lib/Target/DarwinTargetAsmInfo.cpp
parent3a5797d94662d1e3cd52ade56bc16e159ec05838 (diff)
downloadexternal_llvm-8f092252d3fe75064abe330e0e6f75e213f4ac06.zip
external_llvm-8f092252d3fe75064abe330e0e6f75e213f4ac06.tar.gz
external_llvm-8f092252d3fe75064abe330e0e6f75e213f4ac06.tar.bz2
Refactor various TargetAsmInfo subclasses' TargetMachine members away
adding a TargetMachine member to the base TargetAsmInfo class instead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58624 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/DarwinTargetAsmInfo.cpp')
-rw-r--r--lib/Target/DarwinTargetAsmInfo.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/Target/DarwinTargetAsmInfo.cpp b/lib/Target/DarwinTargetAsmInfo.cpp
index 20866d7..cb73d31 100644
--- a/lib/Target/DarwinTargetAsmInfo.cpp
+++ b/lib/Target/DarwinTargetAsmInfo.cpp
@@ -24,8 +24,8 @@
using namespace llvm;
-DarwinTargetAsmInfo::DarwinTargetAsmInfo(const TargetMachine &TM) {
- DTM = &TM;
+DarwinTargetAsmInfo::DarwinTargetAsmInfo(const TargetMachine &TM)
+ : TargetAsmInfo(TM) {
CStringSection_ = getUnnamedSection("\t.cstring",
SectionFlags::Mergeable | SectionFlags::Strings);
@@ -76,7 +76,7 @@ const Section*
DarwinTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const {
SectionKind::Kind Kind = SectionKindForGlobal(GV);
bool isWeak = GV->mayBeOverridden();
- bool isNonStatic = (DTM->getRelocationModel() != Reloc::Static);
+ bool isNonStatic = TM.getRelocationModel() != Reloc::Static;
switch (Kind) {
case SectionKind::Text:
@@ -112,13 +112,12 @@ DarwinTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const {
const Section*
DarwinTargetAsmInfo::MergeableStringSection(const GlobalVariable *GV) const {
- const TargetData *TD = DTM->getTargetData();
+ const TargetData *TD = TM.getTargetData();
Constant *C = cast<GlobalVariable>(GV)->getInitializer();
const Type *Type = cast<ConstantArray>(C)->getType()->getElementType();
unsigned Size = TD->getABITypeSize(Type);
if (Size) {
- const TargetData *TD = DTM->getTargetData();
unsigned Align = TD->getPreferredAlignment(GV);
if (Align <= 32)
return getCStringSection_();
@@ -136,7 +135,7 @@ DarwinTargetAsmInfo::MergeableConstSection(const GlobalVariable *GV) const {
inline const Section*
DarwinTargetAsmInfo::MergeableConstSection(const Type *Ty) const {
- const TargetData *TD = DTM->getTargetData();
+ const TargetData *TD = TM.getTargetData();
unsigned Size = TD->getABITypeSize(Ty);
if (Size == 4)
@@ -155,7 +154,7 @@ DarwinTargetAsmInfo::SelectSectionForMachineConst(const Type *Ty) const {
// Handle weird special case, when compiling PIC stuff.
if (S == getReadOnlySection() &&
- DTM->getRelocationModel() != Reloc::Static)
+ TM.getRelocationModel() != Reloc::Static)
return ConstDataSection;
return S;