LLVM: include/llvm/CodeGen/MachineInstrBundle.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef LLVM_CODEGEN_MACHINEINSTRBUNDLE_H
15#define LLVM_CODEGEN_MACHINEINSTRBUNDLE_H
16
20
21namespace llvm {
22
23
24
25
26
27
28
32
33
34
35
36
37
41
42
43
45
46
49 while (I->isBundledWithPred())
50 --I;
51 return I;
52}
53
54
57 while (I->isBundledWithPred())
58 --I;
59 return I;
60}
61
62
65 while (I->isBundledWithSucc())
66 ++I;
67 ++I;
68 return I;
69}
70
71
74 while (I->isBundledWithSucc())
75 ++I;
76 ++I;
77 return I;
78}
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96template
99 std::forward_iterator_tag, ValueT> {
102
103
104
105 void advance() {
106 while (OpI == OpE) {
107
108 if (++InstrI == InstrE || !InstrI->isInsideBundle()) {
109 InstrI = InstrE;
110 break;
111 }
112 OpI = InstrI->operands_begin();
113 OpE = InstrI->operands_end();
114 }
115 }
116
117protected:
118
119
120
121
122
125 InstrE = MI.getParent()->instr_end();
126 OpI = InstrI->operands_begin();
127 OpE = InstrI->operands_end();
128 advance();
129 }
130
131
132
135 : InstrI(InstrE), InstrE(InstrE), OpI(OpE), OpE(OpE) {}
136
137public:
138
139 bool isValid() const { return OpI != OpE; }
140
141
143 assert(isValid() && "Cannot advance MIOperands beyond the last operand");
144 ++OpI;
145 advance();
146 }
147
150
152
153
154
155 return InstrI == Arg.InstrI &&
156 (OpI == Arg.OpI || (OpI == OpE && Arg.OpI == Arg.OpE));
157 }
158
159
160
162 return OpI - InstrI->operands_begin();
163 }
164};
165
166
167
168
170
174
175public:
177
178
183};
184
185
186
187
188class ConstMIBundleOperands
190
191
195
196public:
199
200
205};
206
212
217
218
219
220
222
223
225
226
228
229
230
231
233};
234
235
236
237
238
239
240
241
242
245 SmallVectorImpl<std::pair<MachineInstr *, unsigned>> *Ops = nullptr);
246
247
248
249LLVM_ABI std::pair<LaneBitmask, LaneBitmask>
253
254
255
257
258
260
261
262
264
265
267
268
269
271
273
274
275
276
277
279
280
281
283
284
286};
287
288
289
290
291
292
293
297
303
304}
305
306#endif
unsigned const MachineRegisterInfo * MRI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
Register const TargetRegisterInfo * TRI
ConstMIBundleOperands - Iterate over all operands in a const bundle of machine instructions.
Definition MachineInstrBundle.h:189
static ConstMIBundleOperands end(const MachineBasicBlock &MBB)
Returns an iterator past the last iteration.
Definition MachineInstrBundle.h:201
ConstMIBundleOperands(const MachineInstr &MI)
Definition MachineInstrBundle.h:197
LLVM_ABI PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
unsigned getOperandNo() const
getOperandNo - Returns the number of the current operand relative to its instruction.
Definition MachineInstrBundle.h:161
MIBundleOperandIteratorBase(MachineInstr &MI)
MIBundleOperandIteratorBase - Create an iterator that visits all operands on MI, or all operands on e...
Definition MachineInstrBundle.h:123
ValueT & operator*() const
Definition MachineInstrBundle.h:148
MIBundleOperandIteratorBase(MachineBasicBlock::instr_iterator InstrE, MachineInstr::mop_iterator OpE)
Constructor for an iterator past the last iteration: both instruction iterators point to the end of t...
Definition MachineInstrBundle.h:133
bool operator==(const MIBundleOperandIteratorBase &Arg) const
Definition MachineInstrBundle.h:151
bool isValid() const
isValid - Returns true until all the operands have been visited.
Definition MachineInstrBundle.h:139
ValueT * operator->() const
Definition MachineInstrBundle.h:149
void operator++()
Preincrement. Move to the next operand.
Definition MachineInstrBundle.h:142
MIBundleOperands - Iterate over all operands in a bundle of machine instructions.
Definition MachineInstrBundle.h:169
static MIBundleOperands end(const MachineBasicBlock &MBB)
Returns an iterator past the last iteration.
Definition MachineInstrBundle.h:179
MIBundleOperands(MachineInstr &MI)
Definition MachineInstrBundle.h:176
Instructions::iterator instr_iterator
Instructions::const_iterator const_instr_iterator
Representation of each machine instruction.
MachineOperand * mop_iterator
iterator/begin/end - Iterate over all operands of a machine instruction.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
A set of analyses that are preserved following a run of a transformation pass.
Wrapper class representing virtual and physical registers.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
A range adaptor for a pair of iterators.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI void finalizeBundle(MachineBasicBlock &MBB, MachineBasicBlock::instr_iterator FirstMI, MachineBasicBlock::instr_iterator LastMI)
finalizeBundle - Finalize a machine instruction bundle which includes a sequence of instructions star...
MachineBasicBlock::instr_iterator getBundleStart(MachineBasicBlock::instr_iterator I)
Returns an iterator to the first instruction in the bundle containing I.
Definition MachineInstrBundle.h:47
LLVM_ABI bool finalizeBundles(MachineFunction &MF)
finalizeBundles - Finalize instruction bundles in the specified MachineFunction.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
LLVM_ABI PhysRegInfo AnalyzePhysRegInBundle(const MachineInstr &MI, Register Reg, const TargetRegisterInfo *TRI)
AnalyzePhysRegInBundle - Analyze how the current instruction or bundle uses a physical register.
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
MachineBasicBlock::instr_iterator getBundleEnd(MachineBasicBlock::instr_iterator I)
Returns an iterator pointing beyond the bundle containing I.
Definition MachineInstrBundle.h:63
iterator_range< ConstMIBundleOperands > const_mi_bundle_ops(const MachineInstr &MI)
Definition MachineInstrBundle.h:208
LLVM_ABI VirtRegInfo AnalyzeVirtRegInBundle(MachineInstr &MI, Register Reg, SmallVectorImpl< std::pair< MachineInstr *, unsigned > > *Ops=nullptr)
AnalyzeVirtRegInBundle - Analyze how the current instruction or bundle uses a virtual register.
iterator_range(Container &&) -> iterator_range< llvm::detail::IterOfRange< Container > >
iterator_range< MIBundleOperands > mi_bundle_ops(MachineInstr &MI)
Definition MachineInstrBundle.h:213
LLVM_ABI std::pair< LaneBitmask, LaneBitmask > AnalyzeVirtRegLanesInBundle(const MachineInstr &MI, Register Reg, const MachineRegisterInfo &MRI, const TargetRegisterInfo &TRI)
Return a pair of lane masks (reads, writes) indicating which lanes this instruction uses with Reg.
A CRTP mix-in to automatically provide informational APIs needed for passes.
Information about how a physical register Reg is used by a set of operands.
Definition MachineInstrBundle.h:256
bool Read
Reg or one of its aliases is read.
Definition MachineInstrBundle.h:270
bool DeadDef
Either:
Definition MachineInstrBundle.h:278
bool Defined
Reg or one of its aliases is defined.
Definition MachineInstrBundle.h:263
bool Killed
There is a use operand of reg or a super-register with kill flag set.
Definition MachineInstrBundle.h:285
bool PartialDeadDef
Reg is Defined and all defs of reg or an overlapping register are dead.
Definition MachineInstrBundle.h:282
bool Clobbered
There is a regmask operand indicating Reg is clobbered.
Definition MachineInstrBundle.h:259
bool FullyRead
Reg or a super-register is read. The full register is read.
Definition MachineInstrBundle.h:272
bool FullyDefined
Reg or a super-register is defined.
Definition MachineInstrBundle.h:266
VirtRegInfo - Information about a virtual register used by a set of operands.
Definition MachineInstrBundle.h:221
bool Reads
Reads - One of the operands read the virtual register.
Definition MachineInstrBundle.h:224
bool Tied
Tied - Uses and defs must use the same register.
Definition MachineInstrBundle.h:232
bool Writes
Writes - One of the operands writes the virtual register.
Definition MachineInstrBundle.h:227