diff options
-rw-r--r-- | include/llvm/Target/DarwinTargetAsmInfo.h | 2 | ||||
-rw-r--r-- | include/llvm/Target/ELFTargetAsmInfo.h | 2 | ||||
-rw-r--r-- | include/llvm/Target/TargetAsmInfo.h | 6 | ||||
-rw-r--r-- | lib/Target/ARM/ARMTargetAsmInfo.cpp | 4 | ||||
-rw-r--r-- | lib/Target/Alpha/AlphaTargetAsmInfo.cpp | 4 | ||||
-rw-r--r-- | lib/Target/CellSPU/SPUTargetAsmInfo.cpp | 3 | ||||
-rw-r--r-- | lib/Target/DarwinTargetAsmInfo.cpp | 13 | ||||
-rw-r--r-- | lib/Target/ELFTargetAsmInfo.cpp | 9 | ||||
-rw-r--r-- | lib/Target/Mips/MipsTargetAsmInfo.cpp | 2 | ||||
-rw-r--r-- | lib/Target/PIC16/PIC16TargetAsmInfo.cpp | 5 | ||||
-rw-r--r-- | lib/Target/TargetAsmInfo.cpp | 7 | ||||
-rw-r--r-- | lib/Target/X86/X86TargetAsmInfo.cpp | 19 | ||||
-rw-r--r-- | lib/Target/X86/X86TargetAsmInfo.h | 2 |
13 files changed, 36 insertions, 42 deletions
diff --git a/include/llvm/Target/DarwinTargetAsmInfo.h b/include/llvm/Target/DarwinTargetAsmInfo.h index a99e16d..5813ce3 100644 --- a/include/llvm/Target/DarwinTargetAsmInfo.h +++ b/include/llvm/Target/DarwinTargetAsmInfo.h @@ -44,8 +44,6 @@ namespace llvm { const Section* MergeableConstSection(const Type *Ty) const; const Section* MergeableStringSection(const GlobalVariable *GV) const; const Section* SelectSectionForMachineConst(const Type *Ty) const; - protected: - const TargetMachine* DTM; }; } diff --git a/include/llvm/Target/ELFTargetAsmInfo.h b/include/llvm/Target/ELFTargetAsmInfo.h index 593d9b1..d065df3 100644 --- a/include/llvm/Target/ELFTargetAsmInfo.h +++ b/include/llvm/Target/ELFTargetAsmInfo.h @@ -33,8 +33,6 @@ namespace llvm { const Section* MergeableStringSection(const GlobalVariable *GV) const; virtual const Section* SelectSectionForMachineConst(const Type *Ty) const; - protected: - const TargetMachine* ETM; }; } diff --git a/include/llvm/Target/TargetAsmInfo.h b/include/llvm/Target/TargetAsmInfo.h index e3a8a57..44c9e55 100644 --- a/include/llvm/Target/TargetAsmInfo.h +++ b/include/llvm/Target/TargetAsmInfo.h @@ -126,6 +126,9 @@ namespace llvm { mutable SectionFlags::FlagsStringsMapType FlagsStrings; void fillDefaultValues(); protected: + /// TM - The current TargetMachine. + const TargetMachine &TM; + //===------------------------------------------------------------------===// // Properties to be set by the target writer, used to configure asm printer. // @@ -510,8 +513,7 @@ namespace llvm { const char *const *AsmTransCBE; // Defaults to empty public: - TargetAsmInfo(); - TargetAsmInfo(const TargetMachine &TM); + explicit TargetAsmInfo(const TargetMachine &TM); virtual ~TargetAsmInfo(); const Section* getNamedSection(const char *Name, diff --git a/lib/Target/ARM/ARMTargetAsmInfo.cpp b/lib/Target/ARM/ARMTargetAsmInfo.cpp index dfbe4c2..aae3712 100644 --- a/lib/Target/ARM/ARMTargetAsmInfo.cpp +++ b/lib/Target/ARM/ARMTargetAsmInfo.cpp @@ -45,7 +45,7 @@ const char *const llvm::arm_asm_table[] = { ARMDarwinTargetAsmInfo::ARMDarwinTargetAsmInfo(const ARMTargetMachine &TM): ARMTargetAsmInfo<DarwinTargetAsmInfo>(TM) { - Subtarget = &DTM->getSubtarget<ARMSubtarget>(); + Subtarget = &TM.getSubtarget<ARMSubtarget>(); GlobalPrefix = "_"; PrivateGlobalPrefix = "L"; @@ -93,7 +93,7 @@ ARMDarwinTargetAsmInfo::ARMDarwinTargetAsmInfo(const ARMTargetMachine &TM): ARMELFTargetAsmInfo::ARMELFTargetAsmInfo(const ARMTargetMachine &TM): ARMTargetAsmInfo<ELFTargetAsmInfo>(TM) { - Subtarget = &ETM->getSubtarget<ARMSubtarget>(); + Subtarget = &TM.getSubtarget<ARMSubtarget>(); NeedsSet = false; HasLEB128 = true; diff --git a/lib/Target/Alpha/AlphaTargetAsmInfo.cpp b/lib/Target/Alpha/AlphaTargetAsmInfo.cpp index 90cbac5..61fcf83 100644 --- a/lib/Target/Alpha/AlphaTargetAsmInfo.cpp +++ b/lib/Target/Alpha/AlphaTargetAsmInfo.cpp @@ -11,11 +11,13 @@ // //===----------------------------------------------------------------------===// +#include "AlphaTargetMachine.h" #include "AlphaTargetAsmInfo.h" using namespace llvm; -AlphaTargetAsmInfo::AlphaTargetAsmInfo(const AlphaTargetMachine &TM) { +AlphaTargetAsmInfo::AlphaTargetAsmInfo(const AlphaTargetMachine &TM) + : TargetAsmInfo(TM) { AlignmentIsInBytes = false; PrivateGlobalPrefix = "$"; JumpTableDirective = ".gprel32"; diff --git a/lib/Target/CellSPU/SPUTargetAsmInfo.cpp b/lib/Target/CellSPU/SPUTargetAsmInfo.cpp index f79deed..89ab0e1 100644 --- a/lib/Target/CellSPU/SPUTargetAsmInfo.cpp +++ b/lib/Target/CellSPU/SPUTargetAsmInfo.cpp @@ -16,7 +16,8 @@ #include "llvm/Function.h" using namespace llvm; -SPUTargetAsmInfo::SPUTargetAsmInfo(const SPUTargetMachine &TM) { +SPUTargetAsmInfo::SPUTargetAsmInfo(const SPUTargetMachine &TM) + : TargetAsmInfo(TM) { PCSymbol = "."; CommentString = "#"; GlobalPrefix = ""; 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; diff --git a/lib/Target/ELFTargetAsmInfo.cpp b/lib/Target/ELFTargetAsmInfo.cpp index dcf1830..47727d1 100644 --- a/lib/Target/ELFTargetAsmInfo.cpp +++ b/lib/Target/ELFTargetAsmInfo.cpp @@ -24,8 +24,8 @@ using namespace llvm; -ELFTargetAsmInfo::ELFTargetAsmInfo(const TargetMachine &TM) { - ETM = &TM; +ELFTargetAsmInfo::ELFTargetAsmInfo(const TargetMachine &TM) + : TargetAsmInfo(TM) { BSSSection_ = getUnnamedSection("\t.bss", SectionFlags::Writeable | SectionFlags::BSS); @@ -102,7 +102,7 @@ ELFTargetAsmInfo::MergeableConstSection(const GlobalVariable *GV) const { inline const Section* ELFTargetAsmInfo::MergeableConstSection(const Type *Ty) const { - const TargetData *TD = ETM->getTargetData(); + const TargetData *TD = TM.getTargetData(); // FIXME: string here is temporary, until stuff will fully land in. // We cannot use {Four,Eight,Sixteen}ByteConstantSection here, since it's @@ -121,7 +121,7 @@ ELFTargetAsmInfo::MergeableConstSection(const Type *Ty) const { const Section* ELFTargetAsmInfo::MergeableStringSection(const GlobalVariable *GV) const { - const TargetData *TD = ETM->getTargetData(); + const TargetData *TD = TM.getTargetData(); Constant *C = cast<GlobalVariable>(GV)->getInitializer(); const ConstantArray *CVA = cast<ConstantArray>(C); const Type *Ty = CVA->getType()->getElementType(); @@ -131,7 +131,6 @@ ELFTargetAsmInfo::MergeableStringSection(const GlobalVariable *GV) const { assert(getCStringSection() && "Should have string section prefix"); // We also need alignment here - const TargetData *TD = ETM->getTargetData(); unsigned Align = TD->getPrefTypeAlignment(Ty); if (Align < Size) Align = Size; diff --git a/lib/Target/Mips/MipsTargetAsmInfo.cpp b/lib/Target/Mips/MipsTargetAsmInfo.cpp index 0df6249..900a1bd 100644 --- a/lib/Target/Mips/MipsTargetAsmInfo.cpp +++ b/lib/Target/Mips/MipsTargetAsmInfo.cpp @@ -65,7 +65,7 @@ SectionKindForGlobal(const GlobalValue *GV) const { return K; if (isa<GlobalVariable>(GV)) { - const TargetData *TD = ETM->getTargetData(); + const TargetData *TD = TM.getTargetData(); unsigned Size = TD->getABITypeSize(GV->getType()->getElementType()); unsigned Threshold = Subtarget->getSSectionThreshold(); diff --git a/lib/Target/PIC16/PIC16TargetAsmInfo.cpp b/lib/Target/PIC16/PIC16TargetAsmInfo.cpp index 0a56a6e..91dcbe3 100644 --- a/lib/Target/PIC16/PIC16TargetAsmInfo.cpp +++ b/lib/Target/PIC16/PIC16TargetAsmInfo.cpp @@ -12,12 +12,13 @@ //===----------------------------------------------------------------------===// #include "PIC16TargetAsmInfo.h" +#include "PIC16TargetMachine.h" using namespace llvm; PIC16TargetAsmInfo:: -PIC16TargetAsmInfo(const PIC16TargetMachine &TM) -{ +PIC16TargetAsmInfo(const PIC16TargetMachine &TM) + : TargetAsmInfo(TM) { Data16bitsDirective = "\t.half\t"; Data32bitsDirective = "\t.word\t"; CommentString = ";"; diff --git a/lib/Target/TargetAsmInfo.cpp b/lib/Target/TargetAsmInfo.cpp index edbacb3..a124922 100644 --- a/lib/Target/TargetAsmInfo.cpp +++ b/lib/Target/TargetAsmInfo.cpp @@ -119,11 +119,8 @@ void TargetAsmInfo::fillDefaultValues() { DataSection = getUnnamedSection("\t.data", SectionFlags::Writeable); } -TargetAsmInfo::TargetAsmInfo() { - fillDefaultValues(); -} - -TargetAsmInfo::TargetAsmInfo(const TargetMachine &TM) { +TargetAsmInfo::TargetAsmInfo(const TargetMachine &tm) + : TM(tm) { fillDefaultValues(); } diff --git a/lib/Target/X86/X86TargetAsmInfo.cpp b/lib/Target/X86/X86TargetAsmInfo.cpp index 70e7717..abb0526 100644 --- a/lib/Target/X86/X86TargetAsmInfo.cpp +++ b/lib/Target/X86/X86TargetAsmInfo.cpp @@ -39,7 +39,7 @@ const char *const llvm::x86_asm_table[] = { X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const X86TargetMachine &TM): X86TargetAsmInfo<DarwinTargetAsmInfo>(TM) { - const X86Subtarget* Subtarget = &DTM->getSubtarget<X86Subtarget>(); + const X86Subtarget* Subtarget = &TM.getSubtarget<X86Subtarget>(); bool is64Bit = Subtarget->is64Bit(); AlignmentIsInBytes = false; @@ -52,7 +52,7 @@ X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const X86TargetMachine &TM): LessPrivateGlobalPrefix = "l"; // Marker for some ObjC metadata BSSSection = 0; // no BSS section. ZeroFillDirective = "\t.zerofill\t"; // Uses .zerofill - if (DTM->getRelocationModel() != Reloc::Static) + if (TM.getRelocationModel() != Reloc::Static) ConstantPoolSection = "\t.const_data"; else ConstantPoolSection = "\t.const\n"; @@ -171,17 +171,17 @@ X86ELFTargetAsmInfo::X86ELFTargetAsmInfo(const X86TargetMachine &TM): DwarfExceptionSection = "\t.section\t.gcc_except_table,\"a\",@progbits"; // On Linux we must declare when we can use a non-executable stack. - if (ETM->getSubtarget<X86Subtarget>().isLinux()) + if (TM.getSubtarget<X86Subtarget>().isLinux()) NonexecutableStackDirective = "\t.section\t.note.GNU-stack,\"\",@progbits"; } unsigned X86ELFTargetAsmInfo::PreferredEHDataFormat(DwarfEncoding::Target Reason, bool Global) const { - CodeModel::Model CM = ETM->getCodeModel(); - bool is64Bit = ETM->getSubtarget<X86Subtarget>().is64Bit(); + CodeModel::Model CM = TM.getCodeModel(); + bool is64Bit = TM.getSubtarget<X86Subtarget>().is64Bit(); - if (ETM->getRelocationModel() == Reloc::PIC_) { + if (TM.getRelocationModel() == Reloc::PIC_) { unsigned Format = 0; if (!is64Bit) @@ -216,7 +216,6 @@ X86ELFTargetAsmInfo::PreferredEHDataFormat(DwarfEncoding::Target Reason, X86COFFTargetAsmInfo::X86COFFTargetAsmInfo(const X86TargetMachine &TM): X86GenericTargetAsmInfo(TM) { - X86TM = &TM; GlobalPrefix = "_"; LCOMMDirective = "\t.lcomm\t"; @@ -251,10 +250,10 @@ X86COFFTargetAsmInfo::X86COFFTargetAsmInfo(const X86TargetMachine &TM): unsigned X86COFFTargetAsmInfo::PreferredEHDataFormat(DwarfEncoding::Target Reason, bool Global) const { - CodeModel::Model CM = X86TM->getCodeModel(); - bool is64Bit = X86TM->getSubtarget<X86Subtarget>().is64Bit(); + CodeModel::Model CM = TM.getCodeModel(); + bool is64Bit = TM.getSubtarget<X86Subtarget>().is64Bit(); - if (X86TM->getRelocationModel() == Reloc::PIC_) { + if (TM.getRelocationModel() == Reloc::PIC_) { unsigned Format = 0; if (!is64Bit) diff --git a/lib/Target/X86/X86TargetAsmInfo.h b/lib/Target/X86/X86TargetAsmInfo.h index 9100fc0..806bcd5 100644 --- a/lib/Target/X86/X86TargetAsmInfo.h +++ b/lib/Target/X86/X86TargetAsmInfo.h @@ -63,8 +63,6 @@ namespace llvm { virtual std::string UniqueSectionForGlobal(const GlobalValue* GV, SectionKind::Kind kind) const; virtual std::string printSectionFlags(unsigned flags) const; - protected: - const X86TargetMachine *X86TM; }; struct X86WinTargetAsmInfo : public X86GenericTargetAsmInfo { |