LLVM  5.0.0
HexagonVLIWPacketizer.h
Go to the documentation of this file.
1 #ifndef HEXAGONVLIWPACKETIZER_H
2 #define HEXAGONVLIWPACKETIZER_H
3 
8 
9 namespace llvm {
10 class HexagonInstrInfo;
11 class HexagonRegisterInfo;
12 
14  // Vector of instructions assigned to the packet that has just been created.
15  std::vector<MachineInstr*> OldPacketMIs;
16 
17  // Has the instruction been promoted to a dot-new instruction.
18  bool PromotedToDotNew;
19 
20  // Has the instruction been glued to allocframe.
21  bool GlueAllocframeStore;
22 
23  // Has the feeder instruction been glued to new value jump.
24  bool GlueToNewValueJump;
25 
26  // Check if there is a dependence between some instruction already in this
27  // packet and this instruction.
28  bool Dependence;
29 
30  // Only check for dependence if there are resources available to
31  // schedule this instruction.
32  bool FoundSequentialDependence;
33 
34  // Track MIs with ignored dependence.
35  std::vector<MachineInstr*> IgnoreDepMIs;
36 
37  // Set to true if the packet contains an instruction that stalls with an
38  // instruction from the previous packet.
39  bool PacketStalls = false;
40 
41 protected:
42  /// \brief A handle to the branch probability pass.
45 
46 private:
47  const HexagonInstrInfo *HII;
48  const HexagonRegisterInfo *HRI;
49 
50 public:
51  // Ctor.
55 
56  // initPacketizerState - initialize some internal flags.
57  void initPacketizerState() override;
58 
59  // ignorePseudoInstruction - Ignore bundling of pseudo instructions.
61  const MachineBasicBlock *MBB) override;
62 
63  // isSoloInstruction - return true if instruction MI can not be packetized
64  // with any other instruction, which means that MI itself is a packet.
65  bool isSoloInstruction(const MachineInstr &MI) override;
66 
67  // isLegalToPacketizeTogether - Is it legal to packetize SUI and SUJ
68  // together.
69  bool isLegalToPacketizeTogether(SUnit *SUI, SUnit *SUJ) override;
70 
71  // isLegalToPruneDependencies - Is it legal to prune dependece between SUI
72  // and SUJ.
73  bool isLegalToPruneDependencies(SUnit *SUI, SUnit *SUJ) override;
74 
76  void endPacket(MachineBasicBlock *MBB,
78  bool shouldAddToPacket(const MachineInstr &MI) override;
79 
81 
82 protected:
83  bool isCallDependent(const MachineInstr &MI, SDep::Kind DepType,
84  unsigned DepReg);
87  const TargetRegisterClass *RC);
88  bool canPromoteToDotCur(const MachineInstr &MI, const SUnit *PacketSU,
89  unsigned DepReg, MachineBasicBlock::iterator &MII,
90  const TargetRegisterClass *RC);
91  void cleanUpDotCur();
92 
95  const TargetRegisterClass *RC);
96  bool canPromoteToDotNew(const MachineInstr &MI, const SUnit *PacketSU,
97  unsigned DepReg, MachineBasicBlock::iterator &MII,
98  const TargetRegisterClass *RC);
99  bool canPromoteToNewValue(const MachineInstr &MI, const SUnit *PacketSU,
100  unsigned DepReg, MachineBasicBlock::iterator &MII);
102  const MachineInstr &PacketMI, unsigned DepReg);
107  bool restrictingDepExistInPacket(MachineInstr&, unsigned);
108  bool isNewifiable(const MachineInstr &MI, const TargetRegisterClass *NewRC);
110  bool cannotCoexist(const MachineInstr &MI, const MachineInstr &MJ);
111  inline bool isPromotedToDotNew() const {
112  return PromotedToDotNew;
113  }
114  bool tryAllocateResourcesForConstExt(bool Reserve);
117  bool hasDeadDependence(const MachineInstr &I, const MachineInstr &J);
118  bool hasControlDependence(const MachineInstr &I, const MachineInstr &J);
119  bool hasRegMaskDependence(const MachineInstr &I, const MachineInstr &J);
120  bool hasV4SpecificDependence(const MachineInstr &I, const MachineInstr &J);
121  bool producesStall(const MachineInstr &MI);
122 };
123 } // namespace llvm
124 #endif // HEXAGONVLIWPACKETIZER_H
125 
bool canPromoteToNewValueStore(const MachineInstr &MI, const MachineInstr &PacketMI, unsigned DepReg)
bool canPromoteToDotNew(const MachineInstr &MI, const SUnit *PacketSU, unsigned DepReg, MachineBasicBlock::iterator &MII, const TargetRegisterClass *RC)
const MachineLoopInfo * MLI
bool demoteToDotOld(MachineInstr &MI)
bool isCurifiable(MachineInstr &MI)
Kind
These are the different kinds of scheduling dependencies.
Definition: ScheduleDAG.h:53
bool restrictingDepExistInPacket(MachineInstr &, unsigned)
bool canPromoteToDotCur(const MachineInstr &MI, const SUnit *PacketSU, unsigned DepReg, MachineBasicBlock::iterator &MII, const TargetRegisterClass *RC)
bool shouldAddToPacket(const MachineInstr &MI) override
MachineFunction & MF
void endPacket(MachineBasicBlock *MBB, MachineBasicBlock::iterator MI) override
bool arePredicatesComplements(MachineInstr &MI1, MachineInstr &MI2)
const MachineBranchProbabilityInfo * MBPI
A handle to the branch probability pass.
bool isSoloInstruction(const MachineInstr &MI) override
bool tryAllocateResourcesForConstExt(bool Reserve)
bool isLegalToPacketizeTogether(SUnit *SUI, SUnit *SUJ) override
HexagonPacketizerList(MachineFunction &MF, MachineLoopInfo &MLI, AliasAnalysis *AA, const MachineBranchProbabilityInfo *MBPI)
MachineBasicBlock::iterator addToPacket(MachineInstr &MI) override
Representation of each machine instruction.
Definition: MachineInstr.h:59
bool promoteToDotCur(MachineInstr &MI, SDep::Kind DepType, MachineBasicBlock::iterator &MII, const TargetRegisterClass *RC)
bool isCallDependent(const MachineInstr &MI, SDep::Kind DepType, unsigned DepReg)
bool ignorePseudoInstruction(const MachineInstr &MI, const MachineBasicBlock *MBB) override
bool isNewifiable(const MachineInstr &MI, const TargetRegisterClass *NewRC)
#define I(x, y, z)
Definition: MD5.cpp:58
bool hasControlDependence(const MachineInstr &I, const MachineInstr &J)
bool useCallersSP(MachineInstr &MI)
bool promoteToDotNew(MachineInstr &MI, SDep::Kind DepType, MachineBasicBlock::iterator &MII, const TargetRegisterClass *RC)
bool hasDeadDependence(const MachineInstr &I, const MachineInstr &J)
bool cannotCoexist(const MachineInstr &MI, const MachineInstr &MJ)
bool isLegalToPruneDependencies(SUnit *SUI, SUnit *SUJ) override
void useCalleesSP(MachineInstr &MI)
bool hasRegMaskDependence(const MachineInstr &I, const MachineInstr &J)
IRTranslator LLVM IR MI
void unpacketizeSoloInstrs(MachineFunction &MF)
Dependence - This class represents a dependence between two memory memory references in a function...
bool canPromoteToNewValue(const MachineInstr &MI, const SUnit *PacketSU, unsigned DepReg, MachineBasicBlock::iterator &MII)
bool producesStall(const MachineInstr &MI)
Scheduling unit. This is a node in the scheduling DAG.
Definition: ScheduleDAG.h:247
bool hasV4SpecificDependence(const MachineInstr &I, const MachineInstr &J)