|
LLVM
7.0.0
|
A CRTP class that contains methods for building instructions that can be constant folded. More...
#include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
Public Member Functions | |
| MachineInstrBuilder | buildAdd (unsigned Dst, unsigned Src0, unsigned Src1) |
Build and insert Res = G_ADD Op0, Op1. More... | |
| template<typename DstTy , typename... UseArgsTy> | |
| MachineInstrBuilder | buildAdd (DstTy &&Ty, UseArgsTy &&... UseArgs) |
| MachineInstrBuilder | buildSub (unsigned Dst, unsigned Src0, unsigned Src1) |
Build and insert Res = G_SUB Op0, Op1. More... | |
| template<typename DstTy , typename... UseArgsTy> | |
| MachineInstrBuilder | buildSub (DstTy &&Ty, UseArgsTy &&... UseArgs) |
| MachineInstrBuilder | buildMul (unsigned Dst, unsigned Src0, unsigned Src1) |
Build and insert Res = G_MUL Op0, Op1. More... | |
| template<typename DstTy , typename... UseArgsTy> | |
| MachineInstrBuilder | buildMul (DstTy &&Ty, UseArgsTy &&... UseArgs) |
| MachineInstrBuilder | buildAnd (unsigned Dst, unsigned Src0, unsigned Src1) |
Build and insert Res = G_AND Op0, Op1. More... | |
| template<typename DstTy , typename... UseArgsTy> | |
| MachineInstrBuilder | buildAnd (DstTy &&Ty, UseArgsTy &&... UseArgs) |
| MachineInstrBuilder | buildOr (unsigned Dst, unsigned Src0, unsigned Src1) |
Build and insert Res = G_OR Op0, Op1. More... | |
| template<typename DstTy , typename... UseArgsTy> | |
| MachineInstrBuilder | buildOr (DstTy &&Ty, UseArgsTy &&... UseArgs) |
Public Member Functions inherited from llvm::MachineIRBuilderBase | |
| MachineIRBuilderBase ()=default | |
| Some constructors for easy use. More... | |
| MachineIRBuilderBase (MachineFunction &MF) | |
| MachineIRBuilderBase (MachineInstr &MI) | |
| MachineIRBuilderBase (const MachineIRBuilderState &BState) | |
| MachineFunction & | getMF () |
| Getter for the function we currently build. More... | |
| const DebugLoc & | getDL () |
| Getter for DebugLoc. More... | |
| MachineRegisterInfo * | getMRI () |
| Getter for MRI. More... | |
| MachineIRBuilderState & | getState () |
| Getter for the State. More... | |
| MachineBasicBlock & | getMBB () |
| Getter for the basic block we currently build. More... | |
| MachineBasicBlock::iterator | getInsertPt () |
| Current insertion point for new instructions. More... | |
| void | setInsertPt (MachineBasicBlock &MBB, MachineBasicBlock::iterator II) |
| Set the insertion point before the specified position. More... | |
| void | setDebugLoc (const DebugLoc &DL) |
Set the debug location to DL for all the next build instructions. More... | |
| DebugLoc | getDebugLoc () |
| Get the current instruction's debug location. More... | |
| MachineInstrBuilder | buildInstr (unsigned Opcode) |
Build and insert <empty> = Opcode <empty>. More... | |
| MachineInstrBuilder | buildInstrNoInsert (unsigned Opcode) |
Build but don't insert <empty> = Opcode <empty>. More... | |
| MachineInstrBuilder | insertInstr (MachineInstrBuilder MIB) |
| Insert an existing instruction at the insertion point. More... | |
| MachineInstrBuilder | buildDirectDbgValue (unsigned Reg, const MDNode *Variable, const MDNode *Expr) |
Build and insert a DBG_VALUE instruction expressing the fact that the associated Variable lives in Reg (suitably modified by Expr). More... | |
| MachineInstrBuilder | buildIndirectDbgValue (unsigned Reg, const MDNode *Variable, const MDNode *Expr) |
Build and insert a DBG_VALUE instruction expressing the fact that the associated Variable lives in memory at Reg (suitably modified by Expr). More... | |
| MachineInstrBuilder | buildFIDbgValue (int FI, const MDNode *Variable, const MDNode *Expr) |
Build and insert a DBG_VALUE instruction expressing the fact that the associated Variable lives in the stack slot specified by FI (suitably modified by Expr). More... | |
| MachineInstrBuilder | buildConstDbgValue (const Constant &C, const MDNode *Variable, const MDNode *Expr) |
Build and insert a DBG_VALUE instructions specifying that Variable is given by C (suitably modified by Expr). More... | |
| MachineInstrBuilder | buildFrameIndex (unsigned Res, int Idx) |
Build and insert Res = G_FRAME_INDEX Idx. More... | |
| MachineInstrBuilder | buildGlobalValue (unsigned Res, const GlobalValue *GV) |
Build and insert Res = G_GLOBAL_VALUE GV. More... | |
| MachineInstrBuilder | buildGEP (unsigned Res, unsigned Op0, unsigned Op1) |
Build and insert Res = G_GEP Op0, Op1. More... | |
| Optional< MachineInstrBuilder > | materializeGEP (unsigned &Res, unsigned Op0, const LLT &ValueTy, uint64_t Value) |
Materialize and insert Res = G_GEP Op0, (G_CONSTANT Value) More... | |
| MachineInstrBuilder | buildPtrMask (unsigned Res, unsigned Op0, uint32_t NumBits) |
Build and insert Res = G_PTR_MASK Op0, NumBits. More... | |
| MachineInstrBuilder | buildUAdde (unsigned Res, unsigned CarryOut, unsigned Op0, unsigned Op1, unsigned CarryIn) |
Build and insert Res, CarryOut = G_UADDE Op0, Op1, CarryIn. More... | |
| MachineInstrBuilder | buildAnyExt (unsigned Res, unsigned Op) |
Build and insert Res = G_ANYEXT Op0. More... | |
| template<typename DstType , typename ArgType > | |
| MachineInstrBuilder | buildAnyExt (DstType &&Res, ArgType &&Arg) |
| template<typename DstType , typename ArgType > | |
| MachineInstrBuilder | buildSExt (DstType &&Res, ArgType &&Arg) |
Build and insert Res = G_SEXT Op. More... | |
| MachineInstrBuilder | buildSExt (unsigned Res, unsigned Op) |
| template<typename DstType , typename ArgType > | |
| MachineInstrBuilder | buildZExt (DstType &&Res, ArgType &&Arg) |
Build and insert Res = G_ZEXT Op. More... | |
| MachineInstrBuilder | buildZExt (unsigned Res, unsigned Op) |
| template<typename DstTy , typename UseArgTy > | |
| MachineInstrBuilder | buildSExtOrTrunc (DstTy &&Dst, UseArgTy &&Use) |
Build and insert Res = G_SEXT Op, Res = G_TRUNC Op, or Res = COPY Op depending on the differing sizes of Res and Op. More... | |
| MachineInstrBuilder | buildSExtOrTrunc (unsigned Res, unsigned Op) |
| template<typename DstTy , typename UseArgTy > | |
| MachineInstrBuilder | buildZExtOrTrunc (DstTy &&Dst, UseArgTy &&Use) |
Build and insert Res = G_ZEXT Op, Res = G_TRUNC Op, or Res = COPY Op depending on the differing sizes of Res and Op. More... | |
| MachineInstrBuilder | buildZExtOrTrunc (unsigned Res, unsigned Op) |
| template<typename DstTy , typename UseArgTy > | |
| MachineInstrBuilder | buildAnyExtOrTrunc (DstTy &&Dst, UseArgTy &&Use) |
Res = COPY Op depending on the differing sizes of Res and Op. More... | |
| MachineInstrBuilder | buildAnyExtOrTrunc (unsigned Res, unsigned Op) |
| MachineInstrBuilder | buildExtOrTrunc (unsigned ExtOpc, unsigned Res, unsigned Op) |
Build and insert Res = ExtOpc, Res = G_TRUNC Op, or Res = COPY Op depending on the differing sizes of Res and Op. More... | |
| template<typename DstType , typename ArgType > | |
| MachineInstrBuilder | buildCast (DstType &&Res, ArgType &&Arg) |
| Build and insert an appropriate cast between two registers of equal size. More... | |
| MachineInstrBuilder | buildCast (unsigned Dst, unsigned Src) |
| MachineInstrBuilder | buildBr (MachineBasicBlock &Dest) |
Build and insert G_BR Dest. More... | |
| MachineInstrBuilder | buildBrCond (unsigned Tst, MachineBasicBlock &Dest) |
Build and insert G_BRCOND Tst, Dest. More... | |
| MachineInstrBuilder | buildBrIndirect (unsigned Tgt) |
Build and insert G_BRINDIRECT Tgt. More... | |
| MachineInstrBuilder | buildConstant (unsigned Res, const ConstantInt &Val) |
Build and insert Res = G_CONSTANT Val. More... | |
| MachineInstrBuilder | buildConstant (unsigned Res, int64_t Val) |
Build and insert Res = G_CONSTANT Val. More... | |
| template<typename DstType > | |
| MachineInstrBuilder | buildConstant (DstType &&Res, int64_t Val) |
| template<typename DstType > | |
| MachineInstrBuilder | buildFConstant (DstType &&Res, const ConstantFP &Val) |
Build and insert Res = G_FCONSTANT Val. More... | |
| MachineInstrBuilder | buildFConstant (unsigned Res, const ConstantFP &Val) |
| template<typename DstType > | |
| MachineInstrBuilder | buildFConstant (DstType &&Res, double Val) |
| MachineInstrBuilder | buildFConstant (unsigned Res, double Val) |
| MachineInstrBuilder | buildCopy (unsigned Res, unsigned Op) |
Build and insert Res = COPY Op. More... | |
| template<typename DstType , typename SrcType > | |
| MachineInstrBuilder | buildCopy (DstType &&Res, SrcType &&Src) |
| MachineInstrBuilder | buildLoad (unsigned Res, unsigned Addr, MachineMemOperand &MMO) |
Build and insert Res = G_LOAD Addr, MMO. More... | |
| MachineInstrBuilder | buildLoadInstr (unsigned Opcode, unsigned Res, unsigned Addr, MachineMemOperand &MMO) |
Build and insert Res = <opcode> Addr, MMO. More... | |
| MachineInstrBuilder | buildStore (unsigned Val, unsigned Addr, MachineMemOperand &MMO) |
Build and insert G_STORE Val, Addr, MMO. More... | |
| MachineInstrBuilder | buildExtract (unsigned Res, unsigned Src, uint64_t Index) |
| Build and insert `Res0, ... More... | |
| template<typename DstType > | |
| MachineInstrBuilder | buildUndef (DstType &&Res) |
Build and insert Res = IMPLICIT_DEF. More... | |
| MachineInstrBuilder | buildUndef (unsigned Res) |
| void | buildSequence (unsigned Res, ArrayRef< unsigned > Ops, ArrayRef< uint64_t > Indices) |
Build and insert instructions to put Ops together at the specified p Indices to form a larger register. More... | |
| MachineInstrBuilder | buildMerge (unsigned Res, ArrayRef< unsigned > Ops) |
Build and insert Res = G_MERGE_VALUES Op0, ... More... | |
| MachineInstrBuilder | buildUnmerge (ArrayRef< unsigned > Res, unsigned Op) |
Build and insert Res0, ... More... | |
| MachineInstrBuilder | buildInsert (unsigned Res, unsigned Src, unsigned Op, unsigned Index) |
| MachineInstrBuilder | buildIntrinsic (Intrinsic::ID ID, unsigned Res, bool HasSideEffects) |
Build and insert either a G_INTRINSIC (if HasSideEffects is false) or G_INTRINSIC_W_SIDE_EFFECTS instruction. More... | |
| template<typename DstType , typename SrcType > | |
| MachineInstrBuilder | buildFPTrunc (DstType &&Res, SrcType &&Src) |
Build and insert Res = G_FPTRUNC Op. More... | |
| MachineInstrBuilder | buildFPTrunc (unsigned Res, unsigned Op) |
| MachineInstrBuilder | buildTrunc (unsigned Res, unsigned Op) |
Build and insert Res = G_TRUNC Op. More... | |
| template<typename DstType , typename SrcType > | |
| MachineInstrBuilder | buildTrunc (DstType &&Res, SrcType &&Src) |
| MachineInstrBuilder | buildICmp (CmpInst::Predicate Pred, unsigned Res, unsigned Op0, unsigned Op1) |
Build and insert a Res = G_ICMP Pred, Op0, Op1. More... | |
| MachineInstrBuilder | buildFCmp (CmpInst::Predicate Pred, unsigned Res, unsigned Op0, unsigned Op1) |
Build and insert a Res = G_FCMP Pred Op1. More... | |
| MachineInstrBuilder | buildSelect (unsigned Res, unsigned Tst, unsigned Op0, unsigned Op1) |
Build and insert a Res = G_SELECT Tst, Op0, Op1. More... | |
| MachineInstrBuilder | buildInsertVectorElement (unsigned Res, unsigned Val, unsigned Elt, unsigned Idx) |
Build and insert Res = G_INSERT_VECTOR_ELT Val, Elt, Idx. More... | |
| MachineInstrBuilder | buildExtractVectorElement (unsigned Res, unsigned Val, unsigned Idx) |
Build and insert Res = G_EXTRACT_VECTOR_ELT Val, Idx. More... | |
| MachineInstrBuilder | buildAtomicCmpXchgWithSuccess (unsigned OldValRes, unsigned SuccessRes, unsigned Addr, unsigned CmpVal, unsigned NewVal, MachineMemOperand &MMO) |
Build and insert OldValRes<def>, SuccessRes<def> = G_ATOMIC_CMPXCHG_WITH_SUCCESS Addr, CmpVal, NewVal, MMO. More... | |
| MachineInstrBuilder | buildAtomicCmpXchg (unsigned OldValRes, unsigned Addr, unsigned CmpVal, unsigned NewVal, MachineMemOperand &MMO) |
Build and insert OldValRes<def> = G_ATOMIC_CMPXCHG Addr, CmpVal, NewVal, MMO. More... | |
| MachineInstrBuilder | buildAtomicRMW (unsigned Opcode, unsigned OldValRes, unsigned Addr, unsigned Val, MachineMemOperand &MMO) |
Build and insert OldValRes<def> = G_ATOMICRMW_<Opcode> Addr, Val, MMO. More... | |
| MachineInstrBuilder | buildAtomicRMWXchg (unsigned OldValRes, unsigned Addr, unsigned Val, MachineMemOperand &MMO) |
Build and insert OldValRes<def> = G_ATOMICRMW_XCHG Addr, Val, MMO. More... | |
| MachineInstrBuilder | buildAtomicRMWAdd (unsigned OldValRes, unsigned Addr, unsigned Val, MachineMemOperand &MMO) |
Build and insert OldValRes<def> = G_ATOMICRMW_ADD Addr, Val, MMO. More... | |
| MachineInstrBuilder | buildAtomicRMWSub (unsigned OldValRes, unsigned Addr, unsigned Val, MachineMemOperand &MMO) |
Build and insert OldValRes<def> = G_ATOMICRMW_SUB Addr, Val, MMO. More... | |
| MachineInstrBuilder | buildAtomicRMWAnd (unsigned OldValRes, unsigned Addr, unsigned Val, MachineMemOperand &MMO) |
Build and insert OldValRes<def> = G_ATOMICRMW_AND Addr, Val, MMO. More... | |
| MachineInstrBuilder | buildAtomicRMWNand (unsigned OldValRes, unsigned Addr, unsigned Val, MachineMemOperand &MMO) |
Build and insert OldValRes<def> = G_ATOMICRMW_NAND Addr, Val, MMO. More... | |
| MachineInstrBuilder | buildAtomicRMWOr (unsigned OldValRes, unsigned Addr, unsigned Val, MachineMemOperand &MMO) |
Build and insert OldValRes<def> = G_ATOMICRMW_OR Addr, Val, MMO. More... | |
| MachineInstrBuilder | buildAtomicRMWXor (unsigned OldValRes, unsigned Addr, unsigned Val, MachineMemOperand &MMO) |
Build and insert OldValRes<def> = G_ATOMICRMW_XOR Addr, Val, MMO. More... | |
| MachineInstrBuilder | buildAtomicRMWMax (unsigned OldValRes, unsigned Addr, unsigned Val, MachineMemOperand &MMO) |
Build and insert OldValRes<def> = G_ATOMICRMW_MAX Addr, Val, MMO. More... | |
| MachineInstrBuilder | buildAtomicRMWMin (unsigned OldValRes, unsigned Addr, unsigned Val, MachineMemOperand &MMO) |
Build and insert OldValRes<def> = G_ATOMICRMW_MIN Addr, Val, MMO. More... | |
| MachineInstrBuilder | buildAtomicRMWUmax (unsigned OldValRes, unsigned Addr, unsigned Val, MachineMemOperand &MMO) |
Build and insert OldValRes<def> = G_ATOMICRMW_UMAX Addr, Val, MMO. More... | |
| MachineInstrBuilder | buildAtomicRMWUmin (unsigned OldValRes, unsigned Addr, unsigned Val, MachineMemOperand &MMO) |
Build and insert OldValRes<def> = G_ATOMICRMW_UMIN Addr, Val, MMO. More... | |
| MachineInstrBuilder | buildBlockAddress (unsigned Res, const BlockAddress *BA) |
Build and insert Res = G_BLOCK_ADDR BA. More... | |
| void | setMF (MachineFunction &) |
| void | setMBB (MachineBasicBlock &MBB) |
Set the insertion point to the end of MBB. More... | |
| void | setInstr (MachineInstr &MI) |
| Set the insertion point to before MI. More... | |
| void | recordInsertion (MachineInstr *InsertedInstr) const |
| void | recordInsertions (std::function< void(MachineInstr *)> InsertedInstr) |
| void | stopRecordingInsertions () |
Additional Inherited Members | |
Protected Member Functions inherited from llvm::MachineIRBuilderBase | |
| unsigned | getDestFromArg (unsigned Reg) |
| unsigned | getDestFromArg (LLT Ty) |
| unsigned | getDestFromArg (const TargetRegisterClass *RC) |
| void | addUseFromArg (MachineInstrBuilder &MIB, unsigned Reg) |
| void | addUseFromArg (MachineInstrBuilder &MIB, const MachineInstrBuilder &UseMIB) |
| void | addUsesFromArgs (MachineInstrBuilder &MIB) |
| template<typename UseArgTy , typename ... UseArgsTy> | |
| void | addUsesFromArgs (MachineInstrBuilder &MIB, UseArgTy &&Arg1, UseArgsTy &&... Args) |
| unsigned | getRegFromArg (unsigned Reg) |
| unsigned | getRegFromArg (const MachineInstrBuilder &MIB) |
| void | validateBinaryOp (unsigned Res, unsigned Op0, unsigned Op1) |
A CRTP class that contains methods for building instructions that can be constant folded.
MachineIRBuilders that want to inherit from this will need to implement buildBinaryOp (for constant folding binary ops). Alternatively, they can implement buildInstr(Opc, Dst, Uses...) to perform additional folding for Opc.
Definition at line 963 of file MachineIRBuilder.h.
|
inline |
Build and insert Res = G_ADD Op0, Op1.
G_ADD sets Res to the sum of integer parameters Op0 and Op1, truncated to their width.
Res, Op0 and Op1 must be generic virtual registers with the same (scalar or vector) type).Definition at line 979 of file MachineIRBuilder.h.
Referenced by llvm::LegalizerHelper::fewerElementsVector().
|
inline |
Definition at line 983 of file MachineIRBuilder.h.
|
inline |
Build and insert Res = G_AND Op0, Op1.
G_AND sets Res to the bitwise and of integer parameters Op0 and Op1.
Res, Op0 and Op1 must be generic virtual registers with the same (scalar or vector) type).Definition at line 1038 of file MachineIRBuilder.h.
Referenced by llvm::LegalizationArtifactCombiner::tryCombineZExt().
|
inline |
Definition at line 1042 of file MachineIRBuilder.h.
|
inline |
Build and insert Res = G_MUL Op0, Op1.
G_MUL sets Res to the sum of integer parameters Op0 and Op1, truncated to their width.
Res, Op0 and Op1 must be generic virtual registers with the same (scalar or vector) type).Definition at line 1018 of file MachineIRBuilder.h.
Referenced by getOffsetFromIndices(), and llvm::LegalizerHelper::lower().
|
inline |
Definition at line 1022 of file MachineIRBuilder.h.
|
inline |
Build and insert Res = G_OR Op0, Op1.
G_OR sets Res to the bitwise or of integer parameters Op0 and Op1.
Res, Op0 and Op1 must be generic virtual registers with the same (scalar or vector) type).Definition at line 1057 of file MachineIRBuilder.h.
Referenced by llvm::ARMLegalizerInfo::legalizeCustom(), and llvm::LegalizerHelper::narrowScalar().
|
inline |
Definition at line 1061 of file MachineIRBuilder.h.
|
inline |
Build and insert Res = G_SUB Op0, Op1.
G_SUB sets Res to the sum of integer parameters Op0 and Op1, truncated to their width.
Res, Op0 and Op1 must be generic virtual registers with the same (scalar or vector) type).Definition at line 999 of file MachineIRBuilder.h.
Referenced by llvm::LegalizerHelper::lower().
|
inline |
Definition at line 1003 of file MachineIRBuilder.h.
1.8.13