mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 02:52:53 +02:00
PPC: Don't store function in PPCFunctionInfo
Continue migrating targets from depending on the MachineFunction during the initial construction.
This commit is contained in:
parent
1d8040150a
commit
8215de3621
@ -631,7 +631,7 @@ void PPCAsmPrinter::emitInstruction(const MachineInstr *MI) {
|
|||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
MCSymbol *PICOffset =
|
MCSymbol *PICOffset =
|
||||||
MF->getInfo<PPCFunctionInfo>()->getPICOffsetSymbol();
|
MF->getInfo<PPCFunctionInfo>()->getPICOffsetSymbol(*MF);
|
||||||
TmpInst.setOpcode(PPC::LWZ);
|
TmpInst.setOpcode(PPC::LWZ);
|
||||||
const MCExpr *Exp =
|
const MCExpr *Exp =
|
||||||
MCSymbolRefExpr::create(PICOffset, MCSymbolRefExpr::VK_None, OutContext);
|
MCSymbolRefExpr::create(PICOffset, MCSymbolRefExpr::VK_None, OutContext);
|
||||||
@ -1341,7 +1341,7 @@ void PPCLinuxAsmPrinter::emitFunctionEntryLabel() {
|
|||||||
if (!Subtarget->isPPC64()) {
|
if (!Subtarget->isPPC64()) {
|
||||||
const PPCFunctionInfo *PPCFI = MF->getInfo<PPCFunctionInfo>();
|
const PPCFunctionInfo *PPCFI = MF->getInfo<PPCFunctionInfo>();
|
||||||
if (PPCFI->usesPICBase() && !Subtarget->isSecurePlt()) {
|
if (PPCFI->usesPICBase() && !Subtarget->isSecurePlt()) {
|
||||||
MCSymbol *RelocSymbol = PPCFI->getPICOffsetSymbol();
|
MCSymbol *RelocSymbol = PPCFI->getPICOffsetSymbol(*MF);
|
||||||
MCSymbol *PICBase = MF->getPICBaseSymbol();
|
MCSymbol *PICBase = MF->getPICBaseSymbol();
|
||||||
OutStreamer->emitLabel(RelocSymbol);
|
OutStreamer->emitLabel(RelocSymbol);
|
||||||
|
|
||||||
@ -1369,14 +1369,14 @@ void PPCLinuxAsmPrinter::emitFunctionEntryLabel() {
|
|||||||
const PPCFunctionInfo *PPCFI = MF->getInfo<PPCFunctionInfo>();
|
const PPCFunctionInfo *PPCFI = MF->getInfo<PPCFunctionInfo>();
|
||||||
|
|
||||||
MCSymbol *TOCSymbol = OutContext.getOrCreateSymbol(StringRef(".TOC."));
|
MCSymbol *TOCSymbol = OutContext.getOrCreateSymbol(StringRef(".TOC."));
|
||||||
MCSymbol *GlobalEPSymbol = PPCFI->getGlobalEPSymbol();
|
MCSymbol *GlobalEPSymbol = PPCFI->getGlobalEPSymbol(*MF);
|
||||||
const MCExpr *TOCDeltaExpr =
|
const MCExpr *TOCDeltaExpr =
|
||||||
MCBinaryExpr::createSub(MCSymbolRefExpr::create(TOCSymbol, OutContext),
|
MCBinaryExpr::createSub(MCSymbolRefExpr::create(TOCSymbol, OutContext),
|
||||||
MCSymbolRefExpr::create(GlobalEPSymbol,
|
MCSymbolRefExpr::create(GlobalEPSymbol,
|
||||||
OutContext),
|
OutContext),
|
||||||
OutContext);
|
OutContext);
|
||||||
|
|
||||||
OutStreamer->emitLabel(PPCFI->getTOCOffsetSymbol());
|
OutStreamer->emitLabel(PPCFI->getTOCOffsetSymbol(*MF));
|
||||||
OutStreamer->emitValue(TOCDeltaExpr, 8);
|
OutStreamer->emitValue(TOCDeltaExpr, 8);
|
||||||
}
|
}
|
||||||
return AsmPrinter::emitFunctionEntryLabel();
|
return AsmPrinter::emitFunctionEntryLabel();
|
||||||
@ -1483,7 +1483,7 @@ void PPCLinuxAsmPrinter::emitFunctionBodyStart() {
|
|||||||
// Note: The logic here must be synchronized with the code in the
|
// Note: The logic here must be synchronized with the code in the
|
||||||
// branch-selection pass which sets the offset of the first block in the
|
// branch-selection pass which sets the offset of the first block in the
|
||||||
// function. This matters because it affects the alignment.
|
// function. This matters because it affects the alignment.
|
||||||
MCSymbol *GlobalEntryLabel = PPCFI->getGlobalEPSymbol();
|
MCSymbol *GlobalEntryLabel = PPCFI->getGlobalEPSymbol(*MF);
|
||||||
OutStreamer->emitLabel(GlobalEntryLabel);
|
OutStreamer->emitLabel(GlobalEntryLabel);
|
||||||
const MCSymbolRefExpr *GlobalEntryLabelExp =
|
const MCSymbolRefExpr *GlobalEntryLabelExp =
|
||||||
MCSymbolRefExpr::create(GlobalEntryLabel, OutContext);
|
MCSymbolRefExpr::create(GlobalEntryLabel, OutContext);
|
||||||
@ -1506,7 +1506,7 @@ void PPCLinuxAsmPrinter::emitFunctionBodyStart() {
|
|||||||
.addReg(PPC::X2)
|
.addReg(PPC::X2)
|
||||||
.addExpr(TOCDeltaLo));
|
.addExpr(TOCDeltaLo));
|
||||||
} else {
|
} else {
|
||||||
MCSymbol *TOCOffset = PPCFI->getTOCOffsetSymbol();
|
MCSymbol *TOCOffset = PPCFI->getTOCOffsetSymbol(*MF);
|
||||||
const MCExpr *TOCOffsetDeltaExpr =
|
const MCExpr *TOCOffsetDeltaExpr =
|
||||||
MCBinaryExpr::createSub(MCSymbolRefExpr::create(TOCOffset, OutContext),
|
MCBinaryExpr::createSub(MCSymbolRefExpr::create(TOCOffset, OutContext),
|
||||||
GlobalEntryLabelExp, OutContext);
|
GlobalEntryLabelExp, OutContext);
|
||||||
@ -1521,7 +1521,7 @@ void PPCLinuxAsmPrinter::emitFunctionBodyStart() {
|
|||||||
.addReg(PPC::X12));
|
.addReg(PPC::X12));
|
||||||
}
|
}
|
||||||
|
|
||||||
MCSymbol *LocalEntryLabel = PPCFI->getLocalEPSymbol();
|
MCSymbol *LocalEntryLabel = PPCFI->getLocalEPSymbol(*MF);
|
||||||
OutStreamer->emitLabel(LocalEntryLabel);
|
OutStreamer->emitLabel(LocalEntryLabel);
|
||||||
const MCSymbolRefExpr *LocalEntryLabelExp =
|
const MCSymbolRefExpr *LocalEntryLabelExp =
|
||||||
MCSymbolRefExpr::create(LocalEntryLabel, OutContext);
|
MCSymbolRefExpr::create(LocalEntryLabel, OutContext);
|
||||||
|
@ -19,31 +19,31 @@ static cl::opt<bool> PPCDisableNonVolatileCR(
|
|||||||
cl::init(false), cl::Hidden);
|
cl::init(false), cl::Hidden);
|
||||||
|
|
||||||
void PPCFunctionInfo::anchor() {}
|
void PPCFunctionInfo::anchor() {}
|
||||||
PPCFunctionInfo::PPCFunctionInfo(MachineFunction &MF)
|
PPCFunctionInfo::PPCFunctionInfo(const MachineFunction &MF)
|
||||||
: DisableNonVolatileCR(PPCDisableNonVolatileCR), MF(MF) {}
|
: DisableNonVolatileCR(PPCDisableNonVolatileCR) {}
|
||||||
|
|
||||||
MCSymbol *PPCFunctionInfo::getPICOffsetSymbol() const {
|
MCSymbol *PPCFunctionInfo::getPICOffsetSymbol(MachineFunction &MF) const {
|
||||||
const DataLayout &DL = MF.getDataLayout();
|
const DataLayout &DL = MF.getDataLayout();
|
||||||
return MF.getContext().getOrCreateSymbol(Twine(DL.getPrivateGlobalPrefix()) +
|
return MF.getContext().getOrCreateSymbol(Twine(DL.getPrivateGlobalPrefix()) +
|
||||||
Twine(MF.getFunctionNumber()) +
|
Twine(MF.getFunctionNumber()) +
|
||||||
"$poff");
|
"$poff");
|
||||||
}
|
}
|
||||||
|
|
||||||
MCSymbol *PPCFunctionInfo::getGlobalEPSymbol() const {
|
MCSymbol *PPCFunctionInfo::getGlobalEPSymbol(MachineFunction &MF) const {
|
||||||
const DataLayout &DL = MF.getDataLayout();
|
const DataLayout &DL = MF.getDataLayout();
|
||||||
return MF.getContext().getOrCreateSymbol(Twine(DL.getPrivateGlobalPrefix()) +
|
return MF.getContext().getOrCreateSymbol(Twine(DL.getPrivateGlobalPrefix()) +
|
||||||
"func_gep" +
|
"func_gep" +
|
||||||
Twine(MF.getFunctionNumber()));
|
Twine(MF.getFunctionNumber()));
|
||||||
}
|
}
|
||||||
|
|
||||||
MCSymbol *PPCFunctionInfo::getLocalEPSymbol() const {
|
MCSymbol *PPCFunctionInfo::getLocalEPSymbol(MachineFunction &MF) const {
|
||||||
const DataLayout &DL = MF.getDataLayout();
|
const DataLayout &DL = MF.getDataLayout();
|
||||||
return MF.getContext().getOrCreateSymbol(Twine(DL.getPrivateGlobalPrefix()) +
|
return MF.getContext().getOrCreateSymbol(Twine(DL.getPrivateGlobalPrefix()) +
|
||||||
"func_lep" +
|
"func_lep" +
|
||||||
Twine(MF.getFunctionNumber()));
|
Twine(MF.getFunctionNumber()));
|
||||||
}
|
}
|
||||||
|
|
||||||
MCSymbol *PPCFunctionInfo::getTOCOffsetSymbol() const {
|
MCSymbol *PPCFunctionInfo::getTOCOffsetSymbol(MachineFunction &MF) const {
|
||||||
const DataLayout &DL = MF.getDataLayout();
|
const DataLayout &DL = MF.getDataLayout();
|
||||||
return MF.getContext().getOrCreateSymbol(Twine(DL.getPrivateGlobalPrefix()) +
|
return MF.getContext().getOrCreateSymbol(Twine(DL.getPrivateGlobalPrefix()) +
|
||||||
"func_toc" +
|
"func_toc" +
|
||||||
|
@ -118,9 +118,6 @@ class PPCFunctionInfo : public MachineFunctionInfo {
|
|||||||
/// 64-bit SVR4 ABI.
|
/// 64-bit SVR4 ABI.
|
||||||
SmallVector<Register, 3> MustSaveCRs;
|
SmallVector<Register, 3> MustSaveCRs;
|
||||||
|
|
||||||
/// Hold onto our MachineFunction context.
|
|
||||||
MachineFunction &MF;
|
|
||||||
|
|
||||||
/// Whether this uses the PIC Base register or not.
|
/// Whether this uses the PIC Base register or not.
|
||||||
bool UsesPICBase = false;
|
bool UsesPICBase = false;
|
||||||
|
|
||||||
@ -129,7 +126,7 @@ class PPCFunctionInfo : public MachineFunctionInfo {
|
|||||||
std::vector<std::pair<Register, ISD::ArgFlagsTy>> LiveInAttrs;
|
std::vector<std::pair<Register, ISD::ArgFlagsTy>> LiveInAttrs;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit PPCFunctionInfo(MachineFunction &MF);
|
explicit PPCFunctionInfo(const MachineFunction &MF);
|
||||||
|
|
||||||
int getFramePointerSaveIndex() const { return FramePointerSaveIndex; }
|
int getFramePointerSaveIndex() const { return FramePointerSaveIndex; }
|
||||||
void setFramePointerSaveIndex(int Idx) { FramePointerSaveIndex = Idx; }
|
void setFramePointerSaveIndex(int Idx) { FramePointerSaveIndex = Idx; }
|
||||||
@ -225,11 +222,11 @@ public:
|
|||||||
void setUsesPICBase(bool uses) { UsesPICBase = uses; }
|
void setUsesPICBase(bool uses) { UsesPICBase = uses; }
|
||||||
bool usesPICBase() const { return UsesPICBase; }
|
bool usesPICBase() const { return UsesPICBase; }
|
||||||
|
|
||||||
MCSymbol *getPICOffsetSymbol() const;
|
MCSymbol *getPICOffsetSymbol(MachineFunction &MF) const;
|
||||||
|
|
||||||
MCSymbol *getGlobalEPSymbol() const;
|
MCSymbol *getGlobalEPSymbol(MachineFunction &MF) const;
|
||||||
MCSymbol *getLocalEPSymbol() const;
|
MCSymbol *getLocalEPSymbol(MachineFunction &MF) const;
|
||||||
MCSymbol *getTOCOffsetSymbol() const;
|
MCSymbol *getTOCOffsetSymbol(MachineFunction &MF) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace llvm
|
} // end namespace llvm
|
||||||
|
Loading…
Reference in New Issue
Block a user