2015-12-16 20:36:12 +01:00
|
|
|
#ifndef HEXAGONVLIWPACKETIZER_H
|
|
|
|
#define HEXAGONVLIWPACKETIZER_H
|
|
|
|
|
|
|
|
#include "llvm/CodeGen/DFAPacketizer.h"
|
|
|
|
#include "llvm/CodeGen/MachineBranchProbabilityInfo.h"
|
|
|
|
#include "llvm/CodeGen/ScheduleDAG.h"
|
|
|
|
#include "llvm/CodeGen/ScheduleDAGInstrs.h"
|
|
|
|
|
|
|
|
namespace llvm {
|
2017-01-30 15:55:33 +01:00
|
|
|
class HexagonInstrInfo;
|
|
|
|
class HexagonRegisterInfo;
|
|
|
|
|
2015-12-16 20:36:12 +01:00
|
|
|
class HexagonPacketizerList : public VLIWPacketizerList {
|
|
|
|
// Vector of instructions assigned to the packet that has just been created.
|
|
|
|
std::vector<MachineInstr*> OldPacketMIs;
|
|
|
|
|
|
|
|
// Has the instruction been promoted to a dot-new instruction.
|
|
|
|
bool PromotedToDotNew;
|
|
|
|
|
|
|
|
// Has the instruction been glued to allocframe.
|
|
|
|
bool GlueAllocframeStore;
|
|
|
|
|
|
|
|
// Has the feeder instruction been glued to new value jump.
|
|
|
|
bool GlueToNewValueJump;
|
|
|
|
|
|
|
|
// Check if there is a dependence between some instruction already in this
|
|
|
|
// packet and this instruction.
|
|
|
|
bool Dependence;
|
|
|
|
|
|
|
|
// Only check for dependence if there are resources available to
|
|
|
|
// schedule this instruction.
|
|
|
|
bool FoundSequentialDependence;
|
|
|
|
|
|
|
|
// Track MIs with ignored dependence.
|
|
|
|
std::vector<MachineInstr*> IgnoreDepMIs;
|
|
|
|
|
2017-05-02 20:12:19 +02:00
|
|
|
// Set to true if the packet contains an instruction that stalls with an
|
|
|
|
// instruction from the previous packet.
|
2017-05-02 20:29:49 +02:00
|
|
|
bool PacketStalls = false;
|
2017-05-02 20:12:19 +02:00
|
|
|
|
2015-12-16 20:36:12 +01:00
|
|
|
protected:
|
|
|
|
/// \brief A handle to the branch probability pass.
|
|
|
|
const MachineBranchProbabilityInfo *MBPI;
|
|
|
|
const MachineLoopInfo *MLI;
|
|
|
|
|
|
|
|
private:
|
|
|
|
const HexagonInstrInfo *HII;
|
|
|
|
const HexagonRegisterInfo *HRI;
|
|
|
|
|
|
|
|
public:
|
|
|
|
// Ctor.
|
|
|
|
HexagonPacketizerList(MachineFunction &MF, MachineLoopInfo &MLI,
|
|
|
|
AliasAnalysis *AA,
|
|
|
|
const MachineBranchProbabilityInfo *MBPI);
|
|
|
|
|
|
|
|
// initPacketizerState - initialize some internal flags.
|
|
|
|
void initPacketizerState() override;
|
|
|
|
|
|
|
|
// ignorePseudoInstruction - Ignore bundling of pseudo instructions.
|
2016-02-27 20:09:00 +01:00
|
|
|
bool ignorePseudoInstruction(const MachineInstr &MI,
|
2015-12-16 20:36:12 +01:00
|
|
|
const MachineBasicBlock *MBB) override;
|
|
|
|
|
|
|
|
// isSoloInstruction - return true if instruction MI can not be packetized
|
|
|
|
// with any other instruction, which means that MI itself is a packet.
|
2016-02-27 20:09:00 +01:00
|
|
|
bool isSoloInstruction(const MachineInstr &MI) override;
|
2015-12-16 20:36:12 +01:00
|
|
|
|
|
|
|
// isLegalToPacketizeTogether - Is it legal to packetize SUI and SUJ
|
|
|
|
// together.
|
|
|
|
bool isLegalToPacketizeTogether(SUnit *SUI, SUnit *SUJ) override;
|
|
|
|
|
|
|
|
// isLegalToPruneDependencies - Is it legal to prune dependece between SUI
|
|
|
|
// and SUJ.
|
|
|
|
bool isLegalToPruneDependencies(SUnit *SUI, SUnit *SUJ) override;
|
|
|
|
|
2016-02-27 20:09:00 +01:00
|
|
|
MachineBasicBlock::iterator addToPacket(MachineInstr &MI) override;
|
|
|
|
void endPacket(MachineBasicBlock *MBB,
|
|
|
|
MachineBasicBlock::iterator MI) override;
|
|
|
|
bool shouldAddToPacket(const MachineInstr &MI) override;
|
2015-12-16 20:36:12 +01:00
|
|
|
|
|
|
|
void unpacketizeSoloInstrs(MachineFunction &MF);
|
|
|
|
|
|
|
|
protected:
|
2016-07-29 23:49:42 +02:00
|
|
|
bool isCallDependent(const MachineInstr &MI, SDep::Kind DepType,
|
2015-12-16 20:36:12 +01:00
|
|
|
unsigned DepReg);
|
2016-07-29 23:49:42 +02:00
|
|
|
bool promoteToDotCur(MachineInstr &MI, SDep::Kind DepType,
|
2015-12-16 20:36:12 +01:00
|
|
|
MachineBasicBlock::iterator &MII,
|
2016-07-29 23:49:42 +02:00
|
|
|
const TargetRegisterClass *RC);
|
|
|
|
bool canPromoteToDotCur(const MachineInstr &MI, const SUnit *PacketSU,
|
2015-12-16 20:36:12 +01:00
|
|
|
unsigned DepReg, MachineBasicBlock::iterator &MII,
|
2016-07-29 23:49:42 +02:00
|
|
|
const TargetRegisterClass *RC);
|
2015-12-16 20:36:12 +01:00
|
|
|
void cleanUpDotCur();
|
|
|
|
|
2016-07-29 23:49:42 +02:00
|
|
|
bool promoteToDotNew(MachineInstr &MI, SDep::Kind DepType,
|
2015-12-16 20:36:12 +01:00
|
|
|
MachineBasicBlock::iterator &MII,
|
2016-07-29 23:49:42 +02:00
|
|
|
const TargetRegisterClass *RC);
|
|
|
|
bool canPromoteToDotNew(const MachineInstr &MI, const SUnit *PacketSU,
|
2015-12-16 20:36:12 +01:00
|
|
|
unsigned DepReg, MachineBasicBlock::iterator &MII,
|
2016-07-29 23:49:42 +02:00
|
|
|
const TargetRegisterClass *RC);
|
|
|
|
bool canPromoteToNewValue(const MachineInstr &MI, const SUnit *PacketSU,
|
2015-12-16 20:36:12 +01:00
|
|
|
unsigned DepReg, MachineBasicBlock::iterator &MII);
|
2016-07-29 23:49:42 +02:00
|
|
|
bool canPromoteToNewValueStore(const MachineInstr &MI,
|
|
|
|
const MachineInstr &PacketMI, unsigned DepReg);
|
|
|
|
bool demoteToDotOld(MachineInstr &MI);
|
|
|
|
bool useCallersSP(MachineInstr &MI);
|
|
|
|
void useCalleesSP(MachineInstr &MI);
|
2016-02-23 03:46:52 +01:00
|
|
|
bool arePredicatesComplements(MachineInstr &MI1, MachineInstr &MI2);
|
2016-07-29 23:49:42 +02:00
|
|
|
bool restrictingDepExistInPacket(MachineInstr&, unsigned);
|
|
|
|
bool isNewifiable(const MachineInstr &MI, const TargetRegisterClass *NewRC);
|
|
|
|
bool isCurifiable(MachineInstr &MI);
|
|
|
|
bool cannotCoexist(const MachineInstr &MI, const MachineInstr &MJ);
|
2015-12-16 20:36:12 +01:00
|
|
|
inline bool isPromotedToDotNew() const {
|
|
|
|
return PromotedToDotNew;
|
|
|
|
}
|
|
|
|
bool tryAllocateResourcesForConstExt(bool Reserve);
|
|
|
|
bool canReserveResourcesForConstExt();
|
|
|
|
void reserveResourcesForConstExt();
|
2016-07-29 23:49:42 +02:00
|
|
|
bool hasDeadDependence(const MachineInstr &I, const MachineInstr &J);
|
|
|
|
bool hasControlDependence(const MachineInstr &I, const MachineInstr &J);
|
2017-02-17 23:14:51 +01:00
|
|
|
bool hasRegMaskDependence(const MachineInstr &I, const MachineInstr &J);
|
2016-07-29 23:49:42 +02:00
|
|
|
bool hasV4SpecificDependence(const MachineInstr &I, const MachineInstr &J);
|
|
|
|
bool producesStall(const MachineInstr &MI);
|
2015-12-16 20:36:12 +01:00
|
|
|
};
|
|
|
|
} // namespace llvm
|
|
|
|
#endif // HEXAGONVLIWPACKETIZER_H
|
|
|
|
|