19#ifndef LLVM_CODEGEN_MACHINEINSTRBUILDER_H 
   20#define LLVM_CODEGEN_MACHINEINSTRBUILDER_H 
   78      : DL(
std::
move(DL)), PCSections(PCSections), MMRA(MMRA) {}
 
 
   81      : DL(DI), PCSections(PCSections), MMRA(MMRA) {}
 
 
   84        PCSections(From.getMetadata(
LLVMContext::MD_pcsections)) {}
 
 
   94  MDNode *PCSections = 
nullptr;
 
 
  127                                    unsigned SubReg = 0)
 const {
 
  128    assert((flags & 0x1) == 0 &&
 
  129           "Passing in 'true' to addReg is forbidden! Use enums instead.");
 
 
  146                                    unsigned SubReg = 0)
 const {
 
 
  153                                    unsigned SubReg = 0)
 const {
 
  155           "Misleading addUse defines register, use addReg instead.");
 
 
  176                                    unsigned TargetFlags = 0)
 const {
 
 
  188                       unsigned TargetFlags = 0)
 const {
 
 
  194                                          unsigned TargetFlags = 0)
 const {
 
 
  201                                               unsigned TargetFlags = 0)
 const {
 
 
  208                                              unsigned TargetFlags = 0)
 const {
 
 
  214                                               unsigned TargetFlags = 0)
 const {
 
 
  221                                             unsigned TargetFlags = 0)
 const {
 
 
  266    assert((MI->isDebugValueLike() ? 
static_cast<bool>(MI->getDebugVariable())
 
  268           "first MDNode argument of a DBG_VALUE not a variable");
 
  269    assert((MI->isDebugLabel() ? 
static_cast<bool>(MI->getDebugLabel())
 
  271           "first MDNode argument of a DBG_LABEL not a label");
 
 
  296                                    unsigned char TargetFlags = 0)
 const {
 
 
  318                                     unsigned char TargetFlags = 0)
 const {
 
  323    if (0 == TargetFlags)
 
  341        assert(off == 0 && 
"cannot create offset into jump tables");
 
 
 
  420  if (
I.isInsideBundle())
 
 
  460  if (
I.isInsideBundle())
 
 
  493                                     const MCInstrDesc &MCID, 
bool IsIndirect,
 
  500                                     const MCInstrDesc &MCID, 
bool IsIndirect,
 
  502                                     const MDNode *Variable,
 
  511                                     const MCInstrDesc &MCID, 
bool IsIndirect,
 
  520    const MDNode *Variable, 
const MDNode *Expr);
 
  525                                             const MachineInstr &Orig,
 
  529    const MachineInstr &Orig, 
int FrameIndex,
 
  530    const SmallVectorImpl<const MachineOperand *> &SpilledOperands);
 
  588      : MBB(BB), Begin(Pos.getInstrIterator()), End(Begin) {}
 
 
  593      : MBB(BB), Begin(
B.getInstrIterator()), End(
E.getInstrIterator()) {
 
  594    assert(
B != 
E && 
"No instructions to bundle");
 
 
  614  bool empty()
 const { 
return Begin == End; }
 
  629        MI->bundleWithSucc();
 
  630      Begin = 
MI->getIterator();
 
  634      MI->bundleWithPred();
 
 
 
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
 
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
 
static const Function * getParent(const Value *V)
 
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
 
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
 
const HexagonInstrInfo * TII
 
static DebugLoc getDebugLoc(MachineBasicBlock::instr_iterator FirstMI, MachineBasicBlock::instr_iterator LastMI)
Return the first found DebugLoc that has a DILocation, given a range of instructions.
 
Register const TargetRegisterInfo * TRI
 
Promote Memory to Register
 
MachineInstr unsigned OpIdx
 
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
 
The address of a basic block.
 
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
 
ConstantFP - Floating Point Values [float, double].
 
This is the shared class of boolean and integer constants.
 
This is an important class for using LLVM in a threaded context.
 
Describe properties that are true of each instruction in the target description file.
 
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
 
MachineBasicBlock::instr_iterator end() const
Return an iterator beyond the last bundled instruction.
 
MachineBasicBlock::instr_iterator begin() const
Return an iterator to the first bundled instruction.
 
MIBundleBuilder & append(MachineInstr *MI)
Insert MI into MBB by appending it to the instructions in the bundle.
 
MIBundleBuilder(MachineBasicBlock &BB, MachineBasicBlock::iterator B, MachineBasicBlock::iterator E)
Create a bundle from the sequence of instructions between B and E.
 
MIBundleBuilder(MachineBasicBlock &BB, MachineBasicBlock::iterator Pos)
Create an MIBundleBuilder that inserts instructions into a new bundle in BB above the bundle or instr...
 
MIBundleBuilder & insert(MachineBasicBlock::instr_iterator I, MachineInstr *MI)
Insert MI into this bundle before I which must point to an instruction in the bundle,...
 
MachineBasicBlock & getMBB() const
Return a reference to the basic block containing this bundle.
 
MIBundleBuilder & prepend(MachineInstr *MI)
Insert MI into MBB by prepending it to the instructions in the bundle.
 
bool empty() const
Return true if no instructions have been inserted in this bundle yet.
 
MIBundleBuilder(MachineInstr *MI)
Create an MIBundleBuilder representing an existing instruction or bundle that has MI as its head.
 
LLVM_ABI instr_iterator insert(instr_iterator I, MachineInstr *M)
Insert MI into the instruction list before I, possibly inside a bundle.
 
Instructions::iterator instr_iterator
 
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
 
MachineInstrBundleIterator< MachineInstr > iterator
 
const MachineInstrBuilder & cloneMergedMemRefs(ArrayRef< const MachineInstr * > OtherMIs) const
 
const MachineInstrBuilder & addTargetIndex(unsigned Idx, int64_t Offset=0, unsigned TargetFlags=0) const
 
Register getReg(unsigned Idx) const
Get the register for the operand index.
 
const MachineInstrBuilder & setMemRefs(ArrayRef< MachineMemOperand * > MMOs) const
 
const MachineInstrBuilder & addExternalSymbol(const char *FnName, unsigned TargetFlags=0) const
 
const MachineInstrBuilder & addCImm(const ConstantInt *Val) const
 
const MachineInstrBuilder & addCFIIndex(unsigned CFIIndex) const
 
const MachineInstrBuilder & setOperandDead(unsigned OpIdx) const
 
MachineInstrBuilder()=default
 
MachineInstrBuilder(MachineFunction &F, MachineInstr *I)
Create a MachineInstrBuilder for manipulating an existing instruction.
 
const MachineInstrBuilder & setMIFlag(MachineInstr::MIFlag Flag) const
 
MachineInstr * operator->() const
 
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
 
const MachineInstrBuilder & addPredicate(CmpInst::Predicate Pred) const
 
const MachineInstrBuilder & addBlockAddress(const BlockAddress *BA, int64_t Offset=0, unsigned TargetFlags=0) const
 
const MachineInstrBuilder & add(const MachineOperand &MO) const
 
const MachineInstrBuilder & addIntrinsicID(Intrinsic::ID ID) const
 
const MachineInstrBuilder & addMetadata(const MDNode *MD) const
 
const MachineInstrBuilder & addSym(MCSymbol *Sym, unsigned char TargetFlags=0) const
 
const MachineInstrBuilder & addShuffleMask(ArrayRef< int > Val) const
 
MachineInstrBuilder(MachineFunction &F, MachineBasicBlock::iterator I)
 
const MachineInstrBuilder & addFrameIndex(int Idx) const
 
const MachineInstrBuilder & addConstantPoolIndex(unsigned Idx, int Offset=0, unsigned TargetFlags=0) const
 
const MachineInstrBuilder & addRegMask(const uint32_t *Mask) const
 
const MachineInstrBuilder & add(ArrayRef< MachineOperand > MOs) const
 
const MachineInstrBuilder & addGlobalAddress(const GlobalValue *GV, int64_t Offset=0, unsigned TargetFlags=0) const
 
const MachineInstrBuilder & addDisp(const MachineOperand &Disp, int64_t off, unsigned char TargetFlags=0) const
 
const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
 
const MachineInstrBuilder & addFPImm(const ConstantFP *Val) const
 
bool constrainAllUses(const TargetInstrInfo &TII, const TargetRegisterInfo &TRI, const RegisterBankInfo &RBI) const
 
const MachineInstrBuilder & addJumpTableIndex(unsigned Idx, unsigned TargetFlags=0) const
 
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned TargetFlags=0) const
 
const MachineInstrBuilder & cloneMemRefs(const MachineInstr &OtherMI) const
 
const MachineInstrBuilder & addUse(Register RegNo, unsigned Flags=0, unsigned SubReg=0) const
Add a virtual register use operand.
 
const MachineInstrBuilder & setMIFlags(unsigned Flags) const
 
const MachineInstrBuilder & copyImplicitOps(const MachineInstr &OtherMI) const
Copy all the implicit operands from OtherMI onto this one.
 
const MachineInstrBuilder & addMemOperand(MachineMemOperand *MMO) const
 
MachineInstr * getInstr() const
If conversion operators fail, use this method to get the MachineInstr explicitly.
 
const MachineInstrBuilder & addDef(Register RegNo, unsigned Flags=0, unsigned SubReg=0) const
Add a virtual register definition operand.
 
const MachineInstrBuilder & copyMIMetadata(const MIMetadata &MIMD) const
 
Representation of each machine instruction.
 
void setFlags(unsigned flags)
 
LLVM_ABI void cloneMemRefs(MachineFunction &MF, const MachineInstr &MI)
Clone another MachineInstr's memory reference descriptor list and replace ours with it.
 
LLVM_ABI void addOperand(MachineFunction &MF, const MachineOperand &Op)
Add the specified operand to the instruction.
 
LLVM_ABI void setMemRefs(MachineFunction &MF, ArrayRef< MachineMemOperand * > MemRefs)
Assign this MachineInstr's memory reference descriptor list.
 
LLVM_ABI void copyImplicitOps(MachineFunction &MF, const MachineInstr &MI)
Copy implicit register operands from specified instruction to this instruction.
 
LLVM_ABI void cloneMergedMemRefs(MachineFunction &MF, ArrayRef< const MachineInstr * > MIs)
Clone the merge of multiple MachineInstrs' memory reference descriptors list and replace ours with it...
 
void setFlag(MIFlag Flag)
Set a MI flag.
 
const MachineOperand & getOperand(unsigned i) const
 
LLVM_ABI void setPCSections(MachineFunction &MF, MDNode *MD)
 
LLVM_ABI void addMemOperand(MachineFunction &MF, MachineMemOperand *MO)
Add a MachineMemOperand to the machine instruction.
 
A description of a memory reference used in the backend.
 
MachineOperand class - Representation of each machine instruction operand.
 
static MachineOperand CreateMCSymbol(MCSymbol *Sym, unsigned TargetFlags=0)
 
const GlobalValue * getGlobal() const
 
static MachineOperand CreateES(const char *SymName, unsigned TargetFlags=0)
 
static MachineOperand CreateFPImm(const ConstantFP *CFP)
 
static MachineOperand CreateCFIIndex(unsigned CFIIndex)
 
static MachineOperand CreateRegMask(const uint32_t *Mask)
CreateRegMask - Creates a register mask operand referencing Mask.
 
bool isReg() const
isReg - Tests if this is a MO_Register operand.
 
static MachineOperand CreateCImm(const ConstantInt *CI)
 
void setIsDead(bool Val=true)
 
LLVM_ABI bool isRenamable() const
isRenamable - Returns true if this register may be renamed, i.e.
 
static MachineOperand CreateMetadata(const MDNode *Meta)
 
const BlockAddress * getBlockAddress() const
 
static MachineOperand CreatePredicate(unsigned Pred)
 
unsigned getTargetFlags() const
 
static MachineOperand CreateImm(int64_t Val)
 
static MachineOperand CreateShuffleMask(ArrayRef< int > Mask)
 
MachineOperandType getType() const
getType - Returns the MachineOperandType for this operand.
 
static MachineOperand CreateJTI(unsigned Idx, unsigned TargetFlags=0)
 
Register getReg() const
getReg - Returns the register number.
 
static MachineOperand CreateGA(const GlobalValue *GV, int64_t Offset, unsigned TargetFlags=0)
 
bool isInternalRead() const
 
static MachineOperand CreateBA(const BlockAddress *BA, int64_t Offset, unsigned TargetFlags=0)
 
static MachineOperand CreateCPI(unsigned Idx, int Offset, unsigned TargetFlags=0)
 
@ MO_Immediate
Immediate operand.
 
@ MO_ConstantPoolIndex
Address of indexed Constant in Constant Pool.
 
@ MO_GlobalAddress
Address of a global value.
 
@ MO_BlockAddress
Address of a basic block.
 
@ MO_JumpTableIndex
Address of indexed Jump Table for switch.
 
static MachineOperand CreateReg(Register 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, bool isRenamable=false)
 
static MachineOperand CreateTargetIndex(unsigned Idx, int64_t Offset, unsigned TargetFlags=0)
 
static MachineOperand CreateMBB(MachineBasicBlock *MBB, unsigned TargetFlags=0)
 
int64_t getOffset() const
Return the offset from the symbol in this operand.
 
static MachineOperand CreateIntrinsicID(Intrinsic::ID ID)
 
static MachineOperand CreateFI(int Idx)
 
Holds all the information related to register banks.
 
Wrapper class representing virtual and physical registers.
 
constexpr bool isPhysical() const
Return true if the specified register number is in the physical register namespace.
 
TargetInstrInfo - Interface to description of machine instruction set.
 
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
 
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
 
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
 
@ Implicit
Not emitted register (e.g. carry, or temporary result).
 
@ Debug
Register 'use' is for debugging purpose.
 
@ Renamable
Register that may be renamed.
 
@ Define
Register definition.
 
@ InternalRead
Register reads a value that is defined inside the same instruction or bundle.
 
@ Kill
The last use of a register.
 
@ Undef
Value of the register doesn't matter.
 
@ EarlyClobber
Register definition happens before uses.
 
This is an optimization pass for GlobalISel generic memory operations.
 
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
 
LLVM_ABI void updateDbgValueForSpill(MachineInstr &Orig, int FrameIndex, Register Reg)
Update a DBG_VALUE whose value has been spilled to FrameIndex.
 
LLVM_ABI bool constrainSelectedInstRegOperands(MachineInstr &I, const TargetInstrInfo &TII, const TargetRegisterInfo &TRI, const RegisterBankInfo &RBI)
Mutate the newly-selected instruction I to constrain its (possibly generic) virtual register operands...
 
unsigned getDeadRegState(bool B)
 
unsigned getImplRegState(bool B)
 
MachineBasicBlock::instr_iterator getBundleEnd(MachineBasicBlock::instr_iterator I)
Returns an iterator pointing beyond the bundle containing I.
 
unsigned getInternalReadRegState(bool B)
 
unsigned getDebugRegState(bool B)
 
unsigned getUndefRegState(bool B)
 
unsigned getRegState(const MachineOperand &RegOp)
Get all register state flags from machine operand RegOp.
 
unsigned getDefRegState(bool B)
 
unsigned getKillRegState(bool B)
 
unsigned getRenamableRegState(bool B)
 
ArrayRef(const T &OneElt) -> ArrayRef< T >
 
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
 
LLVM_ABI MachineInstr * buildDbgValueForSpill(MachineBasicBlock &BB, MachineBasicBlock::iterator I, const MachineInstr &Orig, int FrameIndex, Register SpillReg)
Clone a DBG_VALUE whose value has been spilled to FrameIndex.
 
Implement std::hash so that hash_code can be used in STL containers.