diff options
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 17 | ||||
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 13 | ||||
-rw-r--r-- | lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp | 12 | ||||
-rw-r--r-- | lib/CodeGen/ELFWriter.cpp | 12 | ||||
-rw-r--r-- | lib/CodeGen/SelectionDAG/TargetLowering.cpp | 14 |
5 files changed, 43 insertions, 25 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 0303f26..c9b500d 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -32,6 +32,7 @@ #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetLowering.h" +#include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetOptions.h" #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/ADT/SmallPtrSet.h" @@ -72,6 +73,11 @@ AsmPrinter::~AsmPrinter() { delete &OutContext; } +const TargetLoweringObjectFile &AsmPrinter::getObjFileLowering() const { + return TM.getTargetLowering()->getObjFileLowering(); +} + + /// SwitchToTextSection - Switch to the specified text section of the executable /// if we are not already in it! /// @@ -146,7 +152,8 @@ void AsmPrinter::SwitchToSection(const Section *NS) { // some magic assembler directive. if (NS->getKind().hasExplicitSection()) { SmallString<32> FlagsStr; - TAI->getSectionFlagsAsString(NS->getKind(), FlagsStr); + + getObjFileLowering().getSectionFlagsAsString(NS->getKind(), FlagsStr); O << TAI->getSwitchToSectionDirective() << CurrentSection @@ -240,9 +247,6 @@ bool AsmPrinter::doFinalization(Module &M) { } if (TAI->getSetDirective()) { - if (!M.alias_empty()) - SwitchToSection(TAI->getTextSection()); - O << '\n'; for (Module::const_alias_iterator I = M.alias_begin(), E = M.alias_end(); I != E; ++I) { @@ -339,7 +343,7 @@ void AsmPrinter::EmitConstantPool(MachineConstantPool *MCP) { } } - const Section *S = TAI->getSectionForMergeableConstant(Kind); + const Section *S =getObjFileLowering().getSectionForMergeableConstant(Kind); // The number of sections are small, just do a linear search from the // last section to the first. @@ -410,8 +414,9 @@ void AsmPrinter::EmitJumpTableInfo(MachineJumpTableInfo *MJTI, const char* JumpTableDataSection = TAI->getJumpTableDataSection(); const Function *F = MF.getFunction(); - const Section *FuncSection = TAI->SectionForGlobal(F); + const Section *FuncSection = getObjFileLowering().SectionForGlobal(F, TM); + bool JTInDiffSection = false; if ((IsPic && !(LoweringInfo && LoweringInfo->usesGlobalOffsetTable())) || !JumpTableDataSection || diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index f26fb0d..fea00f4 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -17,9 +17,10 @@ #include "llvm/Support/Timer.h" #include "llvm/System/Path.h" #include "llvm/Target/TargetAsmInfo.h" -#include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetFrameInfo.h" +#include "llvm/Target/TargetLoweringObjectFile.h" +#include "llvm/Target/TargetRegisterInfo.h" using namespace llvm; static TimerGroup &getDwarfTimerGroup() { @@ -1328,7 +1329,7 @@ void DwarfDebug::BeginModule(Module *M, MachineModuleInfo *mmi) { MMI->setDebugInfoAvailability(true); // Prime section data. - SectionMap.insert(TAI->getTextSection()); + SectionMap.insert(Asm->getObjFileLowering().getTextSection()); // Print out .file directives to specify files for .loc directives. These are // printed out early so that they precede any .loc directives. @@ -1363,9 +1364,9 @@ void DwarfDebug::EndModule() { DebugTimer->startTimer(); // Standard sections final addresses. - Asm->SwitchToSection(TAI->getTextSection()); + Asm->SwitchToSection(Asm->getObjFileLowering().getTextSection()); EmitLabel("text_end", 0); - Asm->SwitchToSection(TAI->getDataSection()); + Asm->SwitchToSection(Asm->getObjFileLowering().getDataSection()); EmitLabel("data_end", 0); // End text sections. @@ -1893,9 +1894,9 @@ void DwarfDebug::EmitInitial() { Asm->SwitchToDataSection(TAI->getDwarfRangesSection()); EmitLabel("section_ranges", 0); - Asm->SwitchToSection(TAI->getTextSection()); + Asm->SwitchToSection(Asm->getObjFileLowering().getTextSection()); EmitLabel("text_begin", 0); - Asm->SwitchToSection(TAI->getDataSection()); + Asm->SwitchToSection(Asm->getObjFileLowering().getDataSection()); EmitLabel("data_begin", 0); } diff --git a/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp b/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp index b9a674d..a87fa9e 100644 --- a/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp @@ -20,8 +20,8 @@ #include "llvm/Support/raw_ostream.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetData.h" +#include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetMachine.h" - using namespace llvm; namespace { @@ -64,10 +64,10 @@ static void EmitCamlGlobal(const Module &M, raw_ostream &OS, AsmPrinter &AP, void OcamlGCMetadataPrinter::beginAssembly(raw_ostream &OS, AsmPrinter &AP, const TargetAsmInfo &TAI) { - AP.SwitchToSection(TAI.getTextSection()); + AP.SwitchToSection(AP.getObjFileLowering().getTextSection()); EmitCamlGlobal(getModule(), OS, AP, TAI, "code_begin"); - AP.SwitchToSection(TAI.getDataSection()); + AP.SwitchToSection(AP.getObjFileLowering().getDataSection()); EmitCamlGlobal(getModule(), OS, AP, TAI, "data_begin"); } @@ -99,16 +99,16 @@ void OcamlGCMetadataPrinter::finishAssembly(raw_ostream &OS, AsmPrinter &AP, AddressAlignLog = 3; } - AP.SwitchToSection(TAI.getTextSection()); + AP.SwitchToSection(AP.getObjFileLowering().getTextSection()); EmitCamlGlobal(getModule(), OS, AP, TAI, "code_end"); - AP.SwitchToSection(TAI.getDataSection()); + AP.SwitchToSection(AP.getObjFileLowering().getDataSection()); EmitCamlGlobal(getModule(), OS, AP, TAI, "data_end"); OS << AddressDirective << 0; // FIXME: Why does ocaml emit this?? AP.EOL(); - AP.SwitchToSection(TAI.getDataSection()); + AP.SwitchToSection(AP.getObjFileLowering().getDataSection()); EmitCamlGlobal(getModule(), OS, AP, TAI, "frametable"); for (iterator I = begin(), IE = end(); I != IE; ++I) { diff --git a/lib/CodeGen/ELFWriter.cpp b/lib/CodeGen/ELFWriter.cpp index 2679d98..fe2ba26 100644 --- a/lib/CodeGen/ELFWriter.cpp +++ b/lib/CodeGen/ELFWriter.cpp @@ -45,6 +45,8 @@ #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetELFWriterInfo.h" +#include "llvm/Target/TargetLowering.h" +#include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Support/Mangler.h" #include "llvm/Support/Streams.h" @@ -185,7 +187,10 @@ ELFSection &ELFWriter::getConstantPoolSection(MachineConstantPoolEntry &CPE) { } } - return getSection(TAI->getSectionForMergeableConstant(Kind)->getName(), + const TargetLoweringObjectFile &TLOF = + TM.getTargetLowering()->getObjFileLowering(); + + return getSection(TLOF.getSectionForMergeableConstant(Kind)->getName(), ELFSection::SHT_PROGBITS, ELFSection::SHF_MERGE | ELFSection::SHF_ALLOC, CPE.getAlignment()); @@ -312,8 +317,11 @@ void ELFWriter::EmitGlobal(const GlobalValue *GV) { assert(isa<GlobalVariable>(GV) && "GV not a global variable!"); const GlobalVariable *GVar = dyn_cast<GlobalVariable>(GV); + const TargetLoweringObjectFile &TLOF = + TM.getTargetLowering()->getObjFileLowering(); + // Get ELF section from TAI - const Section *S = TAI->SectionForGlobal(GV); + const Section *S = TLOF.SectionForGlobal(GV, TM); unsigned SectionFlags = getElfSectionFlags(S->getKind()); // The symbol align should update the section alignment if needed diff --git a/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/lib/CodeGen/SelectionDAG/TargetLowering.cpp index fcc8f1b..85b47a0 100644 --- a/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -11,12 +11,13 @@ // //===----------------------------------------------------------------------===// -#include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetLowering.h" -#include "llvm/Target/TargetSubtarget.h" +#include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetData.h" +#include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetRegisterInfo.h" +#include "llvm/Target/TargetSubtarget.h" #include "llvm/GlobalVariable.h" #include "llvm/DerivedTypes.h" #include "llvm/CodeGen/MachineFrameInfo.h" @@ -440,8 +441,9 @@ static void InitCmpLibcallCCs(ISD::CondCode *CCs) { CCs[RTLIB::O_F64] = ISD::SETEQ; } -TargetLowering::TargetLowering(TargetMachine &tm) - : TM(tm), TD(TM.getTargetData()) { +/// NOTE: The constructor takes ownership of TLOF. +TargetLowering::TargetLowering(TargetMachine &tm,TargetLoweringObjectFile *tlof) + : TM(tm), TD(TM.getTargetData()), TLOF(*tlof) { // All operations default to being supported. memset(OpActions, 0, sizeof(OpActions)); memset(LoadExtActions, 0, sizeof(LoadExtActions)); @@ -522,7 +524,9 @@ TargetLowering::TargetLowering(TargetMachine &tm) setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand); } -TargetLowering::~TargetLowering() {} +TargetLowering::~TargetLowering() { + delete &TLOF; +} /// computeRegisterProperties - Once all of the register classes are added, /// this allows us to compute derived properties we expose. |