LLVM: lib/Target/Hexagon/MCTargetDesc/HexagonMCShuffler.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
23#include
24
25#define DEBUG_TYPE "hexagon-shuffle"
26
27using namespace llvm;
28
31 cl::desc("Disable Hexagon instruction shuffling"));
32
33void HexagonMCShuffler::init(MCInst &MCB) {
35 MCInst const *Extender = nullptr;
36
40 << '\n');
42
45 Extender = nullptr;
46 } else
47 Extender = &MI;
48 }
49 }
50
53}
54
55void HexagonMCShuffler::init(MCInst &MCB, MCInst const &AddMI,
56 bool bInsertAtFront) {
58 if (bInsertAtFront)
60 MCInst const *Extender = nullptr;
61
64 MCInst &MI = *const_cast<MCInst *>(I.getInst());
67 Extender = nullptr;
68 } else
69 Extender = &MI;
70 }
71 if (!bInsertAtFront)
73 }
74
77}
78
83
84 for (auto &I : *this) {
86 MCInst const *Extender = I.getExtender();
87 if (Extender)
90 }
91}
92
95
97 return true;
98 }
100 return false;
101}
102
107
109
110 return false;
111
113
114
115
116
117
118
119
121 return false;
124 return false;
125 }
126
128}
129
133
135 return false;
136
138
139
140
141
142
143
144
146 return false;
149 return false;
150 }
151
152 bool doneShuffling = false;
153 while (possibleDuplexes.size() > 0 && (!doneShuffling)) {
154
158 HexagonMCShuffler MCS(Context, false, MCII, STI, Attempt);
159 if (MCS.size() == 1) {
160
162 return false;
163 }
164
166
167 if (doneShuffling)
168 break;
169 }
170
171 if (!doneShuffling) {
173 doneShuffling = MCS.reshuffleTo(MCB);
174 }
175
176 return doneShuffling;
177}
178
181 MCInst const &AddMI, int fixupCount) {
183 return false;
184
185
186
189 return false;
191 if (fixupCount >= 2) {
192 if (bhasDuplex) {
194 return false;
195 }
196 } else {
197 return false;
198 }
199 } else {
201 return false;
202 }
203
205 return false;
206
207
208
209
213 if (bhasDuplex && bundleSize >= maxBundleSize)
214 return false;
215
216 HexagonMCShuffler MCS(Context, false, MCII, STI, MCB, AddMI, false);
218}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static cl::opt< bool > DisableShuffle("disable-hexagon-shuffle", cl::Hidden, cl::init(false), cl::desc("Disable Hexagon instruction shuffling"))
#define HEXAGON_PACKET_SIZE
bool reshuffleTo(MCInst &MCB)
Definition HexagonMCShuffler.cpp:93
void copyTo(MCInst &MCB)
Definition HexagonMCShuffler.cpp:79
MCSubtargetInfo const & STI
void append(MCInst const &ID, MCInst const *Extender, unsigned S)
Context object for machine code objects.
Instances of this class represent a single low-level machine instruction.
LLVM_ABI void dump() const
void addOperand(const MCOperand Op)
const MCOperand & getOperand(unsigned i) const
bool isPseudo() const
Return true if this is a pseudo instruction that doesn't correspond to a real machine instruction.
Interface to description of machine instruction set.
StringRef getName(unsigned Opcode) const
Returns the name for the instructions with the given opcode.
static MCOperand createImm(int64_t Val)
static MCOperand createInst(const MCInst *Val)
Generic base class for all target subtargets.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
size_t bundleSize(MCInst const &MCI)
MCInstrDesc const & getDesc(MCInstrInfo const &MCII, MCInst const &MCI)
iterator_range< Hexagon::PacketIterator > bundleInstructions(MCInstrInfo const &MCII, MCInst const &MCI)
bool isBundle(MCInst const &MCI)
bool hasDuplex(MCInstrInfo const &MCII, MCInst const &MCI)
unsigned getUnits(MCInstrInfo const &MCII, MCSubtargetInfo const &STI, MCInst const &MCI)
Return the slots used by the insn.
bool isImmext(MCInst const &MCI)
bool hasImmExt(MCInst const &MCI)
void replaceDuplex(MCContext &Context, MCInst &MCI, DuplexCandidate Candidate)
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
bool HexagonMCShuffle(MCContext &Context, bool ReportErrors, MCInstrInfo const &MCII, MCSubtargetInfo const &STI, MCInst &MCB)
Definition HexagonMCShuffler.cpp:103
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.