LLVM  4.0.0
MachineInstrBuilder.h
Go to the documentation of this file.
1 //===-- CodeGen/MachineInstBuilder.h - Simplify creation of MIs -*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file exposes a function named BuildMI, which is useful for dramatically
11 // simplifying how MachineInstr's are created. It allows use of code like this:
12 //
13 // M = BuildMI(MBB, MI, DL, TII.get(X86::ADD8rr), Dst)
14 // .addReg(argVal1)
15 // .addReg(argVal2);
16 //
17 //===----------------------------------------------------------------------===//
18 
19 #ifndef LLVM_CODEGEN_MACHINEINSTRBUILDER_H
20 #define LLVM_CODEGEN_MACHINEINSTRBUILDER_H
21 
25 
26 namespace llvm {
27 
28 class MCInstrDesc;
29 class MDNode;
30 
31 namespace RegState {
32  enum {
33  Define = 0x2,
34  Implicit = 0x4,
35  Kill = 0x8,
36  Dead = 0x10,
37  Undef = 0x20,
38  EarlyClobber = 0x40,
39  Debug = 0x80,
40  InternalRead = 0x100,
44  };
45 }
46 
48  MachineFunction *MF;
49  MachineInstr *MI;
50 public:
51  MachineInstrBuilder() : MF(nullptr), MI(nullptr) {}
52 
53  /// Create a MachineInstrBuilder for manipulating an existing instruction.
54  /// F must be the machine function that was used to allocate I.
57  : MF(&F), MI(&*I) {}
58 
59  /// Allow automatic conversion to the machine instruction we are working on.
60  operator MachineInstr*() const { return MI; }
61  MachineInstr *operator->() const { return MI; }
62  operator MachineBasicBlock::iterator() const { return MI; }
63 
64  /// If conversion operators fail, use this method to get the MachineInstr
65  /// explicitly.
66  MachineInstr *getInstr() const { return MI; }
67 
68  /// Add a new virtual register operand.
69  const MachineInstrBuilder &addReg(unsigned RegNo, unsigned flags = 0,
70  unsigned SubReg = 0) const {
71  assert((flags & 0x1) == 0 &&
72  "Passing in 'true' to addReg is forbidden! Use enums instead.");
74  flags & RegState::Define,
75  flags & RegState::Implicit,
76  flags & RegState::Kill,
77  flags & RegState::Dead,
78  flags & RegState::Undef,
79  flags & RegState::EarlyClobber,
80  SubReg,
81  flags & RegState::Debug,
82  flags & RegState::InternalRead));
83  return *this;
84  }
85 
86  /// Add a virtual register definition operand.
87  const MachineInstrBuilder &addDef(unsigned RegNo, unsigned Flags = 0,
88  unsigned SubReg = 0) const {
89  return addReg(RegNo, Flags | RegState::Define, SubReg);
90  }
91 
92  /// Add a virtual register use operand. It is an error for Flags to contain
93  /// `RegState::Define` when calling this function.
94  const MachineInstrBuilder &addUse(unsigned RegNo, unsigned Flags = 0,
95  unsigned SubReg = 0) const {
97  "Misleading addUse defines register, use addReg instead.");
98  return addReg(RegNo, Flags, SubReg);
99  }
100 
101  /// Add a new immediate operand.
102  const MachineInstrBuilder &addImm(int64_t Val) const {
103  MI->addOperand(*MF, MachineOperand::CreateImm(Val));
104  return *this;
105  }
106 
107  const MachineInstrBuilder &addCImm(const ConstantInt *Val) const {
108  MI->addOperand(*MF, MachineOperand::CreateCImm(Val));
109  return *this;
110  }
111 
112  const MachineInstrBuilder &addFPImm(const ConstantFP *Val) const {
114  return *this;
115  }
116 
118  unsigned char TargetFlags = 0) const {
120  return *this;
121  }
122 
123  const MachineInstrBuilder &addFrameIndex(int Idx) const {
124  MI->addOperand(*MF, MachineOperand::CreateFI(Idx));
125  return *this;
126  }
127 
129  int Offset = 0,
130  unsigned char TargetFlags = 0) const {
132  return *this;
133  }
134 
135  const MachineInstrBuilder &addTargetIndex(unsigned Idx, int64_t Offset = 0,
136  unsigned char TargetFlags = 0) const {
138  TargetFlags));
139  return *this;
140  }
141 
143  unsigned char TargetFlags = 0) const {
145  return *this;
146  }
147 
149  int64_t Offset = 0,
150  unsigned char TargetFlags = 0) const {
152  return *this;
153  }
154 
155  const MachineInstrBuilder &addExternalSymbol(const char *FnName,
156  unsigned char TargetFlags = 0) const {
158  return *this;
159  }
160 
162  int64_t Offset = 0,
163  unsigned char TargetFlags = 0) const {
165  return *this;
166  }
167 
170  return *this;
171  }
172 
174  MI->addMemOperand(*MF, MMO);
175  return *this;
176  }
177 
179  MachineInstr::mmo_iterator e) const {
180  MI->setMemRefs(b, e);
181  return *this;
182  }
183 
185  unsigned> MemOperandsRef) const {
186  MI->setMemRefs(MemOperandsRef);
187  return *this;
188  }
189 
191  MI->addOperand(*MF, MO);
192  return *this;
193  }
194 
195  const MachineInstrBuilder &addMetadata(const MDNode *MD) const {
197  assert((MI->isDebugValue() ? static_cast<bool>(MI->getDebugVariable())
198  : true) &&
199  "first MDNode argument of a DBG_VALUE not a variable");
200  return *this;
201  }
202 
203  const MachineInstrBuilder &addCFIIndex(unsigned CFIIndex) const {
204  MI->addOperand(*MF, MachineOperand::CreateCFIIndex(CFIIndex));
205  return *this;
206  }
207 
210  return *this;
211  }
212 
215  return *this;
216  }
217 
219  unsigned char TargetFlags = 0) const {
221  return *this;
222  }
223 
224  const MachineInstrBuilder &setMIFlags(unsigned Flags) const {
225  MI->setFlags(Flags);
226  return *this;
227  }
228 
230  MI->setFlag(Flag);
231  return *this;
232  }
233 
234  // Add a displacement from an existing MachineOperand with an added offset.
235  const MachineInstrBuilder &addDisp(const MachineOperand &Disp, int64_t off,
236  unsigned char TargetFlags = 0) const {
237  // If caller specifies new TargetFlags then use it, otherwise the
238  // default behavior is to copy the target flags from the existing
239  // MachineOperand. This means if the caller wants to clear the
240  // target flags it needs to do so explicitly.
241  if (0 == TargetFlags)
242  TargetFlags = Disp.getTargetFlags();
243 
244  switch (Disp.getType()) {
245  default:
246  llvm_unreachable("Unhandled operand type in addDisp()");
248  return addImm(Disp.getImm() + off);
250  return addConstantPoolIndex(Disp.getIndex(), Disp.getOffset() + off,
251  TargetFlags);
253  return addGlobalAddress(Disp.getGlobal(), Disp.getOffset() + off,
254  TargetFlags);
255  }
256  }
257 
258  /// Copy all the implicit operands from OtherMI onto this one.
259  const MachineInstrBuilder &
260  copyImplicitOps(const MachineInstr &OtherMI) const {
261  MI->copyImplicitOps(*MF, OtherMI);
262  return *this;
263  }
264 };
265 
266 /// Builder interface. Specify how to create the initial instruction itself.
268  const MCInstrDesc &MCID) {
269  return MachineInstrBuilder(MF, MF.CreateMachineInstr(MCID, DL));
270 }
271 
272 /// This version of the builder sets up the first operand as a
273 /// destination virtual register.
275  const MCInstrDesc &MCID, unsigned DestReg) {
276  return MachineInstrBuilder(MF, MF.CreateMachineInstr(MCID, DL))
277  .addReg(DestReg, RegState::Define);
278 }
279 
280 /// This version of the builder inserts the newly-built instruction before
281 /// the given position in the given MachineBasicBlock, and sets up the first
282 /// operand as a destination virtual register.
285  const DebugLoc &DL, const MCInstrDesc &MCID,
286  unsigned DestReg) {
287  MachineFunction &MF = *BB.getParent();
288  MachineInstr *MI = MF.CreateMachineInstr(MCID, DL);
289  BB.insert(I, MI);
290  return MachineInstrBuilder(MF, MI).addReg(DestReg, RegState::Define);
291 }
292 
293 /// This version of the builder inserts the newly-built instruction before
294 /// the given position in the given MachineBasicBlock, and sets up the first
295 /// operand as a destination virtual register.
296 ///
297 /// If \c I is inside a bundle, then the newly inserted \a MachineInstr is
298 /// added to the same bundle.
301  const DebugLoc &DL, const MCInstrDesc &MCID,
302  unsigned DestReg) {
303  MachineFunction &MF = *BB.getParent();
304  MachineInstr *MI = MF.CreateMachineInstr(MCID, DL);
305  BB.insert(I, MI);
306  return MachineInstrBuilder(MF, MI).addReg(DestReg, RegState::Define);
307 }
308 
310  const DebugLoc &DL, const MCInstrDesc &MCID,
311  unsigned DestReg) {
312  // Calling the overload for instr_iterator is always correct. However, the
313  // definition is not available in headers, so inline the check.
314  if (I.isInsideBundle())
315  return BuildMI(BB, MachineBasicBlock::instr_iterator(I), DL, MCID, DestReg);
316  return BuildMI(BB, MachineBasicBlock::iterator(I), DL, MCID, DestReg);
317 }
318 
320  const DebugLoc &DL, const MCInstrDesc &MCID,
321  unsigned DestReg) {
322  return BuildMI(BB, *I, DL, MCID, DestReg);
323 }
324 
325 /// This version of the builder inserts the newly-built instruction before the
326 /// given position in the given MachineBasicBlock, and does NOT take a
327 /// destination register.
330  const DebugLoc &DL,
331  const MCInstrDesc &MCID) {
332  MachineFunction &MF = *BB.getParent();
333  MachineInstr *MI = MF.CreateMachineInstr(MCID, DL);
334  BB.insert(I, MI);
335  return MachineInstrBuilder(MF, MI);
336 }
337 
340  const DebugLoc &DL,
341  const MCInstrDesc &MCID) {
342  MachineFunction &MF = *BB.getParent();
343  MachineInstr *MI = MF.CreateMachineInstr(MCID, DL);
344  BB.insert(I, MI);
345  return MachineInstrBuilder(MF, MI);
346 }
347 
349  const DebugLoc &DL,
350  const MCInstrDesc &MCID) {
351  // Calling the overload for instr_iterator is always correct. However, the
352  // definition is not available in headers, so inline the check.
353  if (I.isInsideBundle())
354  return BuildMI(BB, MachineBasicBlock::instr_iterator(I), DL, MCID);
355  return BuildMI(BB, MachineBasicBlock::iterator(I), DL, MCID);
356 }
357 
359  const DebugLoc &DL,
360  const MCInstrDesc &MCID) {
361  return BuildMI(BB, *I, DL, MCID);
362 }
363 
364 /// This version of the builder inserts the newly-built instruction at the end
365 /// of the given MachineBasicBlock, and does NOT take a destination register.
367  const MCInstrDesc &MCID) {
368  return BuildMI(*BB, BB->end(), DL, MCID);
369 }
370 
371 /// This version of the builder inserts the newly-built instruction at the
372 /// end of the given MachineBasicBlock, and sets up the first operand as a
373 /// destination virtual register.
375  const MCInstrDesc &MCID, unsigned DestReg) {
376  return BuildMI(*BB, BB->end(), DL, MCID, DestReg);
377 }
378 
379 /// This version of the builder builds a DBG_VALUE intrinsic
380 /// for either a value in a register or a register-indirect+offset
381 /// address. The convention is that a DBG_VALUE is indirect iff the
382 /// second operand is an immediate.
383 MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL,
384  const MCInstrDesc &MCID, bool IsIndirect,
385  unsigned Reg, unsigned Offset,
386  const MDNode *Variable, const MDNode *Expr);
387 
388 /// This version of the builder builds a DBG_VALUE intrinsic
389 /// for either a value in a register or a register-indirect+offset
390 /// address and inserts it at position I.
391 MachineInstrBuilder BuildMI(MachineBasicBlock &BB,
392  MachineBasicBlock::iterator I, const DebugLoc &DL,
393  const MCInstrDesc &MCID, bool IsIndirect,
394  unsigned Reg, unsigned Offset,
395  const MDNode *Variable, const MDNode *Expr);
396 
397 inline unsigned getDefRegState(bool B) {
398  return B ? RegState::Define : 0;
399 }
400 inline unsigned getImplRegState(bool B) {
401  return B ? RegState::Implicit : 0;
402 }
403 inline unsigned getKillRegState(bool B) {
404  return B ? RegState::Kill : 0;
405 }
406 inline unsigned getDeadRegState(bool B) {
407  return B ? RegState::Dead : 0;
408 }
409 inline unsigned getUndefRegState(bool B) {
410  return B ? RegState::Undef : 0;
411 }
412 inline unsigned getInternalReadRegState(bool B) {
413  return B ? RegState::InternalRead : 0;
414 }
415 inline unsigned getDebugRegState(bool B) {
416  return B ? RegState::Debug : 0;
417 }
418 
419 /// Get all register state flags from machine operand \p RegOp.
420 inline unsigned getRegState(const MachineOperand &RegOp) {
421  assert(RegOp.isReg() && "Not a register operand");
422  return getDefRegState(RegOp.isDef()) |
423  getImplRegState(RegOp.isImplicit()) |
424  getKillRegState(RegOp.isKill()) |
425  getDeadRegState(RegOp.isDead()) |
426  getUndefRegState(RegOp.isUndef()) |
428  getDebugRegState(RegOp.isDebug());
429 }
430 
431 /// Helper class for constructing bundles of MachineInstrs.
432 ///
433 /// MIBundleBuilder can create a bundle from scratch by inserting new
434 /// MachineInstrs one at a time, or it can create a bundle from a sequence of
435 /// existing MachineInstrs in a basic block.
437  MachineBasicBlock &MBB;
440 
441 public:
442  /// Create an MIBundleBuilder that inserts instructions into a new bundle in
443  /// BB above the bundle or instruction at Pos.
445  : MBB(BB), Begin(Pos.getInstrIterator()), End(Begin) {}
446 
447  /// Create a bundle from the sequence of instructions between B and E.
450  : MBB(BB), Begin(B.getInstrIterator()), End(E.getInstrIterator()) {
451  assert(B != E && "No instructions to bundle");
452  ++B;
453  while (B != E) {
454  MachineInstr &MI = *B;
455  ++B;
456  MI.bundleWithPred();
457  }
458  }
459 
460  /// Create an MIBundleBuilder representing an existing instruction or bundle
461  /// that has MI as its head.
463  : MBB(*MI->getParent()), Begin(MI),
464  End(getBundleEnd(MI->getIterator())) {}
465 
466  /// Return a reference to the basic block containing this bundle.
467  MachineBasicBlock &getMBB() const { return MBB; }
468 
469  /// Return true if no instructions have been inserted in this bundle yet.
470  /// Empty bundles aren't representable in a MachineBasicBlock.
471  bool empty() const { return Begin == End; }
472 
473  /// Return an iterator to the first bundled instruction.
474  MachineBasicBlock::instr_iterator begin() const { return Begin; }
475 
476  /// Return an iterator beyond the last bundled instruction.
477  MachineBasicBlock::instr_iterator end() const { return End; }
478 
479  /// Insert MI into this bundle before I which must point to an instruction in
480  /// the bundle, or end().
482  MachineInstr *MI) {
483  MBB.insert(I, MI);
484  if (I == Begin) {
485  if (!empty())
486  MI->bundleWithSucc();
487  Begin = MI->getIterator();
488  return *this;
489  }
490  if (I == End) {
491  MI->bundleWithPred();
492  return *this;
493  }
494  // MI was inserted in the middle of the bundle, so its neighbors' flags are
495  // already fine. Update MI's bundle flags manually.
498  return *this;
499  }
500 
501  /// Insert MI into MBB by prepending it to the instructions in the bundle.
502  /// MI will become the first instruction in the bundle.
504  return insert(begin(), MI);
505  }
506 
507  /// Insert MI into MBB by appending it to the instructions in the bundle.
508  /// MI will become the last instruction in the bundle.
510  return insert(end(), MI);
511  }
512 };
513 
514 } // End llvm namespace
515 
516 #endif
bool isInsideBundle() const
Return true if MI is in a bundle (but not the first MI in a bundle).
Definition: MachineInstr.h:217
MachineBasicBlock::instr_iterator begin() const
Return an iterator to the first bundled instruction.
bool isImplicit() const
void bundleWithPred()
Bundle this instruction with its predecessor.
const MachineInstrBuilder & addMetadata(const MDNode *MD) const
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
const MachineInstrBuilder & copyImplicitOps(const MachineInstr &OtherMI) const
Copy all the implicit operands from OtherMI onto this one.
MIBundleBuilder(MachineBasicBlock &BB, MachineBasicBlock::iterator Pos)
Create an MIBundleBuilder that inserts instructions into a new bundle in BB above the bundle or instr...
const GlobalValue * getGlobal() const
static MachineOperand CreateCImm(const ConstantInt *CI)
unsigned getRegState(const MachineOperand &RegOp)
Get all register state flags from machine operand RegOp.
static MachineOperand CreateMCSymbol(MCSymbol *Sym, unsigned char TargetFlags=0)
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:39
static MachineOperand CreateJTI(unsigned Idx, unsigned char TargetFlags=0)
Describe properties that are true of each instruction in the target description file.
Definition: MCInstrDesc.h:163
bool isDead() const
MachineInstr * operator->() const
MachineInstrBundleIterator< MachineInstr > iterator
unsigned getInternalReadRegState(bool B)
A debug info location.
Definition: DebugLoc.h:34
Metadata node.
Definition: Metadata.h:830
const MachineInstrBuilder & addIntrinsicID(Intrinsic::ID ID) const
Instructions::iterator instr_iterator
MachineInstr * CreateMachineInstr(const MCInstrDesc &MCID, const DebugLoc &DL, bool NoImp=false)
CreateMachineInstr - Allocate a new MachineInstr.
const MachineInstrBuilder & addDef(unsigned RegNo, unsigned Flags=0, unsigned SubReg=0) const
Add a virtual register definition operand.
const MachineInstrBuilder & addCFIIndex(unsigned CFIIndex) const
const MachineInstrBuilder & setMemRefs(std::pair< MachineInstr::mmo_iterator, unsigned > MemOperandsRef) const
static MachineOperand CreateIntrinsicID(Intrinsic::ID ID)
MIBundleBuilder(MachineBasicBlock &BB, MachineBasicBlock::iterator B, MachineBasicBlock::iterator E)
Create a bundle from the sequence of instructions between B and E.
The address of a basic block.
Definition: Constants.h:822
A description of a memory reference used in the backend.
MachineInstrBuilder(MachineFunction &F, MachineInstr *I)
Create a MachineInstrBuilder for manipulating an existing instruction.
struct fuzzer::@269 Flags
static MachineOperand CreateReg(unsigned Reg, bool isDef, bool isImp=false, bool isKill=false, bool isDead=false, bool isUndef=false, bool isEarlyClobber=false, unsigned SubReg=0, bool isDebug=false, bool isInternalRead=false)
const MachineInstrBuilder & addDisp(const MachineOperand &Disp, int64_t off, unsigned char TargetFlags=0) const
bool isReg() const
isReg - Tests if this is a MO_Register operand.
unsigned SubReg
Reg
All possible values of the reg field in the ModR/M byte.
bool isUndef() const
void bundleWithSucc()
Bundle this instruction with its successor.
static MachineOperand CreateRegMask(const uint32_t *Mask)
CreateRegMask - Creates a register mask operand referencing Mask.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
#define F(x, y, z)
Definition: MD5.cpp:51
void copyImplicitOps(MachineFunction &MF, const MachineInstr &MI)
Copy implicit register operands from specified instruction to this instruction.
bool isKill() const
MIBundleBuilder & prepend(MachineInstr *MI)
Insert MI into MBB by prepending it to the instructions in the bundle.
MachineBasicBlock & getMBB() const
Return a reference to the basic block containing this bundle.
MachineBasicBlock * MBB
static GCRegistry::Add< OcamlGC > B("ocaml","ocaml 3.10-compatible GC")
int64_t getImm() const
void addMemOperand(MachineFunction &MF, MachineMemOperand *MO)
Add a MachineMemOperand to the machine instruction.
static MachineOperand CreatePredicate(unsigned Pred)
unsigned getUndefRegState(bool B)
MachineBasicBlock::instr_iterator end() const
Return an iterator beyond the last bundled instruction.
unsigned getKillRegState(bool B)
static GCRegistry::Add< CoreCLRGC > E("coreclr","CoreCLR-compatible GC")
Flag
These should be considered private to the implementation of the MCInstrDesc class.
Definition: MCInstrDesc.h:121
unsigned getDebugRegState(bool B)
bool isDebugValue() const
Definition: MachineInstr.h:777
unsigned getDeadRegState(bool B)
unsigned getDefRegState(bool B)
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
Address of a global value.
unsigned getTargetFlags() const
const MachineInstrBuilder & setMemRefs(MachineInstr::mmo_iterator b, MachineInstr::mmo_iterator e) const
static MachineOperand CreateCPI(unsigned Idx, int Offset, unsigned char TargetFlags=0)
static MachineOperand CreateFPImm(const ConstantFP *CFP)
ConstantFP - Floating Point Values [float, double].
Definition: Constants.h:269
bool empty() const
Return true if no instructions have been inserted in this bundle yet.
static MachineOperand CreateBA(const BlockAddress *BA, int64_t Offset, unsigned char TargetFlags=0)
void setFlag(MIFlag Flag)
Set a MI flag.
Definition: MachineInstr.h:166
const MachineInstrBuilder & addTargetIndex(unsigned Idx, int64_t Offset=0, unsigned char TargetFlags=0) const
uint32_t Offset
const MachineInstrBuilder & setMIFlags(unsigned Flags) const
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Definition: InstrTypes.h:880
const MachineInstrBuilder & addPredicate(CmpInst::Predicate Pred) const
static MachineOperand CreateGA(const GlobalValue *GV, int64_t Offset, unsigned char TargetFlags=0)
static MachineOperand CreateTargetIndex(unsigned Idx, int64_t Offset, unsigned char TargetFlags=0)
int64_t getOffset() const
Return the offset from the symbol in this operand.
self_iterator getIterator()
Definition: ilist_node.h:81
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Iterator for intrusive lists based on ilist_node.
static MachineOperand CreateMetadata(const MDNode *Meta)
This is the shared class of boolean and integer constants.
Definition: Constants.h:88
void addOperand(MachineFunction &MF, const MachineOperand &Op)
Add the specified operand to the instruction.
void setFlags(unsigned flags)
Definition: MachineInstr.h:170
const MachineInstrBuilder & addJumpTableIndex(unsigned Idx, unsigned char TargetFlags=0) const
MachineOperand class - Representation of each machine instruction operand.
const MachineInstrBuilder & addCImm(const ConstantInt *Val) const
const MachineInstrBuilder & addFrameIndex(int Idx) const
MIBundleBuilder & insert(MachineBasicBlock::instr_iterator I, MachineInstr *MI)
Insert MI into this bundle before I which must point to an instruction in the bundle, or end().
const MachineInstrBuilder & addSym(MCSymbol *Sym, unsigned char TargetFlags=0) const
static MachineOperand CreateES(const char *SymName, unsigned char TargetFlags=0)
const MachineInstrBuilder & addGlobalAddress(const GlobalValue *GV, int64_t Offset=0, unsigned char TargetFlags=0) const
Representation of each machine instruction.
Definition: MachineInstr.h:52
MachineOperandType getType() const
getType - Returns the MachineOperandType for this operand.
static MachineOperand CreateMBB(MachineBasicBlock *MBB, unsigned char TargetFlags=0)
const MachineInstrBuilder & addExternalSymbol(const char *FnName, unsigned char TargetFlags=0) const
static MachineOperand CreateCFIIndex(unsigned CFIIndex)
const MachineInstrBuilder & addConstantPoolIndex(unsigned Idx, int Offset=0, unsigned char TargetFlags=0) const
const MachineInstrBuilder & addMemOperand(MachineMemOperand *MMO) const
static MachineOperand CreateImm(int64_t Val)
#define I(x, y, z)
Definition: MD5.cpp:54
unsigned getImplRegState(bool B)
instr_iterator insert(instr_iterator I, MachineInstr *M)
Insert MI into the instruction list before I, possibly inside a bundle.
const DILocalVariable * getDebugVariable() const
Return the debug variable referenced by this DBG_VALUE instruction.
const MachineInstrBuilder & addFPImm(const ConstantFP *Val) const
MIBundleBuilder & append(MachineInstr *MI)
Insert MI into MBB by appending it to the instructions in the bundle.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
const MachineInstrBuilder & addUse(unsigned RegNo, unsigned Flags=0, unsigned SubReg=0) const
Add a virtual register use operand.
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned char TargetFlags=0) const
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
Definition: BitmaskEnum.h:81
static const Function * getParent(const Value *V)
bool isDebug() const
const MachineInstrBuilder & addOperand(const MachineOperand &MO) const
IRTranslator LLVM IR MI
Address of indexed Constant in Constant Pool.
const MachineInstrBuilder & setMIFlag(MachineInstr::MIFlag Flag) const
MachineBasicBlock::instr_iterator getBundleEnd(MachineBasicBlock::instr_iterator I)
Returns an iterator pointing beyond the bundle containing I.
const MachineInstrBuilder & addBlockAddress(const BlockAddress *BA, int64_t Offset=0, unsigned char TargetFlags=0) const
const MachineInstrBuilder & addRegMask(const uint32_t *Mask) const
const MachineInstrBuilder & addReg(unsigned RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
static MachineOperand CreateFI(int Idx)
void setMemRefs(mmo_iterator NewMemRefs, mmo_iterator NewMemRefsEnd)
Assign this MachineInstr's memory reference descriptor list.
MachineInstrBuilder(MachineFunction &F, MachineBasicBlock::iterator I)
MIBundleBuilder(MachineInstr *MI)
Create an MIBundleBuilder representing an existing instruction or bundle that has MI as its head...
bool isInternalRead() const
Helper class for constructing bundles of MachineInstrs.
MachineInstr * getInstr() const
If conversion operators fail, use this method to get the MachineInstr explicitly. ...