mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-21 19:20:50 +00:00
pass the mangler down into the various SectionForGlobal methods.
No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77432 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
636bef1f35
commit
e53a600f06
@ -88,6 +88,7 @@ public:
|
|||||||
/// the specified global variable or function definition. This should not
|
/// the specified global variable or function definition. This should not
|
||||||
/// be passed external (or available externally) globals.
|
/// be passed external (or available externally) globals.
|
||||||
const Section *SectionForGlobal(const GlobalValue *GV,
|
const Section *SectionForGlobal(const GlobalValue *GV,
|
||||||
|
Mangler *Mang,
|
||||||
const TargetMachine &TM) const;
|
const TargetMachine &TM) const;
|
||||||
|
|
||||||
/// getSpecialCasedSectionGlobals - Allow the target to completely override
|
/// getSpecialCasedSectionGlobals - Allow the target to completely override
|
||||||
@ -95,7 +96,7 @@ public:
|
|||||||
/// FIXME: ELIMINATE this by making PIC16 implement ADDRESS with
|
/// FIXME: ELIMINATE this by making PIC16 implement ADDRESS with
|
||||||
/// getFlagsForNamedSection.
|
/// getFlagsForNamedSection.
|
||||||
virtual const Section *
|
virtual const Section *
|
||||||
getSpecialCasedSectionGlobals(const GlobalValue *GV,
|
getSpecialCasedSectionGlobals(const GlobalValue *GV, Mangler *Mang,
|
||||||
SectionKind Kind) const {
|
SectionKind Kind) const {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -108,9 +109,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual const Section *SelectSectionForGlobal(const GlobalValue *GV,
|
virtual const Section *
|
||||||
SectionKind Kind,
|
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||||
const TargetMachine &TM) const;
|
Mangler *Mang, const TargetMachine &TM) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -136,9 +137,9 @@ public:
|
|||||||
void getSectionFlagsAsString(SectionKind Kind,
|
void getSectionFlagsAsString(SectionKind Kind,
|
||||||
SmallVectorImpl<char> &Str) const;
|
SmallVectorImpl<char> &Str) const;
|
||||||
|
|
||||||
virtual const Section* SelectSectionForGlobal(const GlobalValue *GV,
|
virtual const Section *
|
||||||
SectionKind Kind,
|
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||||
const TargetMachine &TM) const;
|
Mangler *Mang, const TargetMachine &TM) const;
|
||||||
protected:
|
protected:
|
||||||
const Section *DataRelSection;
|
const Section *DataRelSection;
|
||||||
const Section *DataRelLocalSection;
|
const Section *DataRelLocalSection;
|
||||||
@ -161,9 +162,9 @@ class TargetLoweringObjectFileMachO : public TargetLoweringObjectFile {
|
|||||||
const Section *SixteenByteConstantSection;
|
const Section *SixteenByteConstantSection;
|
||||||
public:
|
public:
|
||||||
TargetLoweringObjectFileMachO(const TargetMachine &TM);
|
TargetLoweringObjectFileMachO(const TargetMachine &TM);
|
||||||
virtual const Section *SelectSectionForGlobal(const GlobalValue *GV,
|
virtual const Section *
|
||||||
SectionKind Kind,
|
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||||
const TargetMachine &TM) const;
|
Mangler *Mang, const TargetMachine &TM) const;
|
||||||
|
|
||||||
virtual const Section *
|
virtual const Section *
|
||||||
getSectionForMergeableConstant(SectionKind Kind) const;
|
getSectionForMergeableConstant(SectionKind Kind) const;
|
||||||
@ -179,7 +180,7 @@ public:
|
|||||||
|
|
||||||
virtual const Section *
|
virtual const Section *
|
||||||
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||||
const TargetMachine &TM) const;
|
Mangler *Mang, const TargetMachine &TM) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace llvm
|
} // end namespace llvm
|
||||||
|
@ -412,10 +412,11 @@ void AsmPrinter::EmitJumpTableInfo(MachineJumpTableInfo *MJTI,
|
|||||||
// the appropriate section.
|
// the appropriate section.
|
||||||
TargetLowering *LoweringInfo = TM.getTargetLowering();
|
TargetLowering *LoweringInfo = TM.getTargetLowering();
|
||||||
|
|
||||||
const char* JumpTableDataSection = TAI->getJumpTableDataSection();
|
const char *JumpTableDataSection = TAI->getJumpTableDataSection();
|
||||||
const Function *F = MF.getFunction();
|
const Function *F = MF.getFunction();
|
||||||
|
|
||||||
const Section *FuncSection = getObjFileLowering().SectionForGlobal(F, TM);
|
const Section *FuncSection =
|
||||||
|
getObjFileLowering().SectionForGlobal(F, Mang, TM);
|
||||||
|
|
||||||
bool JTInDiffSection = false;
|
bool JTInDiffSection = false;
|
||||||
if ((IsPic && !(LoweringInfo && LoweringInfo->usesGlobalOffsetTable())) ||
|
if ((IsPic && !(LoweringInfo && LoweringInfo->usesGlobalOffsetTable())) ||
|
||||||
|
@ -326,7 +326,7 @@ void ELFWriter::EmitGlobal(const GlobalValue *GV) {
|
|||||||
TM.getTargetLowering()->getObjFileLowering();
|
TM.getTargetLowering()->getObjFileLowering();
|
||||||
|
|
||||||
// Get the ELF section where this global belongs from TLOF
|
// Get the ELF section where this global belongs from TLOF
|
||||||
const Section *S = TLOF.SectionForGlobal(GV, TM);
|
const Section *S = TLOF.SectionForGlobal(GV, Mang, TM);
|
||||||
unsigned SectionFlags = getElfSectionFlags(S->getKind());
|
unsigned SectionFlags = getElfSectionFlags(S->getKind());
|
||||||
|
|
||||||
// The symbol align should update the section alignment if needed
|
// The symbol align should update the section alignment if needed
|
||||||
|
@ -1153,7 +1153,8 @@ void ARMAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
|
|||||||
if (Subtarget->isTargetELF())
|
if (Subtarget->isTargetELF())
|
||||||
O << "\t.type " << name << ",%object\n";
|
O << "\t.type " << name << ",%object\n";
|
||||||
|
|
||||||
const Section *TheSection = getObjFileLowering().SectionForGlobal(GVar, TM);
|
const Section *TheSection =
|
||||||
|
getObjFileLowering().SectionForGlobal(GVar, Mang, TM);
|
||||||
SwitchToSection(TheSection);
|
SwitchToSection(TheSection);
|
||||||
|
|
||||||
// FIXME: get this stuff from section kind flags.
|
// FIXME: get this stuff from section kind flags.
|
||||||
@ -1180,7 +1181,7 @@ void ARMAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
|
|||||||
O << TAI->getCOMMDirective() << name << "," << Size
|
O << TAI->getCOMMDirective() << name << "," << Size
|
||||||
<< ',' << Align;
|
<< ',' << Align;
|
||||||
} else {
|
} else {
|
||||||
SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, TM));
|
SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, Mang,TM));
|
||||||
O << "\t.globl " << name << '\n'
|
O << "\t.globl " << name << '\n'
|
||||||
<< TAI->getWeakDefDirective() << name << '\n';
|
<< TAI->getWeakDefDirective() << name << '\n';
|
||||||
EmitAlignment(Align, GVar);
|
EmitAlignment(Align, GVar);
|
||||||
|
@ -139,7 +139,7 @@ bool AlphaAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
|
|
||||||
// Print out labels for the function.
|
// Print out labels for the function.
|
||||||
const Function *F = MF.getFunction();
|
const Function *F = MF.getFunction();
|
||||||
SwitchToSection(getObjFileLowering().SectionForGlobal(F, TM));
|
SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
|
||||||
|
|
||||||
EmitAlignment(MF.getAlignment(), F);
|
EmitAlignment(MF.getAlignment(), F);
|
||||||
switch (F->getLinkage()) {
|
switch (F->getLinkage()) {
|
||||||
@ -215,7 +215,7 @@ void AlphaAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) {
|
|||||||
unsigned Align = TD->getPreferredAlignmentLog(GVar);
|
unsigned Align = TD->getPreferredAlignmentLog(GVar);
|
||||||
|
|
||||||
// 0: Switch to section
|
// 0: Switch to section
|
||||||
SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, TM));
|
SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, Mang, TM));
|
||||||
|
|
||||||
// 1: Check visibility
|
// 1: Check visibility
|
||||||
printVisibility(name, GVar->getVisibility());
|
printVisibility(name, GVar->getVisibility());
|
||||||
|
@ -428,7 +428,7 @@ LinuxAsmPrinter::runOnMachineFunction(MachineFunction &MF)
|
|||||||
// Print out labels for the function.
|
// Print out labels for the function.
|
||||||
const Function *F = MF.getFunction();
|
const Function *F = MF.getFunction();
|
||||||
|
|
||||||
SwitchToSection(getObjFileLowering().SectionForGlobal(F, TM));
|
SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
|
||||||
EmitAlignment(MF.getAlignment(), F);
|
EmitAlignment(MF.getAlignment(), F);
|
||||||
|
|
||||||
switch (F->getLinkage()) {
|
switch (F->getLinkage()) {
|
||||||
@ -526,7 +526,7 @@ void LinuxAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) {
|
|||||||
unsigned Size = TD->getTypeAllocSize(Type);
|
unsigned Size = TD->getTypeAllocSize(Type);
|
||||||
unsigned Align = TD->getPreferredAlignmentLog(GVar);
|
unsigned Align = TD->getPreferredAlignmentLog(GVar);
|
||||||
|
|
||||||
SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, TM));
|
SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, Mang, TM));
|
||||||
|
|
||||||
if (C->isNullValue() && /* FIXME: Verify correct */
|
if (C->isNullValue() && /* FIXME: Verify correct */
|
||||||
!GVar->hasSection() &&
|
!GVar->hasSection() &&
|
||||||
|
@ -78,7 +78,7 @@ namespace {
|
|||||||
void MSP430AsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
|
void MSP430AsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
|
||||||
const Function *F = MF.getFunction();
|
const Function *F = MF.getFunction();
|
||||||
|
|
||||||
SwitchToSection(getObjFileLowering().SectionForGlobal(F, TM));
|
SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
|
||||||
|
|
||||||
unsigned FnAlign = MF.getAlignment();
|
unsigned FnAlign = MF.getAlignment();
|
||||||
EmitAlignment(FnAlign, F);
|
EmitAlignment(FnAlign, F);
|
||||||
|
@ -178,9 +178,7 @@ printHex32(unsigned int Value)
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
/// Frame Directive
|
/// Frame Directive
|
||||||
void MipsAsmPrinter::
|
void MipsAsmPrinter::emitFrameDirective(MachineFunction &MF) {
|
||||||
emitFrameDirective(MachineFunction &MF)
|
|
||||||
{
|
|
||||||
const TargetRegisterInfo &RI = *TM.getRegisterInfo();
|
const TargetRegisterInfo &RI = *TM.getRegisterInfo();
|
||||||
|
|
||||||
unsigned stackReg = RI.getFrameRegister(MF);
|
unsigned stackReg = RI.getFrameRegister(MF);
|
||||||
@ -195,9 +193,7 @@ emitFrameDirective(MachineFunction &MF)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Emit Set directives.
|
/// Emit Set directives.
|
||||||
const char * MipsAsmPrinter::
|
const char *MipsAsmPrinter::emitCurrentABIString() {
|
||||||
emitCurrentABIString(void)
|
|
||||||
{
|
|
||||||
switch(Subtarget->getTargetABI()) {
|
switch(Subtarget->getTargetABI()) {
|
||||||
case MipsSubtarget::O32: return "abi32";
|
case MipsSubtarget::O32: return "abi32";
|
||||||
case MipsSubtarget::O64: return "abiO64";
|
case MipsSubtarget::O64: return "abiO64";
|
||||||
@ -215,7 +211,7 @@ emitCurrentABIString(void)
|
|||||||
void MipsAsmPrinter::emitFunctionStart(MachineFunction &MF) {
|
void MipsAsmPrinter::emitFunctionStart(MachineFunction &MF) {
|
||||||
// Print out the label for the function.
|
// Print out the label for the function.
|
||||||
const Function *F = MF.getFunction();
|
const Function *F = MF.getFunction();
|
||||||
SwitchToSection(getObjFileLowering().SectionForGlobal(F, TM));
|
SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
|
||||||
|
|
||||||
// 2 bits aligned
|
// 2 bits aligned
|
||||||
EmitAlignment(MF.getAlignment(), F);
|
EmitAlignment(MF.getAlignment(), F);
|
||||||
@ -237,9 +233,7 @@ void MipsAsmPrinter::emitFunctionStart(MachineFunction &MF) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Emit the directives used by GAS on the end of functions
|
/// Emit the directives used by GAS on the end of functions
|
||||||
void MipsAsmPrinter::
|
void MipsAsmPrinter::emitFunctionEnd(MachineFunction &MF) {
|
||||||
emitFunctionEnd(MachineFunction &MF)
|
|
||||||
{
|
|
||||||
// There are instruction for this macros, but they must
|
// There are instruction for this macros, but they must
|
||||||
// always be at the function end, and we can't emit and
|
// always be at the function end, and we can't emit and
|
||||||
// break with BB logic.
|
// break with BB logic.
|
||||||
@ -253,9 +247,7 @@ emitFunctionEnd(MachineFunction &MF)
|
|||||||
|
|
||||||
/// runOnMachineFunction - This uses the printMachineInstruction()
|
/// runOnMachineFunction - This uses the printMachineInstruction()
|
||||||
/// method to print assembly for each instruction.
|
/// method to print assembly for each instruction.
|
||||||
bool MipsAsmPrinter::
|
bool MipsAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
||||||
runOnMachineFunction(MachineFunction &MF)
|
|
||||||
{
|
|
||||||
this->MF = &MF;
|
this->MF = &MF;
|
||||||
|
|
||||||
SetupMachineFunction(MF);
|
SetupMachineFunction(MF);
|
||||||
@ -300,10 +292,8 @@ runOnMachineFunction(MachineFunction &MF)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Print out an operand for an inline asm expression.
|
// Print out an operand for an inline asm expression.
|
||||||
bool MipsAsmPrinter::
|
bool MipsAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||||
PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
unsigned AsmVariant,const char *ExtraCode){
|
||||||
unsigned AsmVariant, const char *ExtraCode)
|
|
||||||
{
|
|
||||||
// Does this asm operand have a single letter operand modifier?
|
// Does this asm operand have a single letter operand modifier?
|
||||||
if (ExtraCode && ExtraCode[0])
|
if (ExtraCode && ExtraCode[0])
|
||||||
return true; // Unknown modifier.
|
return true; // Unknown modifier.
|
||||||
@ -312,9 +302,7 @@ PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MipsAsmPrinter::
|
void MipsAsmPrinter::printOperand(const MachineInstr *MI, int opNum) {
|
||||||
printOperand(const MachineInstr *MI, int opNum)
|
|
||||||
{
|
|
||||||
const MachineOperand &MO = MI->getOperand(opNum);
|
const MachineOperand &MO = MI->getOperand(opNum);
|
||||||
const TargetRegisterInfo &RI = *TM.getRegisterInfo();
|
const TargetRegisterInfo &RI = *TM.getRegisterInfo();
|
||||||
bool closeP = false;
|
bool closeP = false;
|
||||||
@ -398,8 +386,7 @@ printOperand(const MachineInstr *MI, int opNum)
|
|||||||
if (closeP) O << ")";
|
if (closeP) O << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
void MipsAsmPrinter::
|
void MipsAsmPrinter::printUnsignedImm(const MachineInstr *MI, int opNum) {
|
||||||
printUnsignedImm(const MachineInstr *MI, int opNum) {
|
|
||||||
const MachineOperand &MO = MI->getOperand(opNum);
|
const MachineOperand &MO = MI->getOperand(opNum);
|
||||||
if (MO.getType() == MachineOperand::MO_Immediate)
|
if (MO.getType() == MachineOperand::MO_Immediate)
|
||||||
O << (unsigned short int)MO.getImm();
|
O << (unsigned short int)MO.getImm();
|
||||||
@ -484,7 +471,7 @@ void MipsAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) {
|
|||||||
|
|
||||||
printVisibility(name, GVar->getVisibility());
|
printVisibility(name, GVar->getVisibility());
|
||||||
|
|
||||||
SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, TM));
|
SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, Mang, TM));
|
||||||
|
|
||||||
if (C->isNullValue() && !GVar->hasSection()) {
|
if (C->isNullValue() && !GVar->hasSection()) {
|
||||||
if (!GVar->isThreadLocal() &&
|
if (!GVar->isThreadLocal() &&
|
||||||
|
@ -223,7 +223,7 @@ bool PIC16AsmPrinter::doInitialization(Module &M) {
|
|||||||
// Set the section names for all globals.
|
// Set the section names for all globals.
|
||||||
for (Module::global_iterator I = M.global_begin(), E = M.global_end();
|
for (Module::global_iterator I = M.global_begin(), E = M.global_end();
|
||||||
I != E; ++I)
|
I != E; ++I)
|
||||||
I->setSection(getObjFileLowering().SectionForGlobal(I, TM)->getName());
|
I->setSection(getObjFileLowering().SectionForGlobal(I, Mang,TM)->getName());
|
||||||
|
|
||||||
DbgInfo.BeginModule(M);
|
DbgInfo.BeginModule(M);
|
||||||
EmitFunctionDecls(M);
|
EmitFunctionDecls(M);
|
||||||
|
@ -165,12 +165,13 @@ PIC16TargetObjectFile::getSectionForAuto(const GlobalVariable *GV) const {
|
|||||||
const Section*
|
const Section*
|
||||||
PIC16TargetObjectFile::SelectSectionForGlobal(const GlobalValue *GV1,
|
PIC16TargetObjectFile::SelectSectionForGlobal(const GlobalValue *GV1,
|
||||||
SectionKind Kind,
|
SectionKind Kind,
|
||||||
|
Mangler *Mang,
|
||||||
const TargetMachine &TM) const {
|
const TargetMachine &TM) const {
|
||||||
// We select the section based on the initializer here, so it really
|
// We select the section based on the initializer here, so it really
|
||||||
// has to be a GlobalVariable.
|
// has to be a GlobalVariable.
|
||||||
const GlobalVariable *GV = dyn_cast<GlobalVariable>(GV1);
|
const GlobalVariable *GV = dyn_cast<GlobalVariable>(GV1);
|
||||||
if (!GV)
|
if (!GV)
|
||||||
return TargetLoweringObjectFile::SelectSectionForGlobal(GV1, Kind, TM);
|
return TargetLoweringObjectFile::SelectSectionForGlobal(GV1, Kind, Mang,TM);
|
||||||
|
|
||||||
// Record External Var Decls.
|
// Record External Var Decls.
|
||||||
if (GV->isDeclaration()) {
|
if (GV->isDeclaration()) {
|
||||||
@ -204,7 +205,7 @@ PIC16TargetObjectFile::SelectSectionForGlobal(const GlobalValue *GV1,
|
|||||||
return getROSectionForGlobal(GV);
|
return getROSectionForGlobal(GV);
|
||||||
|
|
||||||
// Else let the default implementation take care of it.
|
// Else let the default implementation take care of it.
|
||||||
return TargetLoweringObjectFile::SelectSectionForGlobal(GV, Kind, TM);
|
return TargetLoweringObjectFile::SelectSectionForGlobal(GV, Kind, Mang,TM);
|
||||||
}
|
}
|
||||||
|
|
||||||
PIC16TargetObjectFile::~PIC16TargetObjectFile() {
|
PIC16TargetObjectFile::~PIC16TargetObjectFile() {
|
||||||
@ -225,6 +226,7 @@ PIC16TargetObjectFile::~PIC16TargetObjectFile() {
|
|||||||
/// section assignment of a global.
|
/// section assignment of a global.
|
||||||
const Section *
|
const Section *
|
||||||
PIC16TargetObjectFile::getSpecialCasedSectionGlobals(const GlobalValue *GV,
|
PIC16TargetObjectFile::getSpecialCasedSectionGlobals(const GlobalValue *GV,
|
||||||
|
Mangler *Mang,
|
||||||
SectionKind Kind) const {
|
SectionKind Kind) const {
|
||||||
// If GV has a sectin name or section address create that section now.
|
// If GV has a sectin name or section address create that section now.
|
||||||
if (GV->hasSection()) {
|
if (GV->hasSection()) {
|
||||||
@ -235,11 +237,11 @@ PIC16TargetObjectFile::getSpecialCasedSectionGlobals(const GlobalValue *GV,
|
|||||||
std::string AddrStr = "Address=";
|
std::string AddrStr = "Address=";
|
||||||
if (SectName.compare(0, AddrStr.length(), AddrStr) == 0) {
|
if (SectName.compare(0, AddrStr.length(), AddrStr) == 0) {
|
||||||
std::string SectAddr = SectName.substr(AddrStr.length());
|
std::string SectAddr = SectName.substr(AddrStr.length());
|
||||||
return CreateSectionForGlobal(GVar, SectAddr);
|
return CreateSectionForGlobal(GVar, Mang, SectAddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the section specified with section attribute.
|
// Create the section specified with section attribute.
|
||||||
return CreateSectionForGlobal(GVar);
|
return CreateSectionForGlobal(GVar, Mang);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,6 +252,7 @@ PIC16TargetObjectFile::getSpecialCasedSectionGlobals(const GlobalValue *GV,
|
|||||||
// section at that address else create by name.
|
// section at that address else create by name.
|
||||||
const Section *
|
const Section *
|
||||||
PIC16TargetObjectFile::CreateSectionForGlobal(const GlobalVariable *GV,
|
PIC16TargetObjectFile::CreateSectionForGlobal(const GlobalVariable *GV,
|
||||||
|
Mangler *Mang,
|
||||||
const std::string &Addr) const {
|
const std::string &Addr) const {
|
||||||
// See if this is an uninitialized global.
|
// See if this is an uninitialized global.
|
||||||
const Constant *C = GV->getInitializer();
|
const Constant *C = GV->getInitializer();
|
||||||
@ -265,7 +268,7 @@ PIC16TargetObjectFile::CreateSectionForGlobal(const GlobalVariable *GV,
|
|||||||
return CreateROSectionForGlobal(GV, Addr);
|
return CreateROSectionForGlobal(GV, Addr);
|
||||||
|
|
||||||
// Else let the default implementation take care of it.
|
// Else let the default implementation take care of it.
|
||||||
return TargetLoweringObjectFile::SectionForGlobal(GV, TM);
|
return TargetLoweringObjectFile::SectionForGlobal(GV, Mang, TM);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create uninitialized section for a variable.
|
// Create uninitialized section for a variable.
|
||||||
|
@ -59,10 +59,11 @@ namespace llvm {
|
|||||||
/// getSpecialCasedSectionGlobals - Allow the target to completely override
|
/// getSpecialCasedSectionGlobals - Allow the target to completely override
|
||||||
/// section assignment of a global.
|
/// section assignment of a global.
|
||||||
virtual const Section *
|
virtual const Section *
|
||||||
getSpecialCasedSectionGlobals(const GlobalValue *GV,
|
getSpecialCasedSectionGlobals(const GlobalValue *GV, Mangler *Mang,
|
||||||
SectionKind Kind) const;
|
SectionKind Kind) const;
|
||||||
virtual const Section *SelectSectionForGlobal(const GlobalValue *GV,
|
virtual const Section *SelectSectionForGlobal(const GlobalValue *GV,
|
||||||
SectionKind Kind,
|
SectionKind Kind,
|
||||||
|
Mangler *Mang,
|
||||||
const TargetMachine&) const;
|
const TargetMachine&) const;
|
||||||
private:
|
private:
|
||||||
std::string getSectionNameForSym(const std::string &Sym) const;
|
std::string getSectionNameForSym(const std::string &Sym) const;
|
||||||
@ -78,6 +79,7 @@ namespace llvm {
|
|||||||
const Section *CreateROSectionForGlobal(const GlobalVariable *GV,
|
const Section *CreateROSectionForGlobal(const GlobalVariable *GV,
|
||||||
std::string Addr = "") const;
|
std::string Addr = "") const;
|
||||||
const Section *CreateSectionForGlobal(const GlobalVariable *GV,
|
const Section *CreateSectionForGlobal(const GlobalVariable *GV,
|
||||||
|
Mangler *Mang,
|
||||||
const std::string &Addr = "") const;
|
const std::string &Addr = "") const;
|
||||||
public:
|
public:
|
||||||
void SetSectionForGVs(Module &M);
|
void SetSectionForGVs(Module &M);
|
||||||
|
@ -591,7 +591,7 @@ bool PPCLinuxAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
|
|
||||||
// Print out labels for the function.
|
// Print out labels for the function.
|
||||||
const Function *F = MF.getFunction();
|
const Function *F = MF.getFunction();
|
||||||
SwitchToSection(getObjFileLowering().SectionForGlobal(F, TM));
|
SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
|
||||||
|
|
||||||
switch (F->getLinkage()) {
|
switch (F->getLinkage()) {
|
||||||
default: llvm_unreachable("Unknown linkage type!");
|
default: llvm_unreachable("Unknown linkage type!");
|
||||||
@ -640,7 +640,7 @@ bool PPCLinuxAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
// Print out jump tables referenced by the function.
|
// Print out jump tables referenced by the function.
|
||||||
EmitJumpTableInfo(MF.getJumpTableInfo(), MF);
|
EmitJumpTableInfo(MF.getJumpTableInfo(), MF);
|
||||||
|
|
||||||
SwitchToSection(getObjFileLowering().SectionForGlobal(F, TM));
|
SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
|
||||||
|
|
||||||
// Emit post-function debug information.
|
// Emit post-function debug information.
|
||||||
DW->EndFunction(&MF);
|
DW->EndFunction(&MF);
|
||||||
@ -682,7 +682,7 @@ void PPCLinuxAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) {
|
|||||||
unsigned Size = TD->getTypeAllocSize(Type);
|
unsigned Size = TD->getTypeAllocSize(Type);
|
||||||
unsigned Align = TD->getPreferredAlignmentLog(GVar);
|
unsigned Align = TD->getPreferredAlignmentLog(GVar);
|
||||||
|
|
||||||
SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, TM));
|
SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, Mang, TM));
|
||||||
|
|
||||||
if (C->isNullValue() && /* FIXME: Verify correct */
|
if (C->isNullValue() && /* FIXME: Verify correct */
|
||||||
!GVar->hasSection() &&
|
!GVar->hasSection() &&
|
||||||
@ -763,7 +763,7 @@ bool PPCDarwinAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
|
|
||||||
// Print out labels for the function.
|
// Print out labels for the function.
|
||||||
const Function *F = MF.getFunction();
|
const Function *F = MF.getFunction();
|
||||||
SwitchToSection(getObjFileLowering().SectionForGlobal(F, TM));
|
SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
|
||||||
|
|
||||||
switch (F->getLinkage()) {
|
switch (F->getLinkage()) {
|
||||||
default: llvm_unreachable("Unknown linkage type!");
|
default: llvm_unreachable("Unknown linkage type!");
|
||||||
@ -892,7 +892,8 @@ void PPCDarwinAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) {
|
|||||||
unsigned Size = TD->getTypeAllocSize(Type);
|
unsigned Size = TD->getTypeAllocSize(Type);
|
||||||
unsigned Align = TD->getPreferredAlignmentLog(GVar);
|
unsigned Align = TD->getPreferredAlignmentLog(GVar);
|
||||||
|
|
||||||
const Section *TheSection = getObjFileLowering().SectionForGlobal(GVar, TM);
|
const Section *TheSection =
|
||||||
|
getObjFileLowering().SectionForGlobal(GVar, Mang, TM);
|
||||||
SwitchToSection(TheSection);
|
SwitchToSection(TheSection);
|
||||||
|
|
||||||
if (C->isNullValue() && /* FIXME: Verify correct */
|
if (C->isNullValue() && /* FIXME: Verify correct */
|
||||||
|
@ -96,7 +96,7 @@ bool SparcAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
|
|
||||||
// Print out the label for the function.
|
// Print out the label for the function.
|
||||||
const Function *F = MF.getFunction();
|
const Function *F = MF.getFunction();
|
||||||
SwitchToSection(getObjFileLowering().SectionForGlobal(F, TM));
|
SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
|
||||||
EmitAlignment(MF.getAlignment(), F);
|
EmitAlignment(MF.getAlignment(), F);
|
||||||
O << "\t.globl\t" << CurrentFnName << '\n';
|
O << "\t.globl\t" << CurrentFnName << '\n';
|
||||||
|
|
||||||
@ -230,7 +230,7 @@ void SparcAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
|
|||||||
|
|
||||||
printVisibility(name, GVar->getVisibility());
|
printVisibility(name, GVar->getVisibility());
|
||||||
|
|
||||||
SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, TM));
|
SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, Mang, TM));
|
||||||
|
|
||||||
if (C->isNullValue() && !GVar->hasSection()) {
|
if (C->isNullValue() && !GVar->hasSection()) {
|
||||||
if (!GVar->isThreadLocal() &&
|
if (!GVar->isThreadLocal() &&
|
||||||
|
@ -83,7 +83,7 @@ void SystemZAsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
|
|||||||
unsigned FnAlign = MF.getAlignment();
|
unsigned FnAlign = MF.getAlignment();
|
||||||
const Function *F = MF.getFunction();
|
const Function *F = MF.getFunction();
|
||||||
|
|
||||||
SwitchToSection(getObjFileLowering().SectionForGlobal(F, TM));
|
SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
|
||||||
|
|
||||||
EmitAlignment(FnAlign, F);
|
EmitAlignment(FnAlign, F);
|
||||||
|
|
||||||
@ -331,7 +331,7 @@ void SystemZAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
|
|||||||
|
|
||||||
O << "\t.type\t" << name << ",@object\n";
|
O << "\t.type\t" << name << ",@object\n";
|
||||||
|
|
||||||
SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, TM));
|
SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, Mang, TM));
|
||||||
|
|
||||||
if (C->isNullValue() && !GVar->hasSection() &&
|
if (C->isNullValue() && !GVar->hasSection() &&
|
||||||
!GVar->isThreadLocal() &&
|
!GVar->isThreadLocal() &&
|
||||||
|
@ -176,7 +176,8 @@ static SectionKind::Kind SectionKindForGlobal(const GlobalValue *GV,
|
|||||||
/// the specified global variable or function definition. This should not
|
/// the specified global variable or function definition. This should not
|
||||||
/// be passed external (or available externally) globals.
|
/// be passed external (or available externally) globals.
|
||||||
const Section *TargetLoweringObjectFile::
|
const Section *TargetLoweringObjectFile::
|
||||||
SectionForGlobal(const GlobalValue *GV, const TargetMachine &TM) const {
|
SectionForGlobal(const GlobalValue *GV, Mangler *Mang,
|
||||||
|
const TargetMachine &TM) const {
|
||||||
assert(!GV->isDeclaration() && !GV->hasAvailableExternallyLinkage() &&
|
assert(!GV->isDeclaration() && !GV->hasAvailableExternallyLinkage() &&
|
||||||
"Can only be used for global definitions");
|
"Can only be used for global definitions");
|
||||||
|
|
||||||
@ -190,7 +191,7 @@ SectionForGlobal(const GlobalValue *GV, const TargetMachine &TM) const {
|
|||||||
if (GV->hasSection()) {
|
if (GV->hasSection()) {
|
||||||
// If the target has special section hacks for specifically named globals,
|
// If the target has special section hacks for specifically named globals,
|
||||||
// return them now.
|
// return them now.
|
||||||
if (const Section *TS = getSpecialCasedSectionGlobals(GV, Kind))
|
if (const Section *TS = getSpecialCasedSectionGlobals(GV, Mang, Kind))
|
||||||
return TS;
|
return TS;
|
||||||
|
|
||||||
// If the target has magic semantics for certain section names, make sure to
|
// If the target has magic semantics for certain section names, make sure to
|
||||||
@ -203,13 +204,14 @@ SectionForGlobal(const GlobalValue *GV, const TargetMachine &TM) const {
|
|||||||
|
|
||||||
|
|
||||||
// Use default section depending on the 'type' of global
|
// Use default section depending on the 'type' of global
|
||||||
return SelectSectionForGlobal(GV, Kind, TM);
|
return SelectSectionForGlobal(GV, Kind, Mang, TM);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lame default implementation. Calculate the section name for global.
|
// Lame default implementation. Calculate the section name for global.
|
||||||
const Section*
|
const Section*
|
||||||
TargetLoweringObjectFile::SelectSectionForGlobal(const GlobalValue *GV,
|
TargetLoweringObjectFile::SelectSectionForGlobal(const GlobalValue *GV,
|
||||||
SectionKind Kind,
|
SectionKind Kind,
|
||||||
|
Mangler *Mang,
|
||||||
const TargetMachine &TM) const{
|
const TargetMachine &TM) const{
|
||||||
assert(!Kind.isThreadLocal() && "Doesn't support TLS");
|
assert(!Kind.isThreadLocal() && "Doesn't support TLS");
|
||||||
|
|
||||||
@ -399,7 +401,7 @@ static const char *getSectionPrefixForUniqueGlobal(SectionKind Kind) {
|
|||||||
|
|
||||||
const Section *TargetLoweringObjectFileELF::
|
const Section *TargetLoweringObjectFileELF::
|
||||||
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||||
const TargetMachine &TM) const {
|
Mangler *Mang, const TargetMachine &TM) const {
|
||||||
|
|
||||||
// If this global is linkonce/weak and the target handles this by emitting it
|
// If this global is linkonce/weak and the target handles this by emitting it
|
||||||
// into a 'uniqued' section name, create and return the section now.
|
// into a 'uniqued' section name, create and return the section now.
|
||||||
@ -411,6 +413,7 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Kind.isText()) return TextSection;
|
if (Kind.isText()) return TextSection;
|
||||||
|
|
||||||
if (Kind.isMergeableCString()) {
|
if (Kind.isMergeableCString()) {
|
||||||
assert(CStringSection_ && "Should have string section prefix");
|
assert(CStringSection_ && "Should have string section prefix");
|
||||||
|
|
||||||
@ -510,10 +513,9 @@ TargetLoweringObjectFileMachO(const TargetMachine &TM) {
|
|||||||
false, SectionKind::DataRel);
|
false, SectionKind::DataRel);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Section *
|
const Section *TargetLoweringObjectFileMachO::
|
||||||
TargetLoweringObjectFileMachO::SelectSectionForGlobal(const GlobalValue *GV,
|
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||||
SectionKind Kind,
|
Mangler *Mang, const TargetMachine &TM) const {
|
||||||
const TargetMachine &TM) const {
|
|
||||||
assert(!Kind.isThreadLocal() && "Darwin doesn't support TLS");
|
assert(!Kind.isThreadLocal() && "Darwin doesn't support TLS");
|
||||||
|
|
||||||
if (Kind.isText())
|
if (Kind.isText())
|
||||||
@ -616,7 +618,7 @@ static const char *getCOFFSectionPrefixForUniqueGlobal(SectionKind Kind) {
|
|||||||
|
|
||||||
const Section *TargetLoweringObjectFileCOFF::
|
const Section *TargetLoweringObjectFileCOFF::
|
||||||
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||||
const TargetMachine &TM) const {
|
Mangler *Mang, const TargetMachine &TM) const {
|
||||||
assert(!Kind.isThreadLocal() && "Doesn't support TLS");
|
assert(!Kind.isThreadLocal() && "Doesn't support TLS");
|
||||||
|
|
||||||
// If this global is linkonce/weak and the target handles this by emitting it
|
// If this global is linkonce/weak and the target handles this by emitting it
|
||||||
|
@ -167,7 +167,7 @@ void X86ATTAsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
|
|||||||
if (Subtarget->isTargetCygMing())
|
if (Subtarget->isTargetCygMing())
|
||||||
DecorateCygMingName(CurrentFnName, F);
|
DecorateCygMingName(CurrentFnName, F);
|
||||||
|
|
||||||
SwitchToSection(getObjFileLowering().SectionForGlobal(F, TM));
|
SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
|
||||||
switch (F->getLinkage()) {
|
switch (F->getLinkage()) {
|
||||||
default: llvm_unreachable("Unknown linkage type!");
|
default: llvm_unreachable("Unknown linkage type!");
|
||||||
case Function::InternalLinkage: // Symbols default to internal.
|
case Function::InternalLinkage: // Symbols default to internal.
|
||||||
@ -783,7 +783,8 @@ void X86ATTAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
|
|||||||
if (Subtarget->isTargetELF())
|
if (Subtarget->isTargetELF())
|
||||||
O << "\t.type\t" << name << ",@object\n";
|
O << "\t.type\t" << name << ",@object\n";
|
||||||
|
|
||||||
const Section *TheSection = getObjFileLowering().SectionForGlobal(GVar, TM);
|
const Section *TheSection =
|
||||||
|
getObjFileLowering().SectionForGlobal(GVar, Mang, TM);
|
||||||
SwitchToSection(TheSection);
|
SwitchToSection(TheSection);
|
||||||
|
|
||||||
if (C->isNullValue() && !GVar->hasSection() &&
|
if (C->isNullValue() && !GVar->hasSection() &&
|
||||||
|
@ -134,7 +134,7 @@ void XCoreAsmPrinter::PrintGlobalVariable(const GlobalVariable *GV) {
|
|||||||
|
|
||||||
const TargetData *TD = TM.getTargetData();
|
const TargetData *TD = TM.getTargetData();
|
||||||
|
|
||||||
SwitchToSection(getObjFileLowering().SectionForGlobal(GV, TM));
|
SwitchToSection(getObjFileLowering().SectionForGlobal(GV, Mang, TM));
|
||||||
|
|
||||||
std::string name = Mang->getMangledName(GV);
|
std::string name = Mang->getMangledName(GV);
|
||||||
Constant *C = GV->getInitializer();
|
Constant *C = GV->getInitializer();
|
||||||
@ -205,7 +205,7 @@ void XCoreAsmPrinter::emitFunctionStart(MachineFunction &MF) {
|
|||||||
// Print out the label for the function.
|
// Print out the label for the function.
|
||||||
const Function *F = MF.getFunction();
|
const Function *F = MF.getFunction();
|
||||||
|
|
||||||
SwitchToSection(getObjFileLowering().SectionForGlobal(F, TM));
|
SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
|
||||||
|
|
||||||
// Mark the start of the function
|
// Mark the start of the function
|
||||||
O << "\t.cc_top " << CurrentFnName << ".function," << CurrentFnName << "\n";
|
O << "\t.cc_top " << CurrentFnName << ".function," << CurrentFnName << "\n";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user