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
18
19namespace llvm {
20
21
22
23
24
25
26
30
31
32
33
34
35
38
39
40
42
43
46 while (I->isBundledWithPred())
47 --I;
48 return I;
49}
50
51
54 while (I->isBundledWithPred())
55 --I;
56 return I;
57}
58
59
62 while (I->isBundledWithSucc())
63 ++I;
64 ++I;
65 return I;
66}
67
68
71 while (I->isBundledWithSucc())
72 ++I;
73 ++I;
74 return I;
75}
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93template
96 std::forward_iterator_tag, ValueT> {
99
100
101
102 void advance() {
103 while (OpI == OpE) {
104
105 if (++InstrI == InstrE || !InstrI->isInsideBundle()) {
106 InstrI = InstrE;
107 break;
108 }
109 OpI = InstrI->operands_begin();
110 OpE = InstrI->operands_end();
111 }
112 }
113
114protected:
115
116
117
118
119
122 InstrE = MI.getParent()->instr_end();
123 OpI = InstrI->operands_begin();
124 OpE = InstrI->operands_end();
125 advance();
126 }
127
128
129
132 : InstrI(InstrE), InstrE(InstrE), OpI(OpE), OpE(OpE) {}
133
134public:
135
136 bool isValid() const { return OpI != OpE; }
137
138
140 assert(isValid() && "Cannot advance MIOperands beyond the last operand");
141 ++OpI;
142 advance();
143 }
144
147
149
150
151
152 return InstrI == Arg.InstrI &&
153 (OpI == Arg.OpI || (OpI == OpE && Arg.OpI == Arg.OpE));
154 }
155
156
157
159 return OpI - InstrI->operands_begin();
160 }
161};
162
163
164
165
167
171
172public:
174
175
179 }
180};
181
182
183
184
187
188
192
193public:
196
197
201 }
202};
203
204inline iterator_range
208}
209
213}
214
215
216
217
219
220
222
223
225
226
227
228
230};
231
232
233
234
235
236
237
238
239
242 SmallVectorImpl<std::pair<MachineInstr *, unsigned>> *Ops = nullptr);
243
244
245
246std::pair<LaneBitmask, LaneBitmask>
250
251
252
254
255
257
258
259
261
262
264
265
266
268
270
271
272
273
274
276
277
278
280
281
283};
284
285
286
287
288
289
290
293
294}
295
296#endif
unsigned const MachineRegisterInfo * MRI
unsigned const TargetRegisterInfo * TRI
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
ConstMIBundleOperands - Iterate over all operands in a const bundle of machine instructions.
static ConstMIBundleOperands end(const MachineBasicBlock &MBB)
Returns an iterator past the last iteration.
ConstMIBundleOperands(const MachineInstr &MI)
MIBundleOperandIteratorBase - Iterator that visits all operands in a bundle of MachineInstrs.
unsigned getOperandNo() const
getOperandNo - Returns the number of the current operand relative to its instruction.
MIBundleOperandIteratorBase(MachineInstr &MI)
MIBundleOperandIteratorBase - Create an iterator that visits all operands on MI, or all operands on e...
ValueT & operator*() const
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...
bool operator==(const MIBundleOperandIteratorBase &Arg) const
bool isValid() const
isValid - Returns true until all the operands have been visited.
ValueT * operator->() const
void operator++()
Preincrement. Move to the next operand.
MIBundleOperands - Iterate over all operands in a bundle of machine instructions.
static MIBundleOperands end(const MachineBasicBlock &MBB)
Returns an iterator past the last iteration.
MIBundleOperands(MachineInstr &MI)
Instructions::iterator instr_iterator
Instructions::const_iterator const_instr_iterator
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
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.
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.
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.
PhysRegInfo AnalyzePhysRegInBundle(const MachineInstr &MI, Register Reg, const TargetRegisterInfo *TRI)
AnalyzePhysRegInBundle - Analyze how the current instruction or bundle uses a physical register.
MachineBasicBlock::instr_iterator getBundleEnd(MachineBasicBlock::instr_iterator I)
Returns an iterator pointing beyond the bundle containing I.
iterator_range< ConstMIBundleOperands > const_mi_bundle_ops(const MachineInstr &MI)
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< MIBundleOperands > mi_bundle_ops(MachineInstr &MI)
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.
Information about how a physical register Reg is used by a set of operands.
bool Read
Reg or one of its aliases is read.
bool Defined
Reg or one of its aliases is defined.
bool Killed
There is a use operand of reg or a super-register with kill flag set.
bool PartialDeadDef
Reg is Defined and all defs of reg or an overlapping register are dead.
bool Clobbered
There is a regmask operand indicating Reg is clobbered.
bool FullyRead
Reg or a super-register is read. The full register is read.
bool FullyDefined
Reg or a super-register is defined.
VirtRegInfo - Information about a virtual register used by a set of operands.
bool Reads
Reads - One of the operands read the virtual register.
bool Tied
Tied - Uses and defs must use the same register.
bool Writes
Writes - One of the operands writes the virtual register.