1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00

Revert "[Hexagon] Replace EmitFunctionEntryCode with a DAG preprocessing code"

This reverts r323374. The fix needs a different approach.

llvm-svn: 323438
This commit is contained in:
Krzysztof Parzyszek 2018-01-25 16:36:53 +00:00
parent cb0b058905
commit 5de8dcdfe0
2 changed files with 16 additions and 22 deletions

View File

@ -1034,23 +1034,6 @@ void HexagonDAGToDAGISel::ppHoistZextI1(std::vector<SDNode*> &&Nodes) {
}
}
void HexagonDAGToDAGISel::ppEmitAligna() {
auto &HST = static_cast<const HexagonSubtarget&>(MF->getSubtarget());
auto &HFI = *HST.getFrameLowering();
if (!HFI.needsAligna(*MF))
return;
MachineFrameInfo &MFI = MF->getFrameInfo();
MachineBasicBlock &EntryBB = MF->front();
unsigned AR = FuncInfo->CreateReg(MVT::i32);
unsigned MaxA = MFI.getMaxAlignment();
MachineBasicBlock::iterator End = EntryBB.end();
DebugLoc DL = EntryBB.findDebugLoc(End);
BuildMI(EntryBB, End, DL, HII->get(Hexagon::PS_aligna), AR)
.addImm(MaxA);
MF->getInfo<HexagonMachineFunctionInfo>()->setStackAlignBaseVReg(AR);
}
void HexagonDAGToDAGISel::PreprocessISelDAG() {
// Repack all nodes before calling each preprocessing function,
// because each of them can modify the set of nodes.
@ -1106,11 +1089,21 @@ void HexagonDAGToDAGISel::PreprocessISelDAG() {
CurDAG->dump();
});
}
}
// Finally, emit the PS_aligna instruction, if necessary. Do it late,
// because the max required stack layout may change up until right before
// instruction selection.
ppEmitAligna();
void HexagonDAGToDAGISel::EmitFunctionEntryCode() {
auto &HST = static_cast<const HexagonSubtarget&>(MF->getSubtarget());
auto &HFI = *HST.getFrameLowering();
if (!HFI.needsAligna(*MF))
return;
MachineFrameInfo &MFI = MF->getFrameInfo();
MachineBasicBlock *EntryBB = &MF->front();
unsigned AR = FuncInfo->CreateReg(MVT::i32);
unsigned MaxA = MFI.getMaxAlignment();
BuildMI(EntryBB, DebugLoc(), HII->get(Hexagon::PS_aligna), AR)
.addImm(MaxA);
MF->getInfo<HexagonMachineFunctionInfo>()->setStackAlignBaseVReg(AR);
}
// Match a frame index that can be used in an addressing mode.

View File

@ -51,6 +51,8 @@ public:
return true;
}
void PreprocessISelDAG() override;
void EmitFunctionEntryCode() override;
void Select(SDNode *N) override;
// Complex Pattern Selectors.
@ -137,7 +139,6 @@ private:
void ppAddrReorderAddShl(std::vector<SDNode*> &&Nodes);
void ppAddrRewriteAndSrl(std::vector<SDNode*> &&Nodes);
void ppHoistZextI1(std::vector<SDNode*> &&Nodes);
void ppEmitAligna();
SmallDenseMap<SDNode *,int> RootWeights;
SmallDenseMap<SDNode *,int> RootHeights;