LLVM: llvm::CSEMIRBuilder Class Reference (original) (raw)
Defines a builder that does CSE of MachineInstructions using GISelCSEInfo. More...
Public Member Functions
buildInstr (unsigned Opc, ArrayRef< DstOp > DstOps, ArrayRef< SrcOp > SrcOps, std::optional< unsigned > Flag=std::nullopt) override
buildConstant (const DstOp &Res, const ConstantInt &Val) override
Build and insert Res = G_CONSTANT Val.
buildFConstant (const DstOp &Res, const ConstantFP &Val) override
Build and insert Res = G_FCONSTANT Val.
MachineIRBuilder ()=default
Some constructors for easy use.
MachineIRBuilder (MachineFunction &MF)
MachineIRBuilder (MachineBasicBlock &MBB, MachineBasicBlock::iterator InsPt)
MachineIRBuilder (MachineInstr &MI)
MachineIRBuilder (MachineInstr &MI, GISelChangeObserver &Observer)
MachineIRBuilder (const MachineIRBuilderState &BState)
buildConstant (const DstOp &Res, int64_t Val)
Build and insert Res = G_CONSTANT Val.
buildConstant (const DstOp &Res, const APInt &Val)
buildFConstant (const DstOp &Res, double Val)
buildFConstant (const DstOp &Res, const APFloat &Val)
Public Member Functions inherited from llvm::MachineIRBuilder
MachineIRBuilder ()=default
Some constructors for easy use.
MachineIRBuilder (MachineFunction &MF)
MachineIRBuilder (MachineBasicBlock &MBB, MachineBasicBlock::iterator InsPt)
MachineIRBuilder (MachineInstr &MI)
MachineIRBuilder (MachineInstr &MI, GISelChangeObserver &Observer)
virtual
~MachineIRBuilder ()=default
MachineIRBuilder (const MachineIRBuilderState &BState)
getTII ()
getMF ()
Getter for the function we currently build.
getContext () const
getDL ()
Getter for DebugLoc.
getMRI ()
Getter for MRI.
getState ()
Getter for the State.
void
setState (const MachineIRBuilderState &NewState)
Setter for the State.
Getter for the basic block we currently build.
getMBB ()
getCSEInfo ()
getCSEInfo () const
getInsertPt ()
Current insertion point for new instructions.
void
setInsertPt (MachineBasicBlock &MBB, MachineBasicBlock::iterator II)
Set the insertion point before the specified position.
void
setCSEInfo (GISelCSEInfo *Info)
void
setInstrAndDebugLoc (MachineInstr &MI)
Set the insertion point to before MI, and set the debug loc to MI's loc.
void
setChangeObserver (GISelChangeObserver &Observer)
getObserver ()
void
void
setDebugLoc (const DebugLoc &DL)
Set the debug location to DL for all the next build instructions.
getDebugLoc ()
Get the current instruction's debug location.
void
setPCSections (MDNode *MD)
Set the PC sections metadata to MD for all the next build instructions.
MDNode *
Get the current instruction's PC sections metadata.
void
setMMRAMetadata (MDNode *MMRA)
Set the PC sections metadata to MD for all the next build instructions.
Value *
void
setDeactivationSymbol (Value *DS)
MDNode *
Get the current instruction's MMRA metadata.
buildInstr (unsigned Opcode)
Build and insert = Opcode .
buildInstrNoInsert (unsigned Opcode)
Build but don't insert = Opcode .
insertInstr (MachineInstrBuilder MIB)
Insert an existing instruction at the insertion point.
buildDirectDbgValue (Register 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).
buildIndirectDbgValue (Register 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).
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).
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).
buildDbgLabel (const MDNode *Label)
Build and insert a DBG_LABEL instructions specifying that Label is given.
buildDynStackAlloc (const DstOp &Res, const SrcOp &Size, Align Alignment)
Build and insert Res = G_DYN_STACKALLOC Size, [Align](structllvm%5F1%5F1Align.html "This struct is a compact representation of a valid (non-zero power of two) alignment.").
buildFrameIndex (const DstOp &Res, int Idx)
Build and insert Res = G_FRAME_INDEX Idx.
buildGlobalValue (const DstOp &Res, const GlobalValue *GV)
Build and insert Res = G_GLOBAL_VALUE GV.
buildConstantPool (const DstOp &Res, unsigned Idx)
Build and insert Res = G_CONSTANT_POOL Idx.
buildPtrAdd (const DstOp &Res, const SrcOp &Op0, const SrcOp &Op1, std::optional< unsigned > Flags=std::nullopt)
Build and insert Res = G_PTR_ADD Op0, Op1.
buildObjectPtrOffset (const DstOp &Res, const SrcOp &Op0, const SrcOp &Op1)
Build and insert an instruction with appropriate flags for addressing some offset of an object, i.e.: Res = nuw inbounds G_PTR_ADD Op0, Op1 The value of Op0 must be a pointer into or just after an object, adding the value of Op1 to it must yield to a pointer into or just after the same object.
std::optional< MachineInstrBuilder >
materializePtrAdd (Register &Res, Register Op0, const LLT ValueTy, uint64_t Value, std::optional< unsigned > Flags=std::nullopt)
Materialize and insert Res = G_PTR_ADD Op0, (G_CONSTANT [Value](classllvm%5F1%5F1Value.html "LLVM Value Representation."))
std::optional< MachineInstrBuilder >
materializeObjectPtrOffset (Register &Res, Register Op0, const LLT ValueTy, uint64_t Value)
Materialize and insert an instruction with appropriate flags for addressing some offset of an object, i.e.: Res = nuw inbounds G_PTR_ADD Op0, (G_CONSTANT [Value](classllvm%5F1%5F1Value.html "LLVM Value Representation.")) The value of Op0 must be a pointer into or just after an object, adding [Value](classllvm%5F1%5F1Value.html "LLVM Value Representation.") to it must yield to a pointer into or just after the same object.
buildPtrMask (const DstOp &Res, const SrcOp &Op0, const SrcOp &Op1)
Build and insert Res = G_PTRMASK Op0, Op1.
buildMaskLowPtrBits (const DstOp &Res, const SrcOp &Op0, uint32_t NumBits)
Build and insert Res = G_PTRMASK Op0, G_CONSTANT (1 << NumBits) - 1.
buildPadVectorWithUndefElements (const DstOp &Res, const SrcOp &Op0)
Build and insert a, b, ..., x = G_UNMERGE_VALUES Op0 Res = G_BUILD_VECTOR a, b, ..., x, undef, ..., undef.
buildDeleteTrailingVectorElements (const DstOp &Res, const SrcOp &Op0)
Build and insert a, b, ..., x, y, z = G_UNMERGE_VALUES Op0 Res = G_BUILD_VECTOR a, b, ..., x.
buildUAddo (const DstOp &Res, const DstOp &CarryOut, const SrcOp &Op0, const SrcOp &Op1)
Build and insert Res, CarryOut = G_UADDO Op0, Op1.
buildUSubo (const DstOp &Res, const DstOp &CarryOut, const SrcOp &Op0, const SrcOp &Op1)
Build and insert Res, CarryOut = G_USUBO Op0, Op1.
buildSAddo (const DstOp &Res, const DstOp &CarryOut, const SrcOp &Op0, const SrcOp &Op1)
Build and insert Res, CarryOut = G_SADDO Op0, Op1.
buildSSubo (const DstOp &Res, const DstOp &CarryOut, const SrcOp &Op0, const SrcOp &Op1)
Build and insert Res, CarryOut = G_SUBO Op0, Op1.
buildUAdde (const DstOp &Res, const DstOp &CarryOut, const SrcOp &Op0, const SrcOp &Op1, const SrcOp &CarryIn)
Build and insert Res, CarryOut = G_UADDE Op0, Op1, CarryIn.
buildUSube (const DstOp &Res, const DstOp &CarryOut, const SrcOp &Op0, const SrcOp &Op1, const SrcOp &CarryIn)
Build and insert Res, CarryOut = G_USUBE Op0, Op1, CarryInp.
buildSAdde (const DstOp &Res, const DstOp &CarryOut, const SrcOp &Op0, const SrcOp &Op1, const SrcOp &CarryIn)
Build and insert Res, CarryOut = G_SADDE Op0, Op1, CarryInp.
buildSSube (const DstOp &Res, const DstOp &CarryOut, const SrcOp &Op0, const SrcOp &Op1, const SrcOp &CarryIn)
Build and insert Res, CarryOut = G_SSUBE Op0, Op1, CarryInp.
buildAnyExt (const DstOp &Res, const SrcOp &Op)
Build and insert Res = G_ANYEXT Op0.
buildSExt (const DstOp &Res, const SrcOp &Op)
Build and insert Res = G_SEXT [Op](namespacellvm.html#ab471937b9a227e70c7fe8bd9604014d6).
buildSExtInReg (const DstOp &Res, const SrcOp &Op, int64_t ImmOp)
Build and insert Res = G_SEXT_INREG [Op](namespacellvm.html#ab471937b9a227e70c7fe8bd9604014d6), ImmOp.
buildFPExt (const DstOp &Res, const SrcOp &Op, std::optional< unsigned > Flags=std::nullopt)
Build and insert Res = G_FPEXT [Op](namespacellvm.html#ab471937b9a227e70c7fe8bd9604014d6).
buildPtrToInt (const DstOp &Dst, const SrcOp &Src)
Build and insert a G_PTRTOINT instruction.
buildIntToPtr (const DstOp &Dst, const SrcOp &Src)
Build and insert a G_INTTOPTR instruction.
buildBitcast (const DstOp &Dst, const SrcOp &Src)
Build and insert Dst = G_BITCAST Src.
buildAddrSpaceCast (const DstOp &Dst, const SrcOp &Src)
Build and insert Dst = G_ADDRSPACE_CAST Src.
getBoolExtOp (bool IsVec, bool IsFP) const
buildBoolExt (const DstOp &Res, const SrcOp &Op, bool IsFP)
buildBoolExtInReg (const DstOp &Res, const SrcOp &Op, bool IsVector, bool IsFP)
buildZExt (const DstOp &Res, const SrcOp &Op, std::optional< unsigned > Flags=std::nullopt)
Build and insert Res = G_ZEXT [Op](namespacellvm.html#ab471937b9a227e70c7fe8bd9604014d6).
buildSExtOrTrunc (const DstOp &Res, const SrcOp &Op)
Build and insert Res = G_SEXT [Op](namespacellvm.html#ab471937b9a227e70c7fe8bd9604014d6), Res = G_TRUNC [Op](namespacellvm.html#ab471937b9a227e70c7fe8bd9604014d6), or Res = COPY [Op](namespacellvm.html#ab471937b9a227e70c7fe8bd9604014d6) depending on the differing sizes of Res and [Op](namespacellvm.html#ab471937b9a227e70c7fe8bd9604014d6).
buildZExtOrTrunc (const DstOp &Res, const SrcOp &Op)
Build and insert Res = G_ZEXT [Op](namespacellvm.html#ab471937b9a227e70c7fe8bd9604014d6), Res = G_TRUNC [Op](namespacellvm.html#ab471937b9a227e70c7fe8bd9604014d6), or Res = COPY [Op](namespacellvm.html#ab471937b9a227e70c7fe8bd9604014d6) depending on the differing sizes of Res and [Op](namespacellvm.html#ab471937b9a227e70c7fe8bd9604014d6).
buildAnyExtOrTrunc (const DstOp &Res, const SrcOp &Op)
Res = COPY [Op](namespacellvm.html#ab471937b9a227e70c7fe8bd9604014d6) depending on the differing sizes of Res and [Op](namespacellvm.html#ab471937b9a227e70c7fe8bd9604014d6).
buildExtOrTrunc (unsigned ExtOpc, const DstOp &Res, const SrcOp &Op)
Build and insert Res = ExtOpc, Res = G_TRUNC [Op](namespacellvm.html#ab471937b9a227e70c7fe8bd9604014d6), or Res = COPY [Op](namespacellvm.html#ab471937b9a227e70c7fe8bd9604014d6) depending on the differing sizes of Res and [Op](namespacellvm.html#ab471937b9a227e70c7fe8bd9604014d6).
buildZExtInReg (const DstOp &Res, const SrcOp &Op, int64_t ImmOp)
Build and inserts Res = G_AND [Op](namespacellvm.html#ab471937b9a227e70c7fe8bd9604014d6), LowBitsSet(ImmOp) Since there is no G_ZEXT_INREG like G_SEXT_INREG, the instruction is emulated using G_AND.
buildTruncSSatS (const DstOp &Res, const SrcOp &Op)
Build and insert Res = G_TRUNC_SSAT_S [Op](namespacellvm.html#ab471937b9a227e70c7fe8bd9604014d6).
buildTruncSSatU (const DstOp &Res, const SrcOp &Op)
Build and insert Res = G_TRUNC_SSAT_U [Op](namespacellvm.html#ab471937b9a227e70c7fe8bd9604014d6).
buildTruncUSatU (const DstOp &Res, const SrcOp &Op)
Build and insert Res = G_TRUNC_USAT_U [Op](namespacellvm.html#ab471937b9a227e70c7fe8bd9604014d6).
buildCast (const DstOp &Dst, const SrcOp &Src)
Build and insert an appropriate cast between two registers of equal size.
buildBr (MachineBasicBlock &Dest)
Build and insert G_BR Dest.
buildBrCond (const SrcOp &Tst, MachineBasicBlock &Dest)
Build and insert G_BRCOND Tst, Dest.
buildBrIndirect (Register Tgt)
Build and insert G_BRINDIRECT Tgt.
buildBrJT (Register TablePtr, unsigned JTI, Register IndexReg)
Build and insert G_BRJT TablePtr, JTI, IndexReg.
buildConstant (const DstOp &Res, int64_t Val)
Build and insert Res = G_CONSTANT Val.
buildConstant (const DstOp &Res, const APInt &Val)
buildFConstant (const DstOp &Res, double Val)
buildFConstant (const DstOp &Res, const APFloat &Val)
buildConstantPtrAuth (const DstOp &Res, const ConstantPtrAuth *CPA, Register Addr, Register AddrDisc)
Build and insert G_PTRAUTH_GLOBAL_VALUE.
buildCopy (const DstOp &Res, const SrcOp &Op)
Build and insert Res = COPY Op.
buildAssertInstr (unsigned Opc, const DstOp &Res, const SrcOp &Op, unsigned Val)
Build and insert G_ASSERT_SEXT, G_ASSERT_ZEXT, or G_ASSERT_ALIGN.
buildAssertZExt (const DstOp &Res, const SrcOp &Op, unsigned Size)
Build and insert Res = G_ASSERT_ZEXT Op, Size.
buildAssertSExt (const DstOp &Res, const SrcOp &Op, unsigned Size)
Build and insert Res = G_ASSERT_SEXT Op, Size.
buildAssertAlign (const DstOp &Res, const SrcOp &Op, Align AlignVal)
Build and insert Res = G_ASSERT_ALIGN Op, AlignVal.
buildLoad (const DstOp &Res, const SrcOp &Addr, MachineMemOperand &MMO)
Build and insert Res = G_LOAD Addr, MMO.
buildLoad (const DstOp &Res, const SrcOp &Addr, MachinePointerInfo PtrInfo, Align Alignment, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
Build and insert a G_LOAD instruction, while constructing the MachineMemOperand.
buildLoadInstr (unsigned Opcode, const DstOp &Res, const SrcOp &Addr, MachineMemOperand &MMO)
Build and insert Res = Addr, MMO.
buildLoadFromOffset (const DstOp &Dst, const SrcOp &BasePtr, MachineMemOperand &BaseMMO, int64_t Offset)
Helper to create a load from a constant offset given a base address.
buildStore (const SrcOp &Val, const SrcOp &Addr, MachineMemOperand &MMO)
Build and insert G_STORE Val, Addr, MMO.
buildStore (const SrcOp &Val, const SrcOp &Addr, MachinePointerInfo PtrInfo, Align Alignment, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
Build and insert a G_STORE instruction, while constructing the MachineMemOperand.
buildExtract (const DstOp &Res, const SrcOp &Src, uint64_t Index)
Build and insert Res0, ... = G_EXTRACT Src, Idx0.
buildUndef (const DstOp &Res)
Build and insert Res = IMPLICIT_DEF.
buildMergeValues (const DstOp &Res, ArrayRef< Register > Ops)
Build and insert Res = G_MERGE_VALUES Op0, ...
buildMergeLikeInstr (const DstOp &Res, ArrayRef< Register > Ops)
Build and insert Res = G_MERGE_VALUES Op0, ... or Res = G_BUILD_VECTOR Op0, ... or Res = G_CONCAT_VECTORS Op0, ...
buildMergeLikeInstr (const DstOp &Res, std::initializer_list< SrcOp > Ops)
buildUnmerge (ArrayRef< LLT > Res, const SrcOp &Op)
Build and insert Res0, ... = G_UNMERGE_VALUES [Op](namespacellvm.html#ab471937b9a227e70c7fe8bd9604014d6).
buildUnmerge (ArrayRef< Register > Res, const SrcOp &Op)
buildUnmerge (LLT Res, const SrcOp &Op)
Build and insert an unmerge of Res sized pieces to cover [Op](namespacellvm.html#ab471937b9a227e70c7fe8bd9604014d6).
buildUnmerge (MachineRegisterInfo::VRegAttrs Attrs, const SrcOp &Op)
Build and insert an unmerge of pieces with Attrs register attributes to cover [Op](namespacellvm.html#ab471937b9a227e70c7fe8bd9604014d6).
buildBuildVector (const DstOp &Res, ArrayRef< Register > Ops)
Build and insert Res = G_BUILD_VECTOR Op0, ...
buildBuildVectorConstant (const DstOp &Res, ArrayRef< APInt > Ops)
Build and insert Res = G_BUILD_VECTOR Op0, ... where each OpN is built with G_CONSTANT.
buildSplatBuildVector (const DstOp &Res, const SrcOp &Src)
Build and insert Res = G_BUILD_VECTOR with Src replicated to fill the number of elements.
buildBuildVectorTrunc (const DstOp &Res, ArrayRef< Register > Ops)
Build and insert Res = G_BUILD_VECTOR_TRUNC Op0, ...
buildShuffleSplat (const DstOp &Res, const SrcOp &Src)
Build and insert a vector splat of a scalar Src using a G_INSERT_VECTOR_ELT and G_SHUFFLE_VECTOR idiom.
buildShuffleVector (const DstOp &Res, const SrcOp &Src1, const SrcOp &Src2, ArrayRef< int > Mask)
Build and insert Res = G_SHUFFLE_VECTOR Src1, Src2, Mask.
buildSplatVector (const DstOp &Res, const SrcOp &Val)
Build and insert Res = G_SPLAT_VECTOR Val.
buildConcatVectors (const DstOp &Res, ArrayRef< Register > Ops)
Build and insert Res = G_CONCAT_VECTORS Op0, ...
buildInsertSubvector (const DstOp &Res, const SrcOp &Src0, const SrcOp &Src1, unsigned Index)
Build and insert Res = G_INSERT_SUBVECTOR Src0, Src1, Idx.
buildExtractSubvector (const DstOp &Res, const SrcOp &Src, unsigned Index)
Build and insert Res = G_EXTRACT_SUBVECTOR Src, Idx0.
buildInsert (const DstOp &Res, const SrcOp &Src, const SrcOp &Op, unsigned Index)
buildStepVector (const DstOp &Res, unsigned Step)
Build and insert Res = G_STEP_VECTOR Step.
buildVScale (const DstOp &Res, unsigned MinElts)
Build and insert Res = G_VSCALE MinElts.
buildVScale (const DstOp &Res, const ConstantInt &MinElts)
Build and insert Res = G_VSCALE MinElts.
buildVScale (const DstOp &Res, const APInt &MinElts)
Build and insert Res = G_VSCALE MinElts.
buildIntrinsic (Intrinsic::ID ID, ArrayRef< Register > Res, bool HasSideEffects, bool isConvergent)
Build and insert a G_INTRINSIC instruction.
buildIntrinsic (Intrinsic::ID ID, ArrayRef< Register > Res)
buildIntrinsic (Intrinsic::ID ID, ArrayRef< DstOp > Res, bool HasSideEffects, bool isConvergent)
buildIntrinsic (Intrinsic::ID ID, ArrayRef< DstOp > Res)
buildFPTrunc (const DstOp &Res, const SrcOp &Op, std::optional< unsigned > Flags=std::nullopt)
Build and insert Res = G_FPTRUNC [Op](namespacellvm.html#ab471937b9a227e70c7fe8bd9604014d6).
buildTrunc (const DstOp &Res, const SrcOp &Op, std::optional< unsigned > Flags=std::nullopt)
Build and insert Res = G_TRUNC [Op](namespacellvm.html#ab471937b9a227e70c7fe8bd9604014d6).
buildICmp (CmpInst::Predicate Pred, const DstOp &Res, const SrcOp &Op0, const SrcOp &Op1, std::optional< unsigned > Flags=std::nullopt)
Build and insert a Res = G_ICMP Pred, Op0, Op1.
buildFCmp (CmpInst::Predicate Pred, const DstOp &Res, const SrcOp &Op0, const SrcOp &Op1, std::optional< unsigned > Flags=std::nullopt)
Build and insert a Res = G_FCMP Pred`Op0`, Op1.
buildSCmp (const DstOp &Res, const SrcOp &Op0, const SrcOp &Op1)
Build and insert a Res = G_SCMP Op0, Op1.
buildUCmp (const DstOp &Res, const SrcOp &Op0, const SrcOp &Op1)
Build and insert a Res = G_UCMP Op0, Op1.
buildIsFPClass (const DstOp &Res, const SrcOp &Src, unsigned Mask)
Build and insert a Res = G_IS_FPCLASS Src, Mask.
buildSelect (const DstOp &Res, const SrcOp &Tst, const SrcOp &Op0, const SrcOp &Op1, std::optional< unsigned > Flags=std::nullopt)
Build and insert a Res = G_SELECT Tst, Op0, Op1.
buildInsertVectorElement (const DstOp &Res, const SrcOp &Val, const SrcOp &Elt, const SrcOp &Idx)
Build and insert Res = G_INSERT_VECTOR_ELT Val, Elt, Idx.
buildExtractVectorElementConstant (const DstOp &Res, const SrcOp &Val, const int Idx)
Build and insert Res = G_EXTRACT_VECTOR_ELT Val, Idx.
buildExtractVectorElement (const DstOp &Res, const SrcOp &Val, const SrcOp &Idx)
Build and insert Res = G_EXTRACT_VECTOR_ELT Val, Idx.
buildAtomicCmpXchgWithSuccess (const DstOp &OldValRes, const DstOp &SuccessRes, const SrcOp &Addr, const SrcOp &CmpVal, const SrcOp &NewVal, MachineMemOperand &MMO)
Build and insert OldValRes, SuccessRes = / G_ATOMIC_CMPXCHG_WITH_SUCCESS Addr, CmpVal, NewVal, MMO.
buildAtomicCmpXchg (const DstOp &OldValRes, const SrcOp &Addr, const SrcOp &CmpVal, const SrcOp &NewVal, MachineMemOperand &MMO)
Build and insert OldValRes = G_ATOMIC_CMPXCHG Addr, CmpVal, NewVal, / MMO.
buildAtomicRMW (unsigned Opcode, const DstOp &OldValRes, const SrcOp &Addr, const SrcOp &Val, MachineMemOperand &MMO)
Build and insert OldValRes = G_ATOMICRMW_ Addr, Val, MMO.
buildAtomicRMWXchg (Register OldValRes, Register Addr, Register Val, MachineMemOperand &MMO)
Build and insert OldValRes = G_ATOMICRMW_XCHG Addr, Val, MMO.
buildAtomicRMWAdd (Register OldValRes, Register Addr, Register Val, MachineMemOperand &MMO)
Build and insert OldValRes = G_ATOMICRMW_ADD Addr, Val, MMO.
buildAtomicRMWSub (Register OldValRes, Register Addr, Register Val, MachineMemOperand &MMO)
Build and insert OldValRes = G_ATOMICRMW_SUB Addr, Val, MMO.
buildAtomicRMWAnd (Register OldValRes, Register Addr, Register Val, MachineMemOperand &MMO)
Build and insert OldValRes = G_ATOMICRMW_AND Addr, Val, MMO.
buildAtomicRMWNand (Register OldValRes, Register Addr, Register Val, MachineMemOperand &MMO)
Build and insert OldValRes = G_ATOMICRMW_NAND Addr, Val, MMO.
buildAtomicRMWOr (Register OldValRes, Register Addr, Register Val, MachineMemOperand &MMO)
Build and insert OldValRes = G_ATOMICRMW_OR Addr, Val, MMO.
buildAtomicRMWXor (Register OldValRes, Register Addr, Register Val, MachineMemOperand &MMO)
Build and insert OldValRes = G_ATOMICRMW_XOR Addr, Val, MMO.
buildAtomicRMWMax (Register OldValRes, Register Addr, Register Val, MachineMemOperand &MMO)
Build and insert OldValRes = G_ATOMICRMW_MAX Addr, Val, MMO.
buildAtomicRMWMin (Register OldValRes, Register Addr, Register Val, MachineMemOperand &MMO)
Build and insert OldValRes = G_ATOMICRMW_MIN Addr, Val, MMO.
buildAtomicRMWUmax (Register OldValRes, Register Addr, Register Val, MachineMemOperand &MMO)
Build and insert OldValRes = G_ATOMICRMW_UMAX Addr, Val, MMO.
buildAtomicRMWUmin (Register OldValRes, Register Addr, Register Val, MachineMemOperand &MMO)
Build and insert OldValRes = G_ATOMICRMW_UMIN Addr, Val, MMO.
buildAtomicRMWFAdd (const DstOp &OldValRes, const SrcOp &Addr, const SrcOp &Val, MachineMemOperand &MMO)
Build and insert OldValRes = G_ATOMICRMW_FADD Addr, Val, MMO.
buildAtomicRMWFSub (const DstOp &OldValRes, const SrcOp &Addr, const SrcOp &Val, MachineMemOperand &MMO)
Build and insert OldValRes = G_ATOMICRMW_FSUB Addr, Val, MMO.
buildAtomicRMWFMax (const DstOp &OldValRes, const SrcOp &Addr, const SrcOp &Val, MachineMemOperand &MMO)
Build and insert OldValRes = G_ATOMICRMW_FMAX Addr, Val, MMO.
buildAtomicRMWFMin (const DstOp &OldValRes, const SrcOp &Addr, const SrcOp &Val, MachineMemOperand &MMO)
Build and insert OldValRes = G_ATOMICRMW_FMIN Addr, Val, MMO.
buildAtomicRMWFMaximum (const DstOp &OldValRes, const SrcOp &Addr, const SrcOp &Val, MachineMemOperand &MMO)
Build and insert OldValRes = G_ATOMICRMW_FMAXIMUM Addr, Val, MMO.
buildAtomicRMWFMinimum (const DstOp &OldValRes, const SrcOp &Addr, const SrcOp &Val, MachineMemOperand &MMO)
Build and insert OldValRes = G_ATOMICRMW_FMINIMUM Addr, Val, MMO.
buildAtomicRMWUSubCond (const DstOp &OldValRes, const SrcOp &Addr, const SrcOp &Val, MachineMemOperand &MMO)
Build and insert OldValRes = G_ATOMICRMW_USUB_COND Addr, Val, MMO.
buildAtomicRMWUSubSat (const DstOp &OldValRes, const SrcOp &Addr, const SrcOp &Val, MachineMemOperand &MMO)
Build and insert OldValRes = G_ATOMICRMW_USUB_SAT Addr, Val, MMO.
buildFence (unsigned Ordering, unsigned Scope)
Build and insert G_FENCE Ordering, Scope.
buildPrefetch (const SrcOp &Addr, unsigned RW, unsigned Locality, unsigned CacheType, MachineMemOperand &MMO)
Build and insert G_PREFETCH Addr, RW, Locality, CacheType.
buildFreeze (const DstOp &Dst, const SrcOp &Src)
Build and insert Dst = G_FREEZE Src.
buildBlockAddress (Register Res, const BlockAddress *BA)
Build and insert Res = G_BLOCK_ADDR BA.
buildAdd (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
Build and insert Res = G_ADD Op0, Op1.
buildSub (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
Build and insert Res = G_SUB Op0, Op1.
buildMul (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
Build and insert Res = G_MUL Op0, Op1.
buildAbds (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1)
Build and insert Res = G_ABDS Op0, Op1.
buildAbdu (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1)
Build and insert Res = G_ABDU Op0, Op1.
buildUMulH (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
buildSMulH (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
buildURem (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
Build and insert Res = G_UREM Op0, Op1.
buildFMul (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
buildFMinNum (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
buildFMaxNum (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
buildFMinNumIEEE (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
buildFMaxNumIEEE (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
buildShl (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
buildLShr (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
buildAShr (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
buildAnd (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1)
Build and insert Res = G_AND Op0, Op1.
buildOr (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
Build and insert Res = G_OR Op0, Op1.
buildXor (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1)
Build and insert Res = G_XOR Op0, Op1.
buildNot (const DstOp &Dst, const SrcOp &Src0)
Build and insert a bitwise not, NegOne = G_CONSTANT -1 Res = G_OR Op0, NegOne.
buildNeg (const DstOp &Dst, const SrcOp &Src0)
Build and insert integer negation Zero = G_CONSTANT 0 Res = G_SUB Zero, Op0.
buildCTPOP (const DstOp &Dst, const SrcOp &Src0)
Build and insert Res = G_CTPOP Op0, Src0.
buildCTLZ (const DstOp &Dst, const SrcOp &Src0)
Build and insert Res = G_CTLZ Op0, Src0.
buildCTLZ_ZERO_UNDEF (const DstOp &Dst, const SrcOp &Src0)
Build and insert Res = G_CTLZ_ZERO_UNDEF Op0, Src0.
buildCTTZ (const DstOp &Dst, const SrcOp &Src0)
Build and insert Res = G_CTTZ Op0, Src0.
buildCTTZ_ZERO_UNDEF (const DstOp &Dst, const SrcOp &Src0)
Build and insert Res = G_CTTZ_ZERO_UNDEF Op0, Src0.
buildBSwap (const DstOp &Dst, const SrcOp &Src0)
Build and insert Dst = G_BSWAP Src0.
buildFAdd (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
Build and insert Res = G_FADD Op0, Op1.
buildStrictFAdd (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
Build and insert Res = G_STRICT_FADD Op0, Op1.
buildFSub (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
Build and insert Res = G_FSUB Op0, Op1.
buildFDiv (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
Build and insert Res = G_FDIV Op0, Op1.
buildFMA (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, const SrcOp &Src2, std::optional< unsigned > Flags=std::nullopt)
Build and insert Res = G_FMA Op0, Op1, Op2.
buildFMAD (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, const SrcOp &Src2, std::optional< unsigned > Flags=std::nullopt)
Build and insert Res = G_FMAD Op0, Op1, Op2.
buildFNeg (const DstOp &Dst, const SrcOp &Src0, std::optional< unsigned > Flags=std::nullopt)
Build and insert Res = G_FNEG Op0.
buildFAbs (const DstOp &Dst, const SrcOp &Src0, std::optional< unsigned > Flags=std::nullopt)
Build and insert Res = G_FABS Op0.
buildFCanonicalize (const DstOp &Dst, const SrcOp &Src0, std::optional< unsigned > Flags=std::nullopt)
Build and insert Dst = G_FCANONICALIZE Src0.
buildIntrinsicTrunc (const DstOp &Dst, const SrcOp &Src0, std::optional< unsigned > Flags=std::nullopt)
Build and insert Dst = G_INTRINSIC_TRUNC Src0.
buildFFloor (const DstOp &Dst, const SrcOp &Src0, std::optional< unsigned > Flags=std::nullopt)
Build and insert Res = GFFLOOR Op0, Op1.
buildFLog (const DstOp &Dst, const SrcOp &Src, std::optional< unsigned > Flags=std::nullopt)
Build and insert Dst = G_FLOG Src.
buildFLog2 (const DstOp &Dst, const SrcOp &Src, std::optional< unsigned > Flags=std::nullopt)
Build and insert Dst = G_FLOG2 Src.
buildFExp2 (const DstOp &Dst, const SrcOp &Src, std::optional< unsigned > Flags=std::nullopt)
Build and insert Dst = G_FEXP2 Src.
buildFPow (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
Build and insert Dst = G_FPOW Src0, Src1.
buildFLdexp (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
Build and insert Dst = G_FLDEXP Src0, Src1.
buildFFrexp (const DstOp &Fract, const DstOp &Exp, const SrcOp &Src, std::optional< unsigned > Flags=std::nullopt)
Build and insert Fract, Exp = G_FFREXP Src.
buildFSincos (const DstOp &Sin, const DstOp &Cos, const SrcOp &Src, std::optional< unsigned > Flags=std::nullopt)
Build and insert Sin, Cos = G_FSINCOS Src.
buildModf (const DstOp &Fract, const DstOp &Int, const SrcOp &Src, std::optional< unsigned > Flags=std::nullopt)
Build and insert Fract, Int = G_FMODF Src.
buildFCopysign (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1)
Build and insert Res = G_FCOPYSIGN Op0, Op1.
buildUITOFP (const DstOp &Dst, const SrcOp &Src0)
Build and insert Res = G_UITOFP Src0.
buildSITOFP (const DstOp &Dst, const SrcOp &Src0)
Build and insert Res = G_SITOFP Src0.
buildFPTOUI (const DstOp &Dst, const SrcOp &Src0)
Build and insert Res = G_FPTOUI Src0.
buildFPTOSI (const DstOp &Dst, const SrcOp &Src0)
Build and insert Res = G_FPTOSI Src0.
buildFPTOUI_SAT (const DstOp &Dst, const SrcOp &Src0)
Build and insert Res = G_FPTOUI_SAT Src0.
buildFPTOSI_SAT (const DstOp &Dst, const SrcOp &Src0)
Build and insert Res = G_FPTOSI_SAT Src0.
buildIntrinsicRoundeven (const DstOp &Dst, const SrcOp &Src0, std::optional< unsigned > Flags=std::nullopt)
Build and insert Dst = G_INTRINSIC_ROUNDEVEN Src0, Src1.
buildSMin (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1)
Build and insert Res = G_SMIN Op0, Op1.
buildSMax (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1)
Build and insert Res = G_SMAX Op0, Op1.
buildUMin (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1)
Build and insert Res = G_UMIN Op0, Op1.
buildUMax (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1)
Build and insert Res = G_UMAX Op0, Op1.
buildAbs (const DstOp &Dst, const SrcOp &Src)
Build and insert Dst = G_ABS Src.
buildJumpTable (const LLT PtrTy, unsigned JTI)
Build and insert Res = G_JUMP_TABLE JTI.
buildVecReduceSeqFAdd (const DstOp &Dst, const SrcOp &ScalarIn, const SrcOp &VecIn)
Build and insert Res = G_VECREDUCE_SEQ_FADD ScalarIn, VecIn.
buildVecReduceSeqFMul (const DstOp &Dst, const SrcOp &ScalarIn, const SrcOp &VecIn)
Build and insert Res = G_VECREDUCE_SEQ_FMUL ScalarIn, VecIn.
buildVecReduceFAdd (const DstOp &Dst, const SrcOp &ScalarIn, const SrcOp &VecIn)
Build and insert Res = G_VECREDUCE_FADD Src.
buildVecReduceFMul (const DstOp &Dst, const SrcOp &ScalarIn, const SrcOp &VecIn)
Build and insert Res = G_VECREDUCE_FMUL Src.
buildVecReduceFMax (const DstOp &Dst, const SrcOp &Src)
Build and insert Res = G_VECREDUCE_FMAX Src.
buildVecReduceFMin (const DstOp &Dst, const SrcOp &Src)
Build and insert Res = G_VECREDUCE_FMIN Src.
buildVecReduceFMaximum (const DstOp &Dst, const SrcOp &Src)
Build and insert Res = G_VECREDUCE_FMAXIMUM Src.
buildVecReduceFMinimum (const DstOp &Dst, const SrcOp &Src)
Build and insert Res = G_VECREDUCE_FMINIMUM Src.
buildVecReduceAdd (const DstOp &Dst, const SrcOp &Src)
Build and insert Res = G_VECREDUCE_ADD Src.
buildVecReduceMul (const DstOp &Dst, const SrcOp &Src)
Build and insert Res = G_VECREDUCE_MUL Src.
buildVecReduceAnd (const DstOp &Dst, const SrcOp &Src)
Build and insert Res = G_VECREDUCE_AND Src.
buildVecReduceOr (const DstOp &Dst, const SrcOp &Src)
Build and insert Res = G_VECREDUCE_OR Src.
buildVecReduceXor (const DstOp &Dst, const SrcOp &Src)
Build and insert Res = G_VECREDUCE_XOR Src.
buildVecReduceSMax (const DstOp &Dst, const SrcOp &Src)
Build and insert Res = G_VECREDUCE_SMAX Src.
buildVecReduceSMin (const DstOp &Dst, const SrcOp &Src)
Build and insert Res = G_VECREDUCE_SMIN Src.
buildVecReduceUMax (const DstOp &Dst, const SrcOp &Src)
Build and insert Res = G_VECREDUCE_UMAX Src.
buildVecReduceUMin (const DstOp &Dst, const SrcOp &Src)
Build and insert Res = G_VECREDUCE_UMIN Src.
buildMemTransferInst (unsigned Opcode, const SrcOp &DstPtr, const SrcOp &SrcPtr, const SrcOp &Size, MachineMemOperand &DstMMO, MachineMemOperand &SrcMMO)
Build and insert G_MEMCPY or G_MEMMOVE.
buildMemCpy (const SrcOp &DstPtr, const SrcOp &SrcPtr, const SrcOp &Size, MachineMemOperand &DstMMO, MachineMemOperand &SrcMMO)
Build and insert G_TRAP or G_DEBUGTRAP.
buildSbfx (const DstOp &Dst, const SrcOp &Src, const SrcOp &LSB, const SrcOp &Width)
Build and insert Dst = G_SBFX Src, LSB, Width.
buildUbfx (const DstOp &Dst, const SrcOp &Src, const SrcOp &LSB, const SrcOp &Width)
Build and insert Dst = G_UBFX Src, LSB, Width.
buildRotateRight (const DstOp &Dst, const SrcOp &Src, const SrcOp &Amt)
Build and insert Dst = G_ROTR Src, Amt.
buildRotateLeft (const DstOp &Dst, const SrcOp &Src, const SrcOp &Amt)
Build and insert Dst = G_ROTL Src, Amt.
buildBitReverse (const DstOp &Dst, const SrcOp &Src)
Build and insert Dst = G_BITREVERSE Src.
buildGetFPEnv (const DstOp &Dst)
Build and insert Dst = G_GET_FPENV.
buildSetFPEnv (const SrcOp &Src)
Build and insert G_SET_FPENV Src.
Build and insert G_RESET_FPENV.
buildGetFPMode (const DstOp &Dst)
Build and insert Dst = G_GET_FPMODE.
buildSetFPMode (const SrcOp &Src)
Build and insert G_SET_FPMODE Src.
Build and insert G_RESET_FPMODE.
buildGetRounding (const DstOp &Dst)
Build and insert Dst = G_GET_ROUNDING.
buildSetRounding (const SrcOp &Src)
Build and insert G_SET_ROUNDING.
void
setMF (MachineFunction &MF)
void
setMBB (MachineBasicBlock &MBB)
Set the insertion point to the end of MBB.
void
Set the insertion point to before MI.
Additional Inherited Members
Protected Member Functions inherited from llvm::MachineIRBuilder
void
validateTruncExt (const LLT Dst, const LLT Src, bool IsExtend)
void
validateUnaryOp (const LLT Res, const LLT Op0)
void
validateBinaryOp (const LLT Res, const LLT Op0, const LLT Op1)
void
validateShiftOp (const LLT Res, const LLT Op0, const LLT Op1)
void
validateSelectOp (const LLT ResTy, const LLT TstTy, const LLT Op0Ty, const LLT Op1Ty)
void
recordInsertion (MachineInstr *InsertedInstr) const
Defines a builder that does CSE of MachineInstructions using GISelCSEInfo.
Eg usage.
&getAnalysis().getCSEInfo();
CB.setCSEInfo(Info);
auto A = CB.buildConstant(s32, 42);
auto B = CB.buildConstant(s32, 42);
unsigned CReg = MRI.createGenericVirtualRegister(s32);
auto C = CB.buildConstant(CReg, 42);
assert(C->getOpcode() == TargetOpcode::COPY);
unsigned const MachineRegisterInfo * MRI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
Analysis containing CSE Info
Defines a builder that does CSE of MachineInstructions using GISelCSEInfo.
@ C
The default llvm calling convention, compatible with C.
Explicitly passing in a register would materialize a copy if possible. CSEMIRBuilder also does trivial constant folding for binary ops.
Definition at line 39 of file CSEMIRBuilder.h.