LLVM 20.0.0git
Public Member Functions | List of all members
llvm::CSEMIRBuilder Class Reference

Defines a builder that does CSE of MachineInstructions using GISelCSEInfo. More...

#include "llvm/CodeGen/GlobalISel/CSEMIRBuilder.h"

Inheritance diagram for llvm::CSEMIRBuilder:
Inheritance graph
[legend]

Public Member Functions

MachineInstrBuilder buildInstr (unsigned Opc, ArrayRef< DstOp > DstOps, ArrayRef< SrcOp > SrcOps, std::optional< unsigned > Flag=std::nullopt) override
 
MachineInstrBuilder buildConstant (const DstOp &Res, const ConstantInt &Val) override
 Build and insert Res = G_CONSTANT Val.
 
MachineInstrBuilder 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)
 
virtual MachineInstrBuilder buildConstant (const DstOp &Res, const ConstantInt &Val)
 Build and insert Res = G_CONSTANT Val.
 
MachineInstrBuilder buildConstant (const DstOp &Res, int64_t Val)
 Build and insert Res = G_CONSTANT Val.
 
MachineInstrBuilder buildConstant (const DstOp &Res, const APInt &Val)
 
virtual MachineInstrBuilder buildFConstant (const DstOp &Res, const ConstantFP &Val)
 Build and insert Res = G_FCONSTANT Val.
 
MachineInstrBuilder buildFConstant (const DstOp &Res, double Val)
 
MachineInstrBuilder 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)
 
const TargetInstrInfogetTII ()
 
MachineFunctiongetMF ()
 Getter for the function we currently build.
 
const MachineFunctiongetMF () const
 
const DataLayoutgetDataLayout () const
 
LLVMContextgetContext () const
 
const DebugLocgetDL ()
 Getter for DebugLoc.
 
MachineRegisterInfogetMRI ()
 Getter for MRI.
 
const MachineRegisterInfogetMRI () const
 
MachineIRBuilderStategetState ()
 Getter for the State.
 
void setState (const MachineIRBuilderState &NewState)
 Setter for the State.
 
const MachineBasicBlockgetMBB () const
 Getter for the basic block we currently build.
 
MachineBasicBlockgetMBB ()
 
GISelCSEInfogetCSEInfo ()
 
const GISelCSEInfogetCSEInfo () const
 
MachineBasicBlock::iterator 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)
 
GISelChangeObservergetObserver ()
 
void stopObservingChanges ()
 
bool isObservingChanges () const
 
void setDebugLoc (const DebugLoc &DL)
 Set the debug location to DL for all the next build instructions.
 
const DebugLocgetDebugLoc ()
 Get the current instruction's debug location.
 
void setPCSections (MDNode *MD)
 Set the PC sections metadata to MD for all the next build instructions.
 
MDNodegetPCSections ()
 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.
 
MDNodegetMMRAMetadata ()
 Get the current instruction's MMRA metadata.
 
MachineInstrBuilder buildInstr (unsigned Opcode)
 Build and insert <empty> = Opcode <empty>.
 
MachineInstrBuilder buildInstrNoInsert (unsigned Opcode)
 Build but don't insert <empty> = Opcode <empty>.
 
MachineInstrBuilder insertInstr (MachineInstrBuilder MIB)
 Insert an existing instruction at the insertion point.
 
MachineInstrBuilder 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).
 
MachineInstrBuilder 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).
 
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).
 
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).
 
MachineInstrBuilder buildDbgLabel (const MDNode *Label)
 Build and insert a DBG_LABEL instructions specifying that Label is given.
 
MachineInstrBuilder buildDynStackAlloc (const DstOp &Res, const SrcOp &Size, Align Alignment)
 Build and insert Res = G_DYN_STACKALLOC Size, Align.
 
MachineInstrBuilder buildFrameIndex (const DstOp &Res, int Idx)
 Build and insert Res = G_FRAME_INDEX Idx.
 
MachineInstrBuilder buildGlobalValue (const DstOp &Res, const GlobalValue *GV)
 Build and insert Res = G_GLOBAL_VALUE GV.
 
MachineInstrBuilder buildConstantPool (const DstOp &Res, unsigned Idx)
 Build and insert Res = G_CONSTANT_POOL Idx.
 
MachineInstrBuilder 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.
 
std::optional< MachineInstrBuildermaterializePtrAdd (Register &Res, Register Op0, const LLT ValueTy, uint64_t Value)
 Materialize and insert Res = G_PTR_ADD Op0, (G_CONSTANT Value)
 
MachineInstrBuilder buildPtrMask (const DstOp &Res, const SrcOp &Op0, const SrcOp &Op1)
 Build and insert Res = G_PTRMASK Op0, Op1.
 
MachineInstrBuilder buildMaskLowPtrBits (const DstOp &Res, const SrcOp &Op0, uint32_t NumBits)
 Build and insert Res = G_PTRMASK Op0, G_CONSTANT (1 << NumBits) - 1.
 
MachineInstrBuilder 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.
 
MachineInstrBuilder 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.
 
MachineInstrBuilder buildUAddo (const DstOp &Res, const DstOp &CarryOut, const SrcOp &Op0, const SrcOp &Op1)
 Build and insert Res, CarryOut = G_UADDO Op0, Op1.
 
MachineInstrBuilder buildUSubo (const DstOp &Res, const DstOp &CarryOut, const SrcOp &Op0, const SrcOp &Op1)
 Build and insert Res, CarryOut = G_USUBO Op0, Op1.
 
MachineInstrBuilder buildSAddo (const DstOp &Res, const DstOp &CarryOut, const SrcOp &Op0, const SrcOp &Op1)
 Build and insert Res, CarryOut = G_SADDO Op0, Op1.
 
MachineInstrBuilder buildSSubo (const DstOp &Res, const DstOp &CarryOut, const SrcOp &Op0, const SrcOp &Op1)
 Build and insert Res, CarryOut = G_SUBO Op0, Op1.
 
MachineInstrBuilder 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.
 
MachineInstrBuilder 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.
 
MachineInstrBuilder 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.
 
MachineInstrBuilder 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.
 
MachineInstrBuilder buildAnyExt (const DstOp &Res, const SrcOp &Op)
 Build and insert Res = G_ANYEXT Op0.
 
MachineInstrBuilder buildSExt (const DstOp &Res, const SrcOp &Op)
 Build and insert Res = G_SEXT Op.
 
MachineInstrBuilder buildSExtInReg (const DstOp &Res, const SrcOp &Op, int64_t ImmOp)
 Build and insert Res = G_SEXT_INREG Op, ImmOp.
 
MachineInstrBuilder buildFPExt (const DstOp &Res, const SrcOp &Op, std::optional< unsigned > Flags=std::nullopt)
 Build and insert Res = G_FPEXT Op.
 
MachineInstrBuilder buildPtrToInt (const DstOp &Dst, const SrcOp &Src)
 Build and insert a G_PTRTOINT instruction.
 
MachineInstrBuilder buildIntToPtr (const DstOp &Dst, const SrcOp &Src)
 Build and insert a G_INTTOPTR instruction.
 
MachineInstrBuilder buildBitcast (const DstOp &Dst, const SrcOp &Src)
 Build and insert Dst = G_BITCAST Src.
 
MachineInstrBuilder buildAddrSpaceCast (const DstOp &Dst, const SrcOp &Src)
 Build and insert Dst = G_ADDRSPACE_CAST Src.
 
unsigned getBoolExtOp (bool IsVec, bool IsFP) const
 
MachineInstrBuilder buildBoolExt (const DstOp &Res, const SrcOp &Op, bool IsFP)
 
MachineInstrBuilder buildBoolExtInReg (const DstOp &Res, const SrcOp &Op, bool IsVector, bool IsFP)
 
MachineInstrBuilder buildZExt (const DstOp &Res, const SrcOp &Op, std::optional< unsigned > Flags=std::nullopt)
 Build and insert Res = G_ZEXT Op.
 
MachineInstrBuilder buildSExtOrTrunc (const DstOp &Res, const SrcOp &Op)
 Build and insert Res = G_SEXT Op, Res = G_TRUNC Op, or Res = COPY Op depending on the differing sizes of Res and Op.
 
MachineInstrBuilder buildZExtOrTrunc (const DstOp &Res, const SrcOp &Op)
 Build and insert Res = G_ZEXT Op, Res = G_TRUNC Op, or Res = COPY Op depending on the differing sizes of Res and Op.
 
MachineInstrBuilder buildAnyExtOrTrunc (const DstOp &Res, const SrcOp &Op)
 Res = COPY Op depending on the differing sizes of Res and Op.
 
MachineInstrBuilder buildExtOrTrunc (unsigned ExtOpc, const DstOp &Res, const SrcOp &Op)
 Build and insert Res = ExtOpc, Res = G_TRUNC Op, or Res = COPY Op depending on the differing sizes of Res and Op.
 
MachineInstrBuilder buildZExtInReg (const DstOp &Res, const SrcOp &Op, int64_t ImmOp)
 Build and inserts Res = G_AND Op, LowBitsSet(ImmOp) Since there is no G_ZEXT_INREG like G_SEXT_INREG, the instruction is emulated using G_AND.
 
MachineInstrBuilder buildCast (const DstOp &Dst, const SrcOp &Src)
 Build and insert an appropriate cast between two registers of equal size.
 
MachineInstrBuilder buildBr (MachineBasicBlock &Dest)
 Build and insert G_BR Dest.
 
MachineInstrBuilder buildBrCond (const SrcOp &Tst, MachineBasicBlock &Dest)
 Build and insert G_BRCOND Tst, Dest.
 
MachineInstrBuilder buildBrIndirect (Register Tgt)
 Build and insert G_BRINDIRECT Tgt.
 
MachineInstrBuilder buildBrJT (Register TablePtr, unsigned JTI, Register IndexReg)
 Build and insert G_BRJT TablePtr, JTI, IndexReg.
 
virtual MachineInstrBuilder buildConstant (const DstOp &Res, const ConstantInt &Val)
 Build and insert Res = G_CONSTANT Val.
 
MachineInstrBuilder buildConstant (const DstOp &Res, int64_t Val)
 Build and insert Res = G_CONSTANT Val.
 
MachineInstrBuilder buildConstant (const DstOp &Res, const APInt &Val)
 
virtual MachineInstrBuilder buildFConstant (const DstOp &Res, const ConstantFP &Val)
 Build and insert Res = G_FCONSTANT Val.
 
MachineInstrBuilder buildFConstant (const DstOp &Res, double Val)
 
MachineInstrBuilder buildFConstant (const DstOp &Res, const APFloat &Val)
 
MachineInstrBuilder buildConstantPtrAuth (const DstOp &Res, const ConstantPtrAuth *CPA, Register Addr, Register AddrDisc)
 Build and insert G_PTRAUTH_GLOBAL_VALUE.
 
MachineInstrBuilder buildCopy (const DstOp &Res, const SrcOp &Op)
 Build and insert Res = COPY Op.
 
MachineInstrBuilder buildAssertInstr (unsigned Opc, const DstOp &Res, const SrcOp &Op, unsigned Val)
 Build and insert G_ASSERT_SEXT, G_ASSERT_ZEXT, or G_ASSERT_ALIGN.
 
MachineInstrBuilder buildAssertZExt (const DstOp &Res, const SrcOp &Op, unsigned Size)
 Build and insert Res = G_ASSERT_ZEXT Op, Size.
 
MachineInstrBuilder buildAssertSExt (const DstOp &Res, const SrcOp &Op, unsigned Size)
 Build and insert Res = G_ASSERT_SEXT Op, Size.
 
MachineInstrBuilder buildAssertAlign (const DstOp &Res, const SrcOp &Op, Align AlignVal)
 Build and insert Res = G_ASSERT_ALIGN Op, AlignVal.
 
MachineInstrBuilder buildLoad (const DstOp &Res, const SrcOp &Addr, MachineMemOperand &MMO)
 Build and insert Res = G_LOAD Addr, MMO.
 
MachineInstrBuilder 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.
 
MachineInstrBuilder buildLoadInstr (unsigned Opcode, const DstOp &Res, const SrcOp &Addr, MachineMemOperand &MMO)
 Build and insert Res = <opcode> Addr, MMO.
 
MachineInstrBuilder 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.
 
MachineInstrBuilder buildStore (const SrcOp &Val, const SrcOp &Addr, MachineMemOperand &MMO)
 Build and insert G_STORE Val, Addr, MMO.
 
MachineInstrBuilder 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.
 
MachineInstrBuilder buildExtract (const DstOp &Res, const SrcOp &Src, uint64_t Index)
 Build and insert Res0, ... = G_EXTRACT Src, Idx0.
 
MachineInstrBuilder buildUndef (const DstOp &Res)
 Build and insert Res = IMPLICIT_DEF.
 
MachineInstrBuilder buildMergeValues (const DstOp &Res, ArrayRef< Register > Ops)
 Build and insert Res = G_MERGE_VALUES Op0, ...
 
MachineInstrBuilder 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, ...
 
MachineInstrBuilder buildMergeLikeInstr (const DstOp &Res, std::initializer_list< SrcOp > Ops)
 
MachineInstrBuilder buildUnmerge (ArrayRef< LLT > Res, const SrcOp &Op)
 Build and insert Res0, ... = G_UNMERGE_VALUES Op.
 
MachineInstrBuilder buildUnmerge (ArrayRef< Register > Res, const SrcOp &Op)
 
MachineInstrBuilder buildUnmerge (LLT Res, const SrcOp &Op)
 Build and insert an unmerge of Res sized pieces to cover Op.
 
MachineInstrBuilder buildBuildVector (const DstOp &Res, ArrayRef< Register > Ops)
 Build and insert Res = G_BUILD_VECTOR Op0, ...
 
MachineInstrBuilder buildBuildVectorConstant (const DstOp &Res, ArrayRef< APInt > Ops)
 Build and insert Res = G_BUILD_VECTOR Op0, ... where each OpN is built with G_CONSTANT.
 
MachineInstrBuilder buildSplatBuildVector (const DstOp &Res, const SrcOp &Src)
 Build and insert Res = G_BUILD_VECTOR with Src replicated to fill the number of elements.
 
MachineInstrBuilder buildBuildVectorTrunc (const DstOp &Res, ArrayRef< Register > Ops)
 Build and insert Res = G_BUILD_VECTOR_TRUNC Op0, ...
 
MachineInstrBuilder 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.
 
MachineInstrBuilder buildShuffleVector (const DstOp &Res, const SrcOp &Src1, const SrcOp &Src2, ArrayRef< int > Mask)
 Build and insert Res = G_SHUFFLE_VECTOR Src1, Src2, Mask.
 
MachineInstrBuilder buildSplatVector (const DstOp &Res, const SrcOp &Val)
 Build and insert Res = G_SPLAT_VECTOR Val.
 
MachineInstrBuilder buildConcatVectors (const DstOp &Res, ArrayRef< Register > Ops)
 Build and insert Res = G_CONCAT_VECTORS Op0, ...
 
MachineInstrBuilder buildInsertSubvector (const DstOp &Res, const SrcOp &Src0, const SrcOp &Src1, unsigned Index)
 Build and insert Res = G_INSERT_SUBVECTOR Src0, Src1, Idx.
 
MachineInstrBuilder buildExtractSubvector (const DstOp &Res, const SrcOp &Src, unsigned Index)
 Build and insert Res = G_EXTRACT_SUBVECTOR Src, Idx0.
 
MachineInstrBuilder buildInsert (const DstOp &Res, const SrcOp &Src, const SrcOp &Op, unsigned Index)
 
MachineInstrBuilder buildStepVector (const DstOp &Res, unsigned Step)
 Build and insert Res = G_STEP_VECTOR Step.
 
MachineInstrBuilder buildVScale (const DstOp &Res, unsigned MinElts)
 Build and insert Res = G_VSCALE MinElts.
 
MachineInstrBuilder buildVScale (const DstOp &Res, const ConstantInt &MinElts)
 Build and insert Res = G_VSCALE MinElts.
 
MachineInstrBuilder buildVScale (const DstOp &Res, const APInt &MinElts)
 Build and insert Res = G_VSCALE MinElts.
 
MachineInstrBuilder buildIntrinsic (Intrinsic::ID ID, ArrayRef< Register > Res, bool HasSideEffects, bool isConvergent)
 Build and insert a G_INTRINSIC instruction.
 
MachineInstrBuilder buildIntrinsic (Intrinsic::ID ID, ArrayRef< Register > Res)
 
MachineInstrBuilder buildIntrinsic (Intrinsic::ID ID, ArrayRef< DstOp > Res, bool HasSideEffects, bool isConvergent)
 
MachineInstrBuilder buildIntrinsic (Intrinsic::ID ID, ArrayRef< DstOp > Res)
 
MachineInstrBuilder buildFPTrunc (const DstOp &Res, const SrcOp &Op, std::optional< unsigned > Flags=std::nullopt)
 Build and insert Res = G_FPTRUNC Op.
 
MachineInstrBuilder buildTrunc (const DstOp &Res, const SrcOp &Op, std::optional< unsigned > Flags=std::nullopt)
 Build and insert Res = G_TRUNC Op.
 
MachineInstrBuilder 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.
 
MachineInstrBuilder 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 PredOp0, Op1.
 
MachineInstrBuilder buildSCmp (const DstOp &Res, const SrcOp &Op0, const SrcOp &Op1)
 Build and insert a Res = G_SCMP Op0, Op1.
 
MachineInstrBuilder buildUCmp (const DstOp &Res, const SrcOp &Op0, const SrcOp &Op1)
 Build and insert a Res = G_UCMP Op0, Op1.
 
MachineInstrBuilder buildIsFPClass (const DstOp &Res, const SrcOp &Src, unsigned Mask)
 Build and insert a Res = G_IS_FPCLASS Src, Mask.
 
MachineInstrBuilder 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.
 
MachineInstrBuilder buildInsertVectorElement (const DstOp &Res, const SrcOp &Val, const SrcOp &Elt, const SrcOp &Idx)
 Build and insert Res = G_INSERT_VECTOR_ELT Val, Elt, Idx.
 
MachineInstrBuilder buildExtractVectorElementConstant (const DstOp &Res, const SrcOp &Val, const int Idx)
 Build and insert Res = G_EXTRACT_VECTOR_ELT Val, Idx.
 
MachineInstrBuilder buildExtractVectorElement (const DstOp &Res, const SrcOp &Val, const SrcOp &Idx)
 Build and insert Res = G_EXTRACT_VECTOR_ELT Val, Idx.
 
MachineInstrBuilder buildAtomicCmpXchgWithSuccess (const DstOp &OldValRes, const DstOp &SuccessRes, const SrcOp &Addr, const SrcOp &CmpVal, const SrcOp &NewVal, MachineMemOperand &MMO)
 Build and insert OldValRes<def>, SuccessRes<def> = G_ATOMIC_CMPXCHG_WITH_SUCCESS Addr, CmpVal, NewVal, MMO.
 
MachineInstrBuilder buildAtomicCmpXchg (const DstOp &OldValRes, const SrcOp &Addr, const SrcOp &CmpVal, const SrcOp &NewVal, MachineMemOperand &MMO)
 Build and insert OldValRes<def> = G_ATOMIC_CMPXCHG Addr, CmpVal, NewVal, MMO.
 
MachineInstrBuilder buildAtomicRMW (unsigned Opcode, const DstOp &OldValRes, const SrcOp &Addr, const SrcOp &Val, MachineMemOperand &MMO)
 Build and insert OldValRes<def> = G_ATOMICRMW_<Opcode> Addr, Val, MMO.
 
MachineInstrBuilder buildAtomicRMWXchg (Register OldValRes, Register Addr, Register Val, MachineMemOperand &MMO)
 Build and insert OldValRes<def> = G_ATOMICRMW_XCHG Addr, Val, MMO.
 
MachineInstrBuilder buildAtomicRMWAdd (Register OldValRes, Register Addr, Register Val, MachineMemOperand &MMO)
 Build and insert OldValRes<def> = G_ATOMICRMW_ADD Addr, Val, MMO.
 
MachineInstrBuilder buildAtomicRMWSub (Register OldValRes, Register Addr, Register Val, MachineMemOperand &MMO)
 Build and insert OldValRes<def> = G_ATOMICRMW_SUB Addr, Val, MMO.
 
MachineInstrBuilder buildAtomicRMWAnd (Register OldValRes, Register Addr, Register Val, MachineMemOperand &MMO)
 Build and insert OldValRes<def> = G_ATOMICRMW_AND Addr, Val, MMO.
 
MachineInstrBuilder buildAtomicRMWNand (Register OldValRes, Register Addr, Register Val, MachineMemOperand &MMO)
 Build and insert OldValRes<def> = G_ATOMICRMW_NAND Addr, Val, MMO.
 
MachineInstrBuilder buildAtomicRMWOr (Register OldValRes, Register Addr, Register Val, MachineMemOperand &MMO)
 Build and insert OldValRes<def> = G_ATOMICRMW_OR Addr, Val, MMO.
 
MachineInstrBuilder buildAtomicRMWXor (Register OldValRes, Register Addr, Register Val, MachineMemOperand &MMO)
 Build and insert OldValRes<def> = G_ATOMICRMW_XOR Addr, Val, MMO.
 
MachineInstrBuilder buildAtomicRMWMax (Register OldValRes, Register Addr, Register Val, MachineMemOperand &MMO)
 Build and insert OldValRes<def> = G_ATOMICRMW_MAX Addr, Val, MMO.
 
MachineInstrBuilder buildAtomicRMWMin (Register OldValRes, Register Addr, Register Val, MachineMemOperand &MMO)
 Build and insert OldValRes<def> = G_ATOMICRMW_MIN Addr, Val, MMO.
 
MachineInstrBuilder buildAtomicRMWUmax (Register OldValRes, Register Addr, Register Val, MachineMemOperand &MMO)
 Build and insert OldValRes<def> = G_ATOMICRMW_UMAX Addr, Val, MMO.
 
MachineInstrBuilder buildAtomicRMWUmin (Register OldValRes, Register Addr, Register Val, MachineMemOperand &MMO)
 Build and insert OldValRes<def> = G_ATOMICRMW_UMIN Addr, Val, MMO.
 
MachineInstrBuilder buildAtomicRMWFAdd (const DstOp &OldValRes, const SrcOp &Addr, const SrcOp &Val, MachineMemOperand &MMO)
 Build and insert OldValRes<def> = G_ATOMICRMW_FADD Addr, Val, MMO.
 
MachineInstrBuilder buildAtomicRMWFSub (const DstOp &OldValRes, const SrcOp &Addr, const SrcOp &Val, MachineMemOperand &MMO)
 Build and insert OldValRes<def> = G_ATOMICRMW_FSUB Addr, Val, MMO.
 
MachineInstrBuilder buildAtomicRMWFMax (const DstOp &OldValRes, const SrcOp &Addr, const SrcOp &Val, MachineMemOperand &MMO)
 Build and insert OldValRes<def> = G_ATOMICRMW_FMAX Addr, Val, MMO.
 
MachineInstrBuilder buildAtomicRMWFMin (const DstOp &OldValRes, const SrcOp &Addr, const SrcOp &Val, MachineMemOperand &MMO)
 Build and insert OldValRes<def> = G_ATOMICRMW_FMIN Addr, Val, MMO.
 
MachineInstrBuilder buildAtomicRMWUSubCond (const DstOp &OldValRes, const SrcOp &Addr, const SrcOp &Val, MachineMemOperand &MMO)
 Build and insert OldValRes<def> = G_ATOMICRMW_USUB_COND Addr, Val, MMO.
 
MachineInstrBuilder buildAtomicRMWUSubSat (const DstOp &OldValRes, const SrcOp &Addr, const SrcOp &Val, MachineMemOperand &MMO)
 Build and insert OldValRes<def> = G_ATOMICRMW_USUB_SAT Addr, Val, MMO.
 
MachineInstrBuilder buildFence (unsigned Ordering, unsigned Scope)
 Build and insert G_FENCE Ordering, Scope.
 
MachineInstrBuilder buildPrefetch (const SrcOp &Addr, unsigned RW, unsigned Locality, unsigned CacheType, MachineMemOperand &MMO)
 Build and insert G_PREFETCH Addr, RW, Locality, CacheType.
 
MachineInstrBuilder buildFreeze (const DstOp &Dst, const SrcOp &Src)
 Build and insert Dst = G_FREEZE Src.
 
MachineInstrBuilder buildBlockAddress (Register Res, const BlockAddress *BA)
 Build and insert Res = G_BLOCK_ADDR BA.
 
MachineInstrBuilder buildAdd (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
 Build and insert Res = G_ADD Op0, Op1.
 
MachineInstrBuilder buildSub (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
 Build and insert Res = G_SUB Op0, Op1.
 
MachineInstrBuilder buildMul (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
 Build and insert Res = G_MUL Op0, Op1.
 
MachineInstrBuilder buildAbds (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1)
 Build and insert Res = G_ABDS Op0, Op1.
 
MachineInstrBuilder buildAbdu (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1)
 Build and insert Res = G_ABDU Op0, Op1.
 
MachineInstrBuilder buildUMulH (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
 
MachineInstrBuilder buildSMulH (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
 
MachineInstrBuilder buildURem (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
 Build and insert Res = G_UREM Op0, Op1.
 
MachineInstrBuilder buildFMul (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
 
MachineInstrBuilder buildFMinNum (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
 
MachineInstrBuilder buildFMaxNum (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
 
MachineInstrBuilder buildFMinNumIEEE (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
 
MachineInstrBuilder buildFMaxNumIEEE (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
 
MachineInstrBuilder buildShl (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
 
MachineInstrBuilder buildLShr (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
 
MachineInstrBuilder buildAShr (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
 
MachineInstrBuilder buildAnd (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1)
 Build and insert Res = G_AND Op0, Op1.
 
MachineInstrBuilder buildOr (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
 Build and insert Res = G_OR Op0, Op1.
 
MachineInstrBuilder buildXor (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1)
 Build and insert Res = G_XOR Op0, Op1.
 
MachineInstrBuilder buildNot (const DstOp &Dst, const SrcOp &Src0)
 Build and insert a bitwise not, NegOne = G_CONSTANT -1 Res = G_OR Op0, NegOne.
 
MachineInstrBuilder buildNeg (const DstOp &Dst, const SrcOp &Src0)
 Build and insert integer negation Zero = G_CONSTANT 0 Res = G_SUB Zero, Op0.
 
MachineInstrBuilder buildCTPOP (const DstOp &Dst, const SrcOp &Src0)
 Build and insert Res = G_CTPOP Op0, Src0.
 
MachineInstrBuilder buildCTLZ (const DstOp &Dst, const SrcOp &Src0)
 Build and insert Res = G_CTLZ Op0, Src0.
 
MachineInstrBuilder buildCTLZ_ZERO_UNDEF (const DstOp &Dst, const SrcOp &Src0)
 Build and insert Res = G_CTLZ_ZERO_UNDEF Op0, Src0.
 
MachineInstrBuilder buildCTTZ (const DstOp &Dst, const SrcOp &Src0)
 Build and insert Res = G_CTTZ Op0, Src0.
 
MachineInstrBuilder buildCTTZ_ZERO_UNDEF (const DstOp &Dst, const SrcOp &Src0)
 Build and insert Res = G_CTTZ_ZERO_UNDEF Op0, Src0.
 
MachineInstrBuilder buildBSwap (const DstOp &Dst, const SrcOp &Src0)
 Build and insert Dst = G_BSWAP Src0.
 
MachineInstrBuilder buildFAdd (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
 Build and insert Res = G_FADD Op0, Op1.
 
MachineInstrBuilder 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.
 
MachineInstrBuilder buildFSub (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
 Build and insert Res = G_FSUB Op0, Op1.
 
MachineInstrBuilder buildFDiv (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
 Build and insert Res = G_FDIV Op0, Op1.
 
MachineInstrBuilder 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.
 
MachineInstrBuilder 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.
 
MachineInstrBuilder buildFNeg (const DstOp &Dst, const SrcOp &Src0, std::optional< unsigned > Flags=std::nullopt)
 Build and insert Res = G_FNEG Op0.
 
MachineInstrBuilder buildFAbs (const DstOp &Dst, const SrcOp &Src0, std::optional< unsigned > Flags=std::nullopt)
 Build and insert Res = G_FABS Op0.
 
MachineInstrBuilder buildFCanonicalize (const DstOp &Dst, const SrcOp &Src0, std::optional< unsigned > Flags=std::nullopt)
 Build and insert Dst = G_FCANONICALIZE Src0.
 
MachineInstrBuilder buildIntrinsicTrunc (const DstOp &Dst, const SrcOp &Src0, std::optional< unsigned > Flags=std::nullopt)
 Build and insert Dst = G_INTRINSIC_TRUNC Src0.
 
MachineInstrBuilder buildFFloor (const DstOp &Dst, const SrcOp &Src0, std::optional< unsigned > Flags=std::nullopt)
 Build and insert Res = GFFLOOR Op0, Op1.
 
MachineInstrBuilder buildFLog (const DstOp &Dst, const SrcOp &Src, std::optional< unsigned > Flags=std::nullopt)
 Build and insert Dst = G_FLOG Src.
 
MachineInstrBuilder buildFLog2 (const DstOp &Dst, const SrcOp &Src, std::optional< unsigned > Flags=std::nullopt)
 Build and insert Dst = G_FLOG2 Src.
 
MachineInstrBuilder buildFExp2 (const DstOp &Dst, const SrcOp &Src, std::optional< unsigned > Flags=std::nullopt)
 Build and insert Dst = G_FEXP2 Src.
 
MachineInstrBuilder buildFPow (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
 Build and insert Dst = G_FPOW Src0, Src1.
 
MachineInstrBuilder buildFLdexp (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, std::optional< unsigned > Flags=std::nullopt)
 Build and insert Dst = G_FLDEXP Src0, Src1.
 
MachineInstrBuilder buildFFrexp (const DstOp &Fract, const DstOp &Exp, const SrcOp &Src, std::optional< unsigned > Flags=std::nullopt)
 Build and insert Fract, Exp = G_FFREXP Src.
 
MachineInstrBuilder buildFSincos (const DstOp &Sin, const DstOp &Cos, const SrcOp &Src, std::optional< unsigned > Flags=std::nullopt)
 Build and insert Sin, Cos = G_FSINCOS Src.
 
MachineInstrBuilder buildFCopysign (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1)
 Build and insert Res = G_FCOPYSIGN Op0, Op1.
 
MachineInstrBuilder buildUITOFP (const DstOp &Dst, const SrcOp &Src0)
 Build and insert Res = G_UITOFP Src0.
 
MachineInstrBuilder buildSITOFP (const DstOp &Dst, const SrcOp &Src0)
 Build and insert Res = G_SITOFP Src0.
 
MachineInstrBuilder buildFPTOUI (const DstOp &Dst, const SrcOp &Src0)
 Build and insert Res = G_FPTOUI Src0.
 
MachineInstrBuilder buildFPTOSI (const DstOp &Dst, const SrcOp &Src0)
 Build and insert Res = G_FPTOSI Src0.
 
MachineInstrBuilder buildFPTOUI_SAT (const DstOp &Dst, const SrcOp &Src0)
 Build and insert Res = G_FPTOUI_SAT Src0.
 
MachineInstrBuilder buildFPTOSI_SAT (const DstOp &Dst, const SrcOp &Src0)
 Build and insert Res = G_FPTOSI_SAT Src0.
 
MachineInstrBuilder buildIntrinsicRoundeven (const DstOp &Dst, const SrcOp &Src0, std::optional< unsigned > Flags=std::nullopt)
 Build and insert Dst = G_INTRINSIC_ROUNDEVEN Src0, Src1.
 
MachineInstrBuilder buildSMin (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1)
 Build and insert Res = G_SMIN Op0, Op1.
 
MachineInstrBuilder buildSMax (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1)
 Build and insert Res = G_SMAX Op0, Op1.
 
MachineInstrBuilder buildUMin (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1)
 Build and insert Res = G_UMIN Op0, Op1.
 
MachineInstrBuilder buildUMax (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1)
 Build and insert Res = G_UMAX Op0, Op1.
 
MachineInstrBuilder buildAbs (const DstOp &Dst, const SrcOp &Src)
 Build and insert Dst = G_ABS Src.
 
MachineInstrBuilder buildJumpTable (const LLT PtrTy, unsigned JTI)
 Build and insert Res = G_JUMP_TABLE JTI.
 
MachineInstrBuilder buildVecReduceSeqFAdd (const DstOp &Dst, const SrcOp &ScalarIn, const SrcOp &VecIn)
 Build and insert Res = G_VECREDUCE_SEQ_FADD ScalarIn, VecIn.
 
MachineInstrBuilder buildVecReduceSeqFMul (const DstOp &Dst, const SrcOp &ScalarIn, const SrcOp &VecIn)
 Build and insert Res = G_VECREDUCE_SEQ_FMUL ScalarIn, VecIn.
 
MachineInstrBuilder buildVecReduceFAdd (const DstOp &Dst, const SrcOp &ScalarIn, const SrcOp &VecIn)
 Build and insert Res = G_VECREDUCE_FADD Src.
 
MachineInstrBuilder buildVecReduceFMul (const DstOp &Dst, const SrcOp &ScalarIn, const SrcOp &VecIn)
 Build and insert Res = G_VECREDUCE_FMUL Src.
 
MachineInstrBuilder buildVecReduceFMax (const DstOp &Dst, const SrcOp &Src)
 Build and insert Res = G_VECREDUCE_FMAX Src.
 
MachineInstrBuilder buildVecReduceFMin (const DstOp &Dst, const SrcOp &Src)
 Build and insert Res = G_VECREDUCE_FMIN Src.
 
MachineInstrBuilder buildVecReduceFMaximum (const DstOp &Dst, const SrcOp &Src)
 Build and insert Res = G_VECREDUCE_FMAXIMUM Src.
 
MachineInstrBuilder buildVecReduceFMinimum (const DstOp &Dst, const SrcOp &Src)
 Build and insert Res = G_VECREDUCE_FMINIMUM Src.
 
MachineInstrBuilder buildVecReduceAdd (const DstOp &Dst, const SrcOp &Src)
 Build and insert Res = G_VECREDUCE_ADD Src.
 
MachineInstrBuilder buildVecReduceMul (const DstOp &Dst, const SrcOp &Src)
 Build and insert Res = G_VECREDUCE_MUL Src.
 
MachineInstrBuilder buildVecReduceAnd (const DstOp &Dst, const SrcOp &Src)
 Build and insert Res = G_VECREDUCE_AND Src.
 
MachineInstrBuilder buildVecReduceOr (const DstOp &Dst, const SrcOp &Src)
 Build and insert Res = G_VECREDUCE_OR Src.
 
MachineInstrBuilder buildVecReduceXor (const DstOp &Dst, const SrcOp &Src)
 Build and insert Res = G_VECREDUCE_XOR Src.
 
MachineInstrBuilder buildVecReduceSMax (const DstOp &Dst, const SrcOp &Src)
 Build and insert Res = G_VECREDUCE_SMAX Src.
 
MachineInstrBuilder buildVecReduceSMin (const DstOp &Dst, const SrcOp &Src)
 Build and insert Res = G_VECREDUCE_SMIN Src.
 
MachineInstrBuilder buildVecReduceUMax (const DstOp &Dst, const SrcOp &Src)
 Build and insert Res = G_VECREDUCE_UMAX Src.
 
MachineInstrBuilder buildVecReduceUMin (const DstOp &Dst, const SrcOp &Src)
 Build and insert Res = G_VECREDUCE_UMIN Src.
 
MachineInstrBuilder buildMemTransferInst (unsigned Opcode, const SrcOp &DstPtr, const SrcOp &SrcPtr, const SrcOp &Size, MachineMemOperand &DstMMO, MachineMemOperand &SrcMMO)
 Build and insert G_MEMCPY or G_MEMMOVE.
 
MachineInstrBuilder buildMemCpy (const SrcOp &DstPtr, const SrcOp &SrcPtr, const SrcOp &Size, MachineMemOperand &DstMMO, MachineMemOperand &SrcMMO)
 
MachineInstrBuilder buildTrap (bool Debug=false)
 Build and insert G_TRAP or G_DEBUGTRAP.
 
MachineInstrBuilder buildSbfx (const DstOp &Dst, const SrcOp &Src, const SrcOp &LSB, const SrcOp &Width)
 Build and insert Dst = G_SBFX Src, LSB, Width.
 
MachineInstrBuilder buildUbfx (const DstOp &Dst, const SrcOp &Src, const SrcOp &LSB, const SrcOp &Width)
 Build and insert Dst = G_UBFX Src, LSB, Width.
 
MachineInstrBuilder buildRotateRight (const DstOp &Dst, const SrcOp &Src, const SrcOp &Amt)
 Build and insert Dst = G_ROTR Src, Amt.
 
MachineInstrBuilder buildRotateLeft (const DstOp &Dst, const SrcOp &Src, const SrcOp &Amt)
 Build and insert Dst = G_ROTL Src, Amt.
 
MachineInstrBuilder buildBitReverse (const DstOp &Dst, const SrcOp &Src)
 Build and insert Dst = G_BITREVERSE Src.
 
MachineInstrBuilder buildGetFPEnv (const DstOp &Dst)
 Build and insert Dst = G_GET_FPENV.
 
MachineInstrBuilder buildSetFPEnv (const SrcOp &Src)
 Build and insert G_SET_FPENV Src.
 
MachineInstrBuilder buildResetFPEnv ()
 Build and insert G_RESET_FPENV.
 
MachineInstrBuilder buildGetFPMode (const DstOp &Dst)
 Build and insert Dst = G_GET_FPMODE.
 
MachineInstrBuilder buildSetFPMode (const SrcOp &Src)
 Build and insert G_SET_FPMODE Src.
 
MachineInstrBuilder buildResetFPMode ()
 Build and insert G_RESET_FPMODE.
 
virtual MachineInstrBuilder buildInstr (unsigned Opc, ArrayRef< DstOp > DstOps, ArrayRef< SrcOp > SrcOps, std::optional< unsigned > Flags=std::nullopt)
 
void setMF (MachineFunction &MF)
 
void setMBB (MachineBasicBlock &MBB)
 Set the insertion point to the end of MBB.
 
void setInstr (MachineInstr &MI)
 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
 

Detailed Description

Defines a builder that does CSE of MachineInstructions using GISelCSEInfo.

Eg usage.

&getAnalysis<GISelCSEAnalysisWrapperPass>().getCSEInfo();
CSEMIRBuilder CB(Builder.getState());
CB.setCSEInfo(Info);
auto A = CB.buildConstant(s32, 42);
auto B = CB.buildConstant(s32, 42);
assert(A == B);
unsigned CReg = MRI.createGenericVirtualRegister(s32);
auto C = CB.buildConstant(CReg, 42);
assert(C->getOpcode() == TargetOpcode::COPY);
unsigned const MachineRegisterInfo * MRI
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
Analysis containing CSE Info
Definition: CSEInfo.cpp:27
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Defines a builder that does CSE of MachineInstructions using GISelCSEInfo.
Definition: CSEMIRBuilder.h:38
The CSE Analysis object.
Definition: CSEInfo.h:70
@ C
The default llvm calling convention, compatible with C.
Definition: CallingConv.h:34

Explicitly passing in a register would materialize a copy if possible. CSEMIRBuilder also does trivial constant folding for binary ops.

Definition at line 38 of file CSEMIRBuilder.h.

Member Function Documentation

◆ buildConstant() [1/4]

MachineInstrBuilder MachineIRBuilder::buildConstant ( const DstOp Res,
const APInt Val 
)

◆ buildConstant() [2/4]

MachineInstrBuilder MachineIRBuilder::buildConstant ( const DstOp Res,
const ConstantInt Val 
)
virtual

Build and insert Res = G_CONSTANT Val.

G_CONSTANT is an integer constant with the specified size and value. Val will be extended or truncated to the size of Reg.

Precondition
setBasicBlock or setMI must have been called.
Res must be a generic virtual register with scalar or pointer type.
Returns
The newly created instruction.

Reimplemented from llvm::MachineIRBuilder.

Definition at line 871 of file MachineIRBuilder.cpp.

◆ buildConstant() [3/4]

MachineInstrBuilder CSEMIRBuilder::buildConstant ( const DstOp Res,
const ConstantInt Val 
)
overridevirtual

Build and insert Res = G_CONSTANT Val.

G_CONSTANT is an integer constant with the specified size and value. Val will be extended or truncated to the size of Reg.

Precondition
setBasicBlock or setMI must have been called.
Res must be a generic virtual register with scalar or pointer type.
Returns
The newly created instruction.

Reimplemented from llvm::MachineIRBuilder.

Definition at line 334 of file CSEMIRBuilder.cpp.

References llvm::GISelInstProfileBuilder::addNodeIDMachineOperand(), llvm::MachineIRBuilder::buildConstant(), buildConstant(), llvm::MachineIRBuilder::buildSplatBuildVector(), llvm::MachineOperand::CreateCImm(), llvm::LLT::getElementType(), llvm::DstOp::getLLTTy(), llvm::MachineIRBuilder::getMRI(), and llvm::LLT::isVector().

Referenced by buildConstant(), and buildInstr().

◆ buildConstant() [4/4]

MachineInstrBuilder MachineIRBuilder::buildConstant ( const DstOp Res,
int64_t  Val 
)

Build and insert Res = G_CONSTANT Val.

G_CONSTANT is an integer constant with the specified size and value.

Precondition
setBasicBlock or setMI must have been called.
Res must be a generic virtual register with scalar type.
Returns
The newly created instruction.

Definition at line 882 of file MachineIRBuilder.cpp.

◆ buildFConstant() [1/4]

MachineInstrBuilder MachineIRBuilder::buildFConstant ( const DstOp Res,
const APFloat Val 
)

Definition at line 898 of file MachineIRBuilder.cpp.

◆ buildFConstant() [2/4]

MachineInstrBuilder MachineIRBuilder::buildFConstant ( const DstOp Res,
const ConstantFP Val 
)
virtual

Build and insert Res = G_FCONSTANT Val.

G_FCONSTANT is a floating-point constant with the specified size and value.

Precondition
setBasicBlock or setMI must have been called.
Res must be a generic virtual register with scalar type.
Returns
The newly created instruction.

Reimplemented from llvm::MachineIRBuilder.

Definition at line 894 of file MachineIRBuilder.cpp.

◆ buildFConstant() [3/4]

MachineInstrBuilder CSEMIRBuilder::buildFConstant ( const DstOp Res,
const ConstantFP Val 
)
overridevirtual

Build and insert Res = G_FCONSTANT Val.

G_FCONSTANT is a floating-point constant with the specified size and value.

Precondition
setBasicBlock or setMI must have been called.
Res must be a generic virtual register with scalar type.
Returns
The newly created instruction.

Reimplemented from llvm::MachineIRBuilder.

Definition at line 361 of file CSEMIRBuilder.cpp.

References llvm::GISelInstProfileBuilder::addNodeIDMachineOperand(), llvm::MachineIRBuilder::buildFConstant(), buildFConstant(), llvm::MachineIRBuilder::buildSplatBuildVector(), llvm::MachineOperand::CreateFPImm(), llvm::LLT::getElementType(), llvm::DstOp::getLLTTy(), llvm::MachineIRBuilder::getMRI(), and llvm::LLT::isVector().

Referenced by buildFConstant(), and buildInstr().

◆ buildFConstant() [4/4]

MachineInstrBuilder MachineIRBuilder::buildFConstant ( const DstOp Res,
double  Val 
)

Definition at line 897 of file MachineIRBuilder.cpp.

◆ buildInstr()

MachineInstrBuilder CSEMIRBuilder::buildInstr ( unsigned  Opc,
ArrayRef< DstOp DstOps,
ArrayRef< SrcOp SrcOps,
std::optional< unsigned Flag = std::nullopt 
)
overridevirtual

◆ MachineIRBuilder() [1/6]

llvm::MachineIRBuilder::MachineIRBuilder ( )
default

Some constructors for easy use.

◆ MachineIRBuilder() [2/6]

llvm::MachineIRBuilder::MachineIRBuilder ( const MachineIRBuilderState BState)
inline

Definition at line 279 of file MachineIRBuilder.h.

◆ MachineIRBuilder() [3/6]

llvm::MachineIRBuilder::MachineIRBuilder ( MachineBasicBlock MBB,
MachineBasicBlock::iterator  InsPt 
)
inline

Definition at line 261 of file MachineIRBuilder.h.

◆ MachineIRBuilder() [4/6]

llvm::MachineIRBuilder::MachineIRBuilder ( MachineFunction MF)
inline

Definition at line 259 of file MachineIRBuilder.h.

◆ MachineIRBuilder() [5/6]

llvm::MachineIRBuilder::MachineIRBuilder ( MachineInstr MI)
inline

Definition at line 266 of file MachineIRBuilder.h.

◆ MachineIRBuilder() [6/6]

llvm::MachineIRBuilder::MachineIRBuilder ( MachineInstr MI,
GISelChangeObserver Observer 
)
inline

Definition at line 272 of file MachineIRBuilder.h.


The documentation for this class was generated from the following files: