forked from OSchip/llvm-project
go through PIC16TargetObjectFile to make sections instead of
creating them directly in the pic16 asmprinter. llvm-svn: 78317
This commit is contained in:
parent
15acfb9f50
commit
b29996eb23
|
@ -68,12 +68,8 @@ bool PIC16AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
||||||
EmitAutos(CurrentFnName);
|
EmitAutos(CurrentFnName);
|
||||||
|
|
||||||
// Now emit the instructions of function in its code section.
|
// Now emit the instructions of function in its code section.
|
||||||
std::string T = PAN::getCodeSectionName(CurrentFnName);
|
|
||||||
const char *codeSection = T.c_str();
|
|
||||||
|
|
||||||
const MCSection *fCodeSection =
|
const MCSection *fCodeSection =
|
||||||
getObjFileLowering().getOrCreateSection(codeSection, false,
|
getObjFileLowering().getSectionForFunction(CurrentFnName);
|
||||||
SectionKind::getText());
|
|
||||||
// Start the Code Section.
|
// Start the Code Section.
|
||||||
O << "\n";
|
O << "\n";
|
||||||
SwitchToSection(fCodeSection);
|
SwitchToSection(fCodeSection);
|
||||||
|
@ -347,12 +343,9 @@ void PIC16AsmPrinter::EmitFunctionFrame(MachineFunction &MF) {
|
||||||
const TargetData *TD = TM.getTargetData();
|
const TargetData *TD = TM.getTargetData();
|
||||||
// Emit the data section name.
|
// Emit the data section name.
|
||||||
O << "\n";
|
O << "\n";
|
||||||
std::string T = PAN::getFrameSectionName(CurrentFnName);
|
|
||||||
const char *SectionName = T.c_str();
|
|
||||||
|
|
||||||
const MCSection *fPDataSection =
|
const MCSection *fPDataSection =
|
||||||
getObjFileLowering().getOrCreateSection(SectionName, false,
|
getObjFileLowering().getSectionForFunctionFrame(CurrentFnName);
|
||||||
SectionKind::getDataRel());
|
|
||||||
SwitchToSection(fPDataSection);
|
SwitchToSection(fPDataSection);
|
||||||
|
|
||||||
// Emit function frame label
|
// Emit function frame label
|
||||||
|
|
|
@ -37,6 +37,10 @@ namespace llvm {
|
||||||
virtual const char *getPassName() const {
|
virtual const char *getPassName() const {
|
||||||
return "PIC16 Assembly Printer";
|
return "PIC16 Assembly Printer";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PIC16TargetObjectFile &getObjFileLowering() const {
|
||||||
|
return (PIC16TargetObjectFile &)AsmPrinter::getObjFileLowering();
|
||||||
|
}
|
||||||
|
|
||||||
bool runOnMachineFunction(MachineFunction &F);
|
bool runOnMachineFunction(MachineFunction &F);
|
||||||
void printOperand(const MachineInstr *MI, int opNum);
|
void printOperand(const MachineInstr *MI, int opNum);
|
||||||
|
|
|
@ -16,8 +16,7 @@
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
PIC16TargetObjectFile::PIC16TargetObjectFile()
|
PIC16TargetObjectFile::PIC16TargetObjectFile()
|
||||||
: ExternalVarDecls(0), ExternalVarDefs(0)
|
: ExternalVarDecls(0), ExternalVarDefs(0) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PIC16TargetObjectFile::Initialize(MCContext &Ctx, const TargetMachine &tm){
|
void PIC16TargetObjectFile::Initialize(MCContext &Ctx, const TargetMachine &tm){
|
||||||
|
@ -47,6 +46,18 @@ void PIC16TargetObjectFile::Initialize(MCContext &Ctx, const TargetMachine &tm){
|
||||||
SectionKind::getMetadata()));
|
SectionKind::getMetadata()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const MCSection *PIC16TargetObjectFile::
|
||||||
|
getSectionForFunction(const std::string &FnName) const {
|
||||||
|
std::string T = PAN::getCodeSectionName(FnName);
|
||||||
|
return getOrCreateSection(T.c_str(), false, SectionKind::getText());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const MCSection *PIC16TargetObjectFile::
|
||||||
|
getSectionForFunctionFrame(const std::string &FnName) const {
|
||||||
|
std::string T = PAN::getFrameSectionName(FnName);
|
||||||
|
return getOrCreateSection(T.c_str(), false, SectionKind::getDataRel());
|
||||||
|
}
|
||||||
|
|
||||||
const MCSection *
|
const MCSection *
|
||||||
PIC16TargetObjectFile::getBSSSectionForGlobal(const GlobalVariable *GV) const {
|
PIC16TargetObjectFile::getBSSSectionForGlobal(const GlobalVariable *GV) const {
|
||||||
|
|
|
@ -64,10 +64,16 @@ namespace llvm {
|
||||||
virtual const MCSection *
|
virtual const MCSection *
|
||||||
getSpecialCasedSectionGlobals(const GlobalValue *GV, Mangler *Mang,
|
getSpecialCasedSectionGlobals(const GlobalValue *GV, Mangler *Mang,
|
||||||
SectionKind Kind) const;
|
SectionKind Kind) const;
|
||||||
|
|
||||||
virtual const MCSection *SelectSectionForGlobal(const GlobalValue *GV,
|
virtual const MCSection *SelectSectionForGlobal(const GlobalValue *GV,
|
||||||
SectionKind Kind,
|
SectionKind Kind,
|
||||||
Mangler *Mang,
|
Mangler *Mang,
|
||||||
const TargetMachine&) const;
|
const TargetMachine&) const;
|
||||||
|
|
||||||
|
const MCSection *getSectionForFunction(const std::string &FnName) const;
|
||||||
|
const MCSection *getSectionForFunctionFrame(const std::string &FnName)const;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string getSectionNameForSym(const std::string &Sym) const;
|
std::string getSectionNameForSym(const std::string &Sym) const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue