LLVM: lib/Target/Hexagon/MCTargetDesc/HexagonShuffler.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONSHUFFLER_H
15#define LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONSHUFFLER_H
16
24#include
25#include
26#include
27#include
28
29namespace llvm {
30
35
36
38
39
40 unsigned Slots, Weight;
41
42public:
44
49
54
55 unsigned getUnits() const { return (Slots); }
56 unsigned getWeight() const { return (Weight); }
57
58
62
63
65 return (A.getWeight() < B.getWeight());
66 }
67};
68
69
71public:
73
74private:
75
76 unsigned Lanes;
77
78 bool Load, Store;
79
80 bool Valid;
81
82 void setLanes(unsigned l) { Lanes = l; }
83 void setLoad(bool f = true) { Load = f; }
84 void setStore(bool f = true) { Store = f; }
85
86public:
88 MCSubtargetInfo const &STI,
89 unsigned s, MCInst const *id);
90
91 bool isValid() const { return Valid; }
92 unsigned getLanes() const { return Lanes; }
93 bool mayLoad() const { return Load; }
94 bool mayStore() const { return Store; }
95};
96
97
100
102 MCInst const *Extender;
105
106public:
109 MCInst const *Extender, unsigned s)
110 : ID(id), Extender(Extender), Core(s), CVI(MCII, STI, s, id){};
111
114
115
119
120
124
125
129};
130
131
133 using HexagonPacket =
135
136 struct HexagonPacketSummary {
137
138
139 unsigned memory;
141 unsigned load0;
143 unsigned store0;
144 unsigned store1;
145 unsigned NonZCVIloads;
146 unsigned AllCVIloads;
147 unsigned CVIstores;
148
149 unsigned duplex;
150 unsigned pSlot3Cnt;
151 std::optional<HexagonInstr *> PrefSlot3Inst;
152 unsigned memops;
153 unsigned ReservedSlotMask;
155 std::optional Slot1AOKLoc;
156 std::optional NoSlot1StoreLoc;
157 };
158
159 HexagonPacket Packet;
160
161protected:
170
172 const bool DoShuffle);
179 const bool DoShuffle);
181
182 std::optional tryAuction(HexagonPacketSummary const &Summary);
183
187
188public:
193
196
197
199
200 bool check(const bool RequireShuffle = true);
201
203
204 unsigned size() const { return (Packet.size()); }
205
209
222
224
227 MCInst const &Inst = I.getDesc();
228 return (*Pred)(MCII, Inst);
229 });
230 }
231
232
234
235
239};
240
241}
242
243#endif
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
hexagon widen Hexagon Store false hexagon widen loads
#define HEXAGON_PACKET_SIZE
This file defines the SmallVector class.
Definition HexagonShuffler.h:70
HexagonCVIResource(MCInstrInfo const &MCII, MCSubtargetInfo const &STI, unsigned s, MCInst const *id)
bool isValid() const
Definition HexagonShuffler.h:91
unsigned getLanes() const
Definition HexagonShuffler.h:92
bool mayStore() const
Definition HexagonShuffler.h:94
bool mayLoad() const
Definition HexagonShuffler.h:93
std::pair< unsigned, unsigned > UnitsAndLanes
Definition HexagonShuffler.h:72
Definition HexagonShuffler.h:98
MCInst const * getExtender() const
Definition HexagonShuffler.h:113
friend class HexagonShuffler
Definition HexagonShuffler.h:99
MCInst const & getDesc() const
Definition HexagonShuffler.h:112
bool operator<(const HexagonInstr &B) const
Definition HexagonShuffler.h:116
static bool lessCore(const HexagonInstr &A, const HexagonInstr &B)
Definition HexagonShuffler.h:121
static bool lessCVI(const HexagonInstr &A, const HexagonInstr &B)
Definition HexagonShuffler.h:126
HexagonInstr(MCInstrInfo const &MCII, MCSubtargetInfo const &STI, MCInst const *id, MCInst const *Extender, unsigned s)
Definition HexagonShuffler.h:107
Definition HexagonShuffler.h:37
unsigned setWeight(unsigned s)
unsigned getUnits() const
Definition HexagonShuffler.h:55
HexagonResource(unsigned s)
Definition HexagonShuffler.h:43
unsigned getWeight() const
Definition HexagonShuffler.h:56
static bool lessWeight(const HexagonResource &A, const HexagonResource &B)
Definition HexagonShuffler.h:64
void setUnits(unsigned s)
Definition HexagonShuffler.h:45
void setAllUnits()
Definition HexagonShuffler.h:50
static bool lessUnits(const HexagonResource &A, const HexagonResource &B)
Definition HexagonShuffler.h:59
MCContext & Context
Definition HexagonShuffler.h:162
packet_range insts()
Definition HexagonShuffler.h:220
iterator end()
Definition HexagonShuffler.h:211
unsigned size() const
Definition HexagonShuffler.h:204
const_iterator cbegin() const
Definition HexagonShuffler.h:212
HexagonShuffler(MCContext &Context, bool ReportErrors, MCInstrInfo const &MCII, MCSubtargetInfo const &STI)
bool CheckFailure
Definition HexagonShuffler.h:168
packet_range insts(HexagonPacket &P)
Definition HexagonShuffler.h:214
bool(*)(MCInstrInfo const &, MCInst const &) InstPredicate
Definition HexagonShuffler.h:223
bool isMemReorderDisabled() const
Definition HexagonShuffler.h:206
void restrictNoSlot1Store(HexagonPacketSummary const &Summary)
bool check(const bool RequireShuffle=true)
Check that the packet is legal and enforce relative insn order.
void restrictSlot1AOK(HexagonPacketSummary const &Summary)
const_packet_range insts(HexagonPacket const &P) const
Definition HexagonShuffler.h:217
bool restrictStoreLoadOrder(HexagonPacketSummary const &Summary)
iterator_range< HexagonPacket::iterator > packet_range
Definition HexagonShuffler.h:191
void reportError(Twine const &Msg)
HexagonPacket::iterator iterator
Definition HexagonShuffler.h:189
bool ReportErrors
Definition HexagonShuffler.h:167
void reportResourceError(HexagonPacketSummary const &Summary, StringRef Err)
int64_t BundleFlags
Definition HexagonShuffler.h:163
HexagonPacketSummary GetPacketSummary()
bool ValidResourceUsage(HexagonPacketSummary const &Summary)
const_iterator cend() const
Definition HexagonShuffler.h:213
MCSubtargetInfo const & STI
Definition HexagonShuffler.h:165
void restrictBranchOrder(HexagonPacketSummary const &Summary)
iterator_range< HexagonPacket::const_iterator > const_packet_range
Definition HexagonShuffler.h:192
const_packet_range insts() const
Definition HexagonShuffler.h:221
void append(MCInst const &ID, MCInst const *Extender, unsigned S)
bool applySlotRestrictions(HexagonPacketSummary const &Summary, const bool DoShuffle)
MCInstrInfo const & MCII
Definition HexagonShuffler.h:164
void reportResourceUsage(HexagonPacketSummary const &Summary)
bool ValidPacketMemoryOps(HexagonPacketSummary const &Summary) const
void restrictPreferSlot3(HexagonPacketSummary const &Summary, const bool DoShuffle)
iterator begin()
Definition HexagonShuffler.h:210
bool HasInstWith(InstPredicate Pred) const
Definition HexagonShuffler.h:225
std::vector< std::pair< SMLoc, std::string > > AppliedRestrictions
Definition HexagonShuffler.h:169
HexagonPacket::const_iterator const_iterator
Definition HexagonShuffler.h:190
std::optional< HexagonPacket > tryAuction(HexagonPacketSummary const &Summary)
SMLoc Loc
Definition HexagonShuffler.h:166
Context object for machine code objects.
Instances of this class represent a single low-level machine instruction.
Interface to description of machine instruction set.
Generic base class for all target subtargets.
Represents a location in source code.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
A range adaptor for a pair of iterators.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
constexpr int64_t memReorderDisabledMask
This is an optimization pass for GlobalISel generic memory operations.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
constexpr int popcount(T Value) noexcept
Count the number of set bits in a value.
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.