LLVM  8.0.0svn
Public Member Functions | Protected Member Functions | List of all members
llvm::MachineIRBuilderBase Class Reference

Helper class to build MachineInstr. More...

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

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

Public Member Functions

 MachineIRBuilderBase ()=default
 Some constructors for easy use. More...
 
 MachineIRBuilderBase (MachineFunction &MF)
 
 MachineIRBuilderBase (MachineInstr &MI)
 
 MachineIRBuilderBase (const MachineIRBuilderState &BState)
 
const TargetInstrInfogetTII ()
 
MachineFunctiongetMF ()
 Getter for the function we currently build. More...
 
const DebugLocgetDL ()
 Getter for DebugLoc. More...
 
MachineRegisterInfogetMRI ()
 Getter for MRI. More...
 
MachineIRBuilderStategetState ()
 Getter for the State. More...
 
MachineBasicBlockgetMBB ()
 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 setChangeObserver (GISelChangeObserver &Observer)
 
void stopObservingChanges ()
 
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 buildDbgLabel (const MDNode *Label)
 Build and insert a DBG_LABEL instructions specifying that Label is given. 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< MachineInstrBuildermaterializeGEP (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 buildBuildVector (unsigned Res, ArrayRef< unsigned > Ops)
 Build and insert Res = G_BUILD_VECTOR Op0, ... More...
 
MachineInstrBuilder buildBuildVectorTrunc (unsigned Res, ArrayRef< unsigned > Ops)
 Build and insert Res = G_BUILD_VECTOR_TRUNC Op0, ... More...
 
MachineInstrBuilder buildConcatVectors (unsigned Res, ArrayRef< unsigned > Ops)
 Build and insert Res = G_CONCAT_VECTORS Op0, ... 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...
 
template<typename DstTy , typename... UseArgsTy>
MachineInstrBuilder buildICmp (CmpInst::Predicate Pred, DstTy &&Dst, UseArgsTy &&... UseArgs)
 
MachineInstrBuilder buildFCmp (CmpInst::Predicate Pred, unsigned Res, unsigned Op0, unsigned Op1)
 Build and insert a Res = G_FCMP PredOp0, Op1. More...
 
MachineInstrBuilder buildSelect (unsigned Res, unsigned Tst, unsigned Op0, unsigned Op1)
 Build and insert a Res = G_SELECT Tst, Op0, Op1. More...
 
template<typename DstTy , typename... UseArgsTy>
MachineInstrBuilder buildSelect (DstTy &&Dst, UseArgsTy &&... UseArgs)
 
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...
 
Setters for the insertion point.

Set the MachineFunction where to build instructions.

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...
 

Protected Member Functions

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)
 

Detailed Description

Helper class to build MachineInstr.

It keeps internally the insertion point and debug location for all the new instructions we want to create. This information can be modify via the related setters.

Definition at line 61 of file MachineIRBuilder.h.

Constructor & Destructor Documentation

◆ MachineIRBuilderBase() [1/4]

llvm::MachineIRBuilderBase::MachineIRBuilderBase ( )
default

Some constructors for easy use.

◆ MachineIRBuilderBase() [2/4]

llvm::MachineIRBuilderBase::MachineIRBuilderBase ( MachineFunction MF)
inline

Definition at line 100 of file MachineIRBuilder.h.

◆ MachineIRBuilderBase() [3/4]

llvm::MachineIRBuilderBase::MachineIRBuilderBase ( MachineInstr MI)
inline

Definition at line 101 of file MachineIRBuilder.h.

◆ MachineIRBuilderBase() [4/4]

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

Definition at line 105 of file MachineIRBuilder.h.

Member Function Documentation

◆ addUseFromArg() [1/2]

void llvm::MachineIRBuilderBase::addUseFromArg ( MachineInstrBuilder MIB,
unsigned  Reg 
)
inlineprotected

Definition at line 76 of file MachineIRBuilder.h.

References llvm::MachineInstrBuilder::addUse().

◆ addUseFromArg() [2/2]

void llvm::MachineIRBuilderBase::addUseFromArg ( MachineInstrBuilder MIB,
const MachineInstrBuilder UseMIB 
)
inlineprotected

◆ addUsesFromArgs() [1/2]

void llvm::MachineIRBuilderBase::addUsesFromArgs ( MachineInstrBuilder MIB)
inlineprotected

Definition at line 84 of file MachineIRBuilder.h.

Referenced by llvm::ConstantFoldingMIRBuilder::buildInstr().

◆ addUsesFromArgs() [2/2]

template<typename UseArgTy , typename ... UseArgsTy>
void llvm::MachineIRBuilderBase::addUsesFromArgs ( MachineInstrBuilder MIB,
UseArgTy &&  Arg1,
UseArgsTy &&...  Args 
)
inlineprotected

Definition at line 86 of file MachineIRBuilder.h.

References llvm::AMDGPU::HSAMD::Kernel::Key::Args.

◆ buildAnyExt() [1/2]

MachineInstrBuilder MachineIRBuilderBase::buildAnyExt ( unsigned  Res,
unsigned  Op 
)

Build and insert Res = G_ANYEXT Op0.

G_ANYEXT produces a register of the specified width, with bits 0 to sizeof(Ty) * 8 set to Op. The remaining bits are unspecified (i.e. this is neither zero nor sign-extension). For a vector register, each element is extended individually.

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

Definition at line 338 of file MachineIRBuilder.cpp.

References llvm::MachineInstrBuilder::addDef(), llvm::MachineInstrBuilder::addUse(), and buildInstr().

Referenced by llvm::AArch64CallLowering::AArch64CallLowering(), llvm::CallLowering::ValueHandler::extendRegister(), llvm::LegalizerHelper::lower(), and llvm::X86CallLowering::X86CallLowering().

◆ buildAnyExt() [2/2]

template<typename DstType , typename ArgType >
MachineInstrBuilder llvm::MachineIRBuilderBase::buildAnyExt ( DstType &&  Res,
ArgType &&  Arg 
)
inline

Definition at line 321 of file MachineIRBuilder.h.

References Arg.

◆ buildAnyExtOrTrunc() [1/2]

template<typename DstTy , typename UseArgTy >
MachineInstrBuilder llvm::MachineIRBuilderBase::buildAnyExtOrTrunc ( DstTy &&  Dst,
UseArgTy &&  Use 
)
inline

Res = COPY Op depending on the differing sizes of Res and Op.

///

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

Definition at line 398 of file MachineIRBuilder.h.

Referenced by llvm::LegalizationArtifactCombiner::tryCombineAnyExt(), llvm::LegalizationArtifactCombiner::tryCombineSExt(), and llvm::LegalizationArtifactCombiner::tryCombineZExt().

◆ buildAnyExtOrTrunc() [2/2]

MachineInstrBuilder MachineIRBuilderBase::buildAnyExtOrTrunc ( unsigned  Res,
unsigned  Op 
)

Definition at line 387 of file MachineIRBuilder.cpp.

References buildExtOrTrunc().

◆ buildAtomicCmpXchg()

MachineInstrBuilder MachineIRBuilderBase::buildAtomicCmpXchg ( unsigned  OldValRes,
unsigned  Addr,
unsigned  CmpVal,
unsigned  NewVal,
MachineMemOperand MMO 
)

Build and insert OldValRes<def> = G_ATOMIC_CMPXCHG Addr, CmpVal, NewVal, MMO.

Atomically replace the value at Addr with NewVal if it is currently CmpVal otherwise leaves it unchanged. Puts the original value from Addr in Res.

Precondition
setBasicBlock or setMI must have been called.
OldValRes must be a generic virtual register of scalar type.
Addr must be a generic virtual register with pointer type.
OldValRes, CmpVal, and NewVal must be generic virtual registers of the same type.
Returns
a MachineInstrBuilder for the newly created instruction.

Definition at line 765 of file MachineIRBuilder.cpp.

References llvm::MachineInstrBuilder::addDef(), llvm::MachineInstrBuilder::addMemOperand(), llvm::MachineInstrBuilder::addUse(), assert(), buildInstr(), getMRI(), llvm::MachineRegisterInfo::getType(), llvm::LLT::isPointer(), llvm::LLT::isScalar(), and llvm::LLT::isValid().

Referenced by llvm::LegalizerHelper::lower().

◆ buildAtomicCmpXchgWithSuccess()

MachineInstrBuilder MachineIRBuilderBase::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.

Atomically replace the value at Addr with NewVal if it is currently CmpVal otherwise leaves it unchanged. Puts the original value from Addr in Res, along with an s1 indicating whether it was replaced.

Precondition
setBasicBlock or setMI must have been called.
OldValRes must be a generic virtual register of scalar type.
SuccessRes must be a generic virtual register of scalar type. It will be assigned 0 on failure and 1 on success.
Addr must be a generic virtual register with pointer type.
OldValRes, CmpVal, and NewVal must be generic virtual registers of the same type.
Returns
a MachineInstrBuilder for the newly created instruction.

Definition at line 737 of file MachineIRBuilder.cpp.

References llvm::MachineInstrBuilder::addDef(), llvm::MachineInstrBuilder::addMemOperand(), llvm::MachineInstrBuilder::addUse(), assert(), buildInstr(), getMRI(), llvm::MachineRegisterInfo::getType(), llvm::LLT::isPointer(), llvm::LLT::isScalar(), and llvm::LLT::isValid().

Referenced by getOffsetFromIndices().

◆ buildAtomicRMW()

MachineInstrBuilder MachineIRBuilderBase::buildAtomicRMW ( unsigned  Opcode,
unsigned  OldValRes,
unsigned  Addr,
unsigned  Val,
MachineMemOperand MMO 
)

Build and insert OldValRes<def> = G_ATOMICRMW_<Opcode> Addr, Val, MMO.

Atomically read-modify-update the value at Addr with Val. Puts the original value from Addr in OldValRes. The modification is determined by the opcode.

Precondition
setBasicBlock or setMI must have been called.
OldValRes must be a generic virtual register.
Addr must be a generic virtual register with pointer type.
OldValRes, and Val must be generic virtual registers of the same type.
Returns
a MachineInstrBuilder for the newly created instruction.

Definition at line 790 of file MachineIRBuilder.cpp.

References llvm::MachineInstrBuilder::addDef(), llvm::MachineInstrBuilder::addMemOperand(), llvm::MachineInstrBuilder::addUse(), assert(), buildInstr(), getMRI(), llvm::MachineRegisterInfo::getType(), llvm::LLT::isPointer(), llvm::LLT::isScalar(), and llvm::LLT::isValid().

Referenced by buildAtomicRMWAdd(), buildAtomicRMWAnd(), buildAtomicRMWMax(), buildAtomicRMWMin(), buildAtomicRMWNand(), buildAtomicRMWOr(), buildAtomicRMWSub(), buildAtomicRMWUmax(), buildAtomicRMWUmin(), buildAtomicRMWXchg(), buildAtomicRMWXor(), and getOffsetFromIndices().

◆ buildAtomicRMWAdd()

MachineInstrBuilder MachineIRBuilderBase::buildAtomicRMWAdd ( unsigned  OldValRes,
unsigned  Addr,
unsigned  Val,
MachineMemOperand MMO 
)

Build and insert OldValRes<def> = G_ATOMICRMW_ADD Addr, Val, MMO.

Atomically replace the value at Addr with the addition of Val and the original value. Puts the original value from Addr in OldValRes.

Precondition
setBasicBlock or setMI must have been called.
OldValRes must be a generic virtual register.
Addr must be a generic virtual register with pointer type.
OldValRes, and Val must be generic virtual registers of the same type.
Returns
a MachineInstrBuilder for the newly created instruction.

Definition at line 817 of file MachineIRBuilder.cpp.

References buildAtomicRMW().

◆ buildAtomicRMWAnd()

MachineInstrBuilder MachineIRBuilderBase::buildAtomicRMWAnd ( unsigned  OldValRes,
unsigned  Addr,
unsigned  Val,
MachineMemOperand MMO 
)

Build and insert OldValRes<def> = G_ATOMICRMW_AND Addr, Val, MMO.

Atomically replace the value at Addr with the bitwise and of Val and the original value. Puts the original value from Addr in OldValRes.

Precondition
setBasicBlock or setMI must have been called.
OldValRes must be a generic virtual register.
Addr must be a generic virtual register with pointer type.
OldValRes, and Val must be generic virtual registers of the same type.
Returns
a MachineInstrBuilder for the newly created instruction.

Definition at line 829 of file MachineIRBuilder.cpp.

References buildAtomicRMW().

◆ buildAtomicRMWMax()

MachineInstrBuilder MachineIRBuilderBase::buildAtomicRMWMax ( unsigned  OldValRes,
unsigned  Addr,
unsigned  Val,
MachineMemOperand MMO 
)

Build and insert OldValRes<def> = G_ATOMICRMW_MAX Addr, Val, MMO.

Atomically replace the value at Addr with the signed maximum of Val and the original value. Puts the original value from Addr in OldValRes.

Precondition
setBasicBlock or setMI must have been called.
OldValRes must be a generic virtual register.
Addr must be a generic virtual register with pointer type.
OldValRes, and Val must be generic virtual registers of the same type.
Returns
a MachineInstrBuilder for the newly created instruction.

Definition at line 853 of file MachineIRBuilder.cpp.

References buildAtomicRMW().

◆ buildAtomicRMWMin()

MachineInstrBuilder MachineIRBuilderBase::buildAtomicRMWMin ( unsigned  OldValRes,
unsigned  Addr,
unsigned  Val,
MachineMemOperand MMO 
)

Build and insert OldValRes<def> = G_ATOMICRMW_MIN Addr, Val, MMO.

Atomically replace the value at Addr with the signed minimum of Val and the original value. Puts the original value from Addr in OldValRes.

Precondition
setBasicBlock or setMI must have been called.
OldValRes must be a generic virtual register.
Addr must be a generic virtual register with pointer type.
OldValRes, and Val must be generic virtual registers of the same type.
Returns
a MachineInstrBuilder for the newly created instruction.

Definition at line 859 of file MachineIRBuilder.cpp.

References buildAtomicRMW().

◆ buildAtomicRMWNand()

MachineInstrBuilder MachineIRBuilderBase::buildAtomicRMWNand ( unsigned  OldValRes,
unsigned  Addr,
unsigned  Val,
MachineMemOperand MMO 
)

Build and insert OldValRes<def> = G_ATOMICRMW_NAND Addr, Val, MMO.

Atomically replace the value at Addr with the bitwise nand of Val and the original value. Puts the original value from Addr in OldValRes.

Precondition
setBasicBlock or setMI must have been called.
OldValRes must be a generic virtual register.
Addr must be a generic virtual register with pointer type.
OldValRes, and Val must be generic virtual registers of the same type.
Returns
a MachineInstrBuilder for the newly created instruction.

Definition at line 835 of file MachineIRBuilder.cpp.

References buildAtomicRMW().

◆ buildAtomicRMWOr()

MachineInstrBuilder MachineIRBuilderBase::buildAtomicRMWOr ( unsigned  OldValRes,
unsigned  Addr,
unsigned  Val,
MachineMemOperand MMO 
)

Build and insert OldValRes<def> = G_ATOMICRMW_OR Addr, Val, MMO.

Atomically replace the value at Addr with the bitwise or of Val and the original value. Puts the original value from Addr in OldValRes.

Precondition
setBasicBlock or setMI must have been called.
OldValRes must be a generic virtual register.
Addr must be a generic virtual register with pointer type.
OldValRes, and Val must be generic virtual registers of the same type.
Returns
a MachineInstrBuilder for the newly created instruction.

Definition at line 841 of file MachineIRBuilder.cpp.

References buildAtomicRMW().

◆ buildAtomicRMWSub()

MachineInstrBuilder MachineIRBuilderBase::buildAtomicRMWSub ( unsigned  OldValRes,
unsigned  Addr,
unsigned  Val,
MachineMemOperand MMO 
)

Build and insert OldValRes<def> = G_ATOMICRMW_SUB Addr, Val, MMO.

Atomically replace the value at Addr with the subtraction of Val and the original value. Puts the original value from Addr in OldValRes.

Precondition
setBasicBlock or setMI must have been called.
OldValRes must be a generic virtual register.
Addr must be a generic virtual register with pointer type.
OldValRes, and Val must be generic virtual registers of the same type.
Returns
a MachineInstrBuilder for the newly created instruction.

Definition at line 823 of file MachineIRBuilder.cpp.

References buildAtomicRMW().

◆ buildAtomicRMWUmax()

MachineInstrBuilder MachineIRBuilderBase::buildAtomicRMWUmax ( unsigned  OldValRes,
unsigned  Addr,
unsigned  Val,
MachineMemOperand MMO 
)

Build and insert OldValRes<def> = G_ATOMICRMW_UMAX Addr, Val, MMO.

Atomically replace the value at Addr with the unsigned maximum of Val and the original value. Puts the original value from Addr in OldValRes.

Precondition
setBasicBlock or setMI must have been called.
OldValRes must be a generic virtual register.
Addr must be a generic virtual register with pointer type.
OldValRes, and Val must be generic virtual registers of the same type.
Returns
a MachineInstrBuilder for the newly created instruction.

Definition at line 865 of file MachineIRBuilder.cpp.

References buildAtomicRMW().

◆ buildAtomicRMWUmin()

MachineInstrBuilder MachineIRBuilderBase::buildAtomicRMWUmin ( unsigned  OldValRes,
unsigned  Addr,
unsigned  Val,
MachineMemOperand MMO 
)

Build and insert OldValRes<def> = G_ATOMICRMW_UMIN Addr, Val, MMO.

Atomically replace the value at Addr with the unsigned minimum of Val and the original value. Puts the original value from Addr in OldValRes.

Precondition
setBasicBlock or setMI must have been called.
OldValRes must be a generic virtual register.
Addr must be a generic virtual register with pointer type.
OldValRes, and Val must be generic virtual registers of the same type.
Returns
a MachineInstrBuilder for the newly created instruction.

Definition at line 871 of file MachineIRBuilder.cpp.

References buildAtomicRMW().

◆ buildAtomicRMWXchg()

MachineInstrBuilder MachineIRBuilderBase::buildAtomicRMWXchg ( unsigned  OldValRes,
unsigned  Addr,
unsigned  Val,
MachineMemOperand MMO 
)

Build and insert OldValRes<def> = G_ATOMICRMW_XCHG Addr, Val, MMO.

Atomically replace the value at Addr with Val. Puts the original value from Addr in OldValRes.

Precondition
setBasicBlock or setMI must have been called.
OldValRes must be a generic virtual register.
Addr must be a generic virtual register with pointer type.
OldValRes, and Val must be generic virtual registers of the same type.
Returns
a MachineInstrBuilder for the newly created instruction.

Definition at line 811 of file MachineIRBuilder.cpp.

References buildAtomicRMW().

◆ buildAtomicRMWXor()

MachineInstrBuilder MachineIRBuilderBase::buildAtomicRMWXor ( unsigned  OldValRes,
unsigned  Addr,
unsigned  Val,
MachineMemOperand MMO 
)

Build and insert OldValRes<def> = G_ATOMICRMW_XOR Addr, Val, MMO.

Atomically replace the value at Addr with the bitwise xor of Val and the original value. Puts the original value from Addr in OldValRes.

Precondition
setBasicBlock or setMI must have been called.
OldValRes must be a generic virtual register.
Addr must be a generic virtual register with pointer type.
OldValRes, and Val must be generic virtual registers of the same type.
Returns
a MachineInstrBuilder for the newly created instruction.

Definition at line 847 of file MachineIRBuilder.cpp.

References buildAtomicRMW().

◆ buildBlockAddress()

MachineInstrBuilder MachineIRBuilderBase::buildBlockAddress ( unsigned  Res,
const BlockAddress BA 
)

Build and insert Res = G_BLOCK_ADDR BA.

G_BLOCK_ADDR computes the address of a basic block.

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

Definition at line 878 of file MachineIRBuilder.cpp.

References llvm::MachineInstrBuilder::addBlockAddress(), llvm::MachineInstrBuilder::addDef(), assert(), buildInstr(), getMRI(), llvm::LLT::getNumElements(), llvm::LLT::getSizeInBits(), getType(), llvm::MachineRegisterInfo::getType(), llvm::LLT::isScalar(), and llvm::LLT::isVector().

◆ buildBr()

MachineInstrBuilder MachineIRBuilderBase::buildBr ( MachineBasicBlock Dest)

Build and insert G_BR Dest.

G_BR is an unconditional branch to Dest.

Precondition
setBasicBlock or setMI must have been called.
Returns
a MachineInstrBuilder for the newly created instruction.

Definition at line 230 of file MachineIRBuilder.cpp.

References llvm::MachineInstrBuilder::addMBB(), and buildInstr().

Referenced by computeValueLLTs(), and getOffsetFromIndices().

◆ buildBrCond()

MachineInstrBuilder MachineIRBuilderBase::buildBrCond ( unsigned  Tst,
MachineBasicBlock Dest 
)

Build and insert G_BRCOND Tst, Dest.

G_BRCOND is a conditional branch to Dest.

Precondition
setBasicBlock or setMI must have been called.
Tst must be a generic virtual register with scalar type. At the beginning of legalization, this will be a single bit (s1). Targets with interesting flags registers may change this. For a wider type, whether the branch is taken must only depend on bit 0 (for now).
Returns
The newly created instruction.

Definition at line 283 of file MachineIRBuilder.cpp.

References llvm::MachineInstrBuilder::addMBB(), llvm::MachineInstrBuilder::addUse(), assert(), buildInstr(), getMRI(), getType(), and llvm::LegalityPredicates::isScalar().

Referenced by computeValueLLTs().

◆ buildBrIndirect()

MachineInstrBuilder MachineIRBuilderBase::buildBrIndirect ( unsigned  Tgt)

Build and insert G_BRINDIRECT Tgt.

G_BRINDIRECT is an indirect branch to Tgt.

Precondition
setBasicBlock or setMI must have been called.
Tgt must be a generic virtual register with pointer type.
Returns
a MachineInstrBuilder for the newly created instruction.

Definition at line 234 of file MachineIRBuilder.cpp.

References llvm::MachineInstrBuilder::addUse(), assert(), buildInstr(), getMRI(), and getType().

Referenced by computeValueLLTs().

◆ buildBuildVector()

MachineInstrBuilder MachineIRBuilderBase::buildBuildVector ( unsigned  Res,
ArrayRef< unsigned Ops 
)

Build and insert Res = G_BUILD_VECTOR Op0, ...

G_BUILD_VECTOR creates a vector value from multiple scalar registers.

Precondition
setBasicBlock or setMI must have been called.
The entire register Res (and no more) must be covered by the input scalar registers.
The type of all Ops registers must be identical.
Returns
a MachineInstrBuilder for the newly created instruction.

Definition at line 523 of file MachineIRBuilder.cpp.

References assert(), buildInstr(), llvm::ArrayRef< T >::empty(), getMRI(), llvm::LLT::getSizeInBits(), getType(), llvm::MachineRegisterInfo::getType(), llvm::HexagonMCInstrInfo::isVector(), Reg, and llvm::ArrayRef< T >::size().

Referenced by buildBuildVectorTrunc().

◆ buildBuildVectorTrunc()

MachineInstrBuilder MachineIRBuilderBase::buildBuildVectorTrunc ( unsigned  Res,
ArrayRef< unsigned Ops 
)

Build and insert Res = G_BUILD_VECTOR_TRUNC Op0, ...

G_BUILD_VECTOR_TRUNC creates a vector value from multiple scalar registers which have types larger than the destination vector element type, and truncates the values to fit.

If the operands given are already the same size as the vector elt type, then this method will instead create a G_BUILD_VECTOR instruction.

Precondition
setBasicBlock or setMI must have been called.
The type of all Ops registers must be identical.
Returns
a MachineInstrBuilder for the newly created instruction.

Definition at line 542 of file MachineIRBuilder.cpp.

References llvm::MachineInstrBuilder::addDef(), llvm::MachineInstrBuilder::addUse(), assert(), buildBuildVector(), buildInstr(), llvm::ArrayRef< T >::empty(), getMRI(), llvm::getSizeInBits(), getType(), llvm::MachineRegisterInfo::getType(), Reg, and llvm::ArrayRef< T >::size().

◆ buildCast() [1/2]

template<typename DstType , typename ArgType >
MachineInstrBuilder llvm::MachineIRBuilderBase::buildCast ( DstType &&  Res,
ArgType &&  Arg 
)
inline

Build and insert an appropriate cast between two registers of equal size.

Definition at line 417 of file MachineIRBuilder.h.

References Arg.

Referenced by buildExtract(), buildInsert(), buildMerge(), and getOffsetFromIndices().

◆ buildCast() [2/2]

MachineInstrBuilder MachineIRBuilderBase::buildCast ( unsigned  Dst,
unsigned  Src 
)

◆ buildConcatVectors()

MachineInstrBuilder MachineIRBuilderBase::buildConcatVectors ( unsigned  Res,
ArrayRef< unsigned Ops 
)

Build and insert Res = G_CONCAT_VECTORS Op0, ...

G_CONCAT_VECTORS creates a vector from the concatenation of 2 or more vectors.

Precondition
setBasicBlock or setMI must have been called.
The entire register Res (and no more) must be covered by the input registers.
The type of all source operands must be identical.
Returns
a MachineInstrBuilder for the newly created instruction.

Definition at line 561 of file MachineIRBuilder.cpp.

References assert(), buildInstr(), llvm::ArrayRef< T >::empty(), getMRI(), llvm::LLT::getSizeInBits(), getType(), llvm::MachineRegisterInfo::getType(), llvm::HexagonMCInstrInfo::isVector(), Reg, and llvm::ArrayRef< T >::size().

◆ buildConstant() [1/3]

MachineInstrBuilder MachineIRBuilderBase::buildConstant ( unsigned  Res,
const ConstantInt Val 
)

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.

Definition at line 246 of file MachineIRBuilder.cpp.

References llvm::MachineInstrBuilder::addCImm(), llvm::MachineInstrBuilder::addDef(), assert(), buildInstr(), llvm::ConstantInt::get(), llvm::ConstantInt::getBitWidth(), llvm::Function::getContext(), llvm::MachineFunction::getFunction(), getMF(), getMRI(), llvm::LLT::getSizeInBits(), llvm::MachineRegisterInfo::getType(), llvm::ConstantInt::getValue(), llvm::LLT::isPointer(), llvm::LLT::isScalar(), and llvm::APInt::sextOrTrunc().

Referenced by llvm::AArch64CallLowering::AArch64CallLowering(), llvm::ConstantFoldingMIRBuilder::buildBinaryOp(), buildConstant(), llvm::LegalizerHelper::fewerElementsVector(), getOffsetFromIndices(), isSupportedType(), llvm::AArch64LegalizerInfo::legalizeCustom(), llvm::ARMLegalizerInfo::legalizeCustom(), llvm::LegalizerHelper::lower(), llvm::AMDGPUCallLowering::lowerReturn(), materializeGEP(), llvm::LegalizerHelper::narrowScalar(), llvm::LegalizationArtifactCombiner::tryCombineSExt(), llvm::LegalizationArtifactCombiner::tryCombineZExt(), llvm::LegalizationArtifactCombiner::tryFoldImplicitDef(), llvm::LegalizerHelper::widenScalar(), and llvm::X86CallLowering::X86CallLowering().

◆ buildConstant() [2/3]

MachineInstrBuilder MachineIRBuilderBase::buildConstant ( unsigned  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 259 of file MachineIRBuilder.cpp.

References buildConstant(), llvm::IntegerType::get(), llvm::ConstantInt::get(), getFunction(), getMF(), getMRI(), llvm::getSizeInBits(), and getType().

◆ buildConstant() [3/3]

template<typename DstType >
MachineInstrBuilder llvm::MachineIRBuilderBase::buildConstant ( DstType &&  Res,
int64_t  Val 
)
inline

Definition at line 478 of file MachineIRBuilder.h.

◆ buildConstDbgValue()

MachineInstrBuilder MachineIRBuilderBase::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).

Definition at line 127 of file MachineIRBuilder.cpp.

References assert(), buildInstr(), and getDL().

Referenced by getOffsetFromIndices().

◆ buildCopy() [1/2]

MachineInstrBuilder MachineIRBuilderBase::buildCopy ( unsigned  Res,
unsigned  Op 
)

◆ buildCopy() [2/2]

template<typename DstType , typename SrcType >
MachineInstrBuilder llvm::MachineIRBuilderBase::buildCopy ( DstType &&  Res,
SrcType &&  Src 
)
inline

Definition at line 511 of file MachineIRBuilder.h.

◆ buildDbgLabel()

MachineInstrBuilder MachineIRBuilderBase::buildDbgLabel ( const MDNode Label)

Build and insert a DBG_LABEL instructions specifying that Label is given.

Convert "llvm.dbg.label Label" to "DBG_LABEL Label".

Definition at line 150 of file MachineIRBuilder.cpp.

References assert(), buildInstr(), and llvm::MachineIRBuilderState::DL.

Referenced by getOffsetFromIndices().

◆ buildDirectDbgValue()

MachineInstrBuilder MachineIRBuilderBase::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).

Definition at line 88 of file MachineIRBuilder.cpp.

References assert(), llvm::BuildMI(), getDL(), getMF(), getTII(), and insertInstr().

Referenced by getOffsetFromIndices().

◆ buildExtOrTrunc()

MachineInstrBuilder MachineIRBuilderBase::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.

///

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

Definition at line 354 of file MachineIRBuilder.cpp.

References llvm::MachineInstrBuilder::addDef(), llvm::MachineInstrBuilder::addUse(), assert(), buildInstr(), getMRI(), llvm::getSizeInBits(), getType(), llvm::LegalityPredicates::isScalar(), and llvm::HexagonMCInstrInfo::isVector().

Referenced by buildAnyExtOrTrunc(), buildSExtOrTrunc(), and buildZExtOrTrunc().

◆ buildExtract()

MachineInstrBuilder MachineIRBuilderBase::buildExtract ( unsigned  Res,
unsigned  Src,
uint64_t  Index 
)

Build and insert `Res0, ...

= G_EXTRACT Src, Idx0`.

Precondition
setBasicBlock or setMI must have been called.
Res and Src must be generic virtual registers.
Returns
a MachineInstrBuilder for the newly created instruction.

Definition at line 413 of file MachineIRBuilder.cpp.

References llvm::MachineInstrBuilder::addDef(), llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addUse(), assert(), buildCast(), buildInstr(), getMRI(), llvm::getSizeInBits(), and getType().

Referenced by getOffsetFromIndices(), llvm::AArch64CallLowering::lowerCall(), llvm::AArch64CallLowering::lowerReturn(), and llvm::LegalizerHelper::narrowScalar().

◆ buildExtractVectorElement()

MachineInstrBuilder MachineIRBuilderBase::buildExtractVectorElement ( unsigned  Res,
unsigned  Val,
unsigned  Idx 
)

Build and insert Res = G_EXTRACT_VECTOR_ELT Val, Idx.

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

Definition at line 719 of file MachineIRBuilder.cpp.

References llvm::MachineInstrBuilder::addDef(), llvm::MachineInstrBuilder::addUse(), assert(), buildInstr(), llvm::LLT::getElementType(), getMRI(), llvm::MachineRegisterInfo::getType(), llvm::LLT::isPointer(), llvm::LLT::isScalar(), and llvm::LLT::isVector().

Referenced by getOffsetFromIndices().

◆ buildFCmp()

MachineInstrBuilder MachineIRBuilderBase::buildFCmp ( CmpInst::Predicate  Pred,
unsigned  Res,
unsigned  Op0,
unsigned  Op1 
)

Build and insert a Res = G_FCMP PredOp0, Op1.

Precondition
setBasicBlock or setMI must have been called.
Res must be a generic virtual register with scalar or vector type. Typically this starts as s1 or <N x="" s1>="">.
Op0 and Op1 must be generic virtual registers with the same number of elements as Res (or scalar, if Res is scalar).
Pred must be a floating-point predicate.
Returns
a MachineInstrBuilder for the newly created instruction.

Definition at line 645 of file MachineIRBuilder.cpp.

References llvm::MachineInstrBuilder::addDef(), llvm::MachineInstrBuilder::addPredicate(), llvm::MachineInstrBuilder::addUse(), assert(), buildInstr(), getMRI(), getType(), llvm::CmpInst::isFPPredicate(), llvm::LegalityPredicates::isScalar(), and llvm::HexagonMCInstrInfo::isVector().

Referenced by computeValueLLTs().

◆ buildFConstant() [1/4]

template<typename DstType >
MachineInstrBuilder llvm::MachineIRBuilderBase::buildFConstant ( DstType &&  Res,
const ConstantFP Val 
)
inline

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.

Definition at line 491 of file MachineIRBuilder.h.

Referenced by buildFConstant(), and llvm::LegalizerHelper::lower().

◆ buildFConstant() [2/4]

MachineInstrBuilder MachineIRBuilderBase::buildFConstant ( unsigned  Res,
const ConstantFP Val 
)

◆ buildFConstant() [3/4]

template<typename DstType >
MachineInstrBuilder llvm::MachineIRBuilderBase::buildFConstant ( DstType &&  Res,
double  Val 
)
inline

Definition at line 497 of file MachineIRBuilder.h.

◆ buildFConstant() [4/4]

MachineInstrBuilder MachineIRBuilderBase::buildFConstant ( unsigned  Res,
double  Val 
)

◆ buildFIDbgValue()

MachineInstrBuilder MachineIRBuilderBase::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).

Definition at line 113 of file MachineIRBuilder.cpp.

References llvm::MachineInstrBuilder::addFrameIndex(), llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addMetadata(), assert(), buildInstr(), and getDL().

◆ buildFPTrunc() [1/2]

template<typename DstType , typename SrcType >
MachineInstrBuilder llvm::MachineIRBuilderBase::buildFPTrunc ( DstType &&  Res,
SrcType &&  Src 
)
inline

Build and insert Res = G_FPTRUNC Op.

G_FPTRUNC converts a floating-point value into one with a smaller type.

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

Definition at line 673 of file MachineIRBuilder.h.

◆ buildFPTrunc() [2/2]

MachineInstrBuilder MachineIRBuilderBase::buildFPTrunc ( unsigned  Res,
unsigned  Op 
)

◆ buildFrameIndex()

MachineInstrBuilder MachineIRBuilderBase::buildFrameIndex ( unsigned  Res,
int  Idx 
)

Build and insert Res = G_FRAME_INDEX Idx.

G_FRAME_INDEX materializes the address of an alloca value or other stack-based object.

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

Definition at line 159 of file MachineIRBuilder.cpp.

References llvm::MachineInstrBuilder::addDef(), llvm::MachineInstrBuilder::addFrameIndex(), assert(), buildInstr(), getMRI(), and getType().

Referenced by llvm::AArch64CallLowering::AArch64CallLowering(), getOffsetFromIndices(), llvm::X86CallLowering::lowerReturn(), and llvm::ARMCallLowering::lowerReturn().

◆ buildGEP()

MachineInstrBuilder MachineIRBuilderBase::buildGEP ( unsigned  Res,
unsigned  Op0,
unsigned  Op1 
)

Build and insert Res = G_GEP Op0, Op1.

G_GEP adds Op1 bytes to the pointer specified by Op0, storing the resulting pointer in Res.

Precondition
setBasicBlock or setMI must have been called.
Res and Op0 must be generic virtual registers with pointer type.
Op1 must be a generic virtual register with scalar type.
Returns
a MachineInstrBuilder for the newly created instruction.

Definition at line 188 of file MachineIRBuilder.cpp.

References llvm::MachineInstrBuilder::addDef(), llvm::MachineInstrBuilder::addUse(), assert(), buildInstr(), getMRI(), getType(), and llvm::LegalityPredicates::isScalar().

Referenced by llvm::AArch64CallLowering::AArch64CallLowering(), getOffsetFromIndices(), isSupportedType(), llvm::AArch64LegalizerInfo::legalizeCustom(), llvm::AMDGPUCallLowering::lowerReturn(), materializeGEP(), and llvm::X86CallLowering::X86CallLowering().

◆ buildGlobalValue()

MachineInstrBuilder MachineIRBuilderBase::buildGlobalValue ( unsigned  Res,
const GlobalValue GV 
)

Build and insert Res = G_GLOBAL_VALUE GV.

G_GLOBAL_VALUE materializes the address of the specified global into Res.

Precondition
setBasicBlock or setMI must have been called.
Res must be a generic virtual register with pointer type in the same address space as GV.
Returns
a MachineInstrBuilder for the newly created instruction.

Definition at line 168 of file MachineIRBuilder.cpp.

References llvm::MachineInstrBuilder::addDef(), llvm::MachineInstrBuilder::addGlobalAddress(), assert(), buildInstr(), llvm::PointerType::getAddressSpace(), getMRI(), getType(), and llvm::GlobalValue::getType().

◆ buildICmp() [1/2]

MachineInstrBuilder MachineIRBuilderBase::buildICmp ( CmpInst::Predicate  Pred,
unsigned  Res,
unsigned  Op0,
unsigned  Op1 
)

Build and insert a Res = G_ICMP Pred, Op0, Op1.

Precondition
setBasicBlock or setMI must have been called.
Res must be a generic virtual register with scalar or vector type. Typically this starts as s1 or <N x="" s1>="">.
Op0 and Op1 must be generic virtual registers with the same number of elements as Res. If Res is a scalar, Op0 must be either a scalar or pointer.
Pred must be an integer predicate.
Returns
a MachineInstrBuilder for the newly created instruction.

Definition at line 623 of file MachineIRBuilder.cpp.

References llvm::MachineInstrBuilder::addDef(), llvm::MachineInstrBuilder::addPredicate(), llvm::MachineInstrBuilder::addUse(), assert(), buildInstr(), getMRI(), getType(), llvm::CmpInst::isIntPredicate(), llvm::LegalityPredicates::isScalar(), and llvm::HexagonMCInstrInfo::isVector().

Referenced by computeValueLLTs(), llvm::LegalizerHelper::fewerElementsVector(), llvm::MipsLegalizerInfo::legalizeCustom(), llvm::ARMLegalizerInfo::legalizeCustom(), llvm::LegalizerHelper::lower(), and llvm::LegalizerHelper::widenScalar().

◆ buildICmp() [2/2]

template<typename DstTy , typename... UseArgsTy>
MachineInstrBuilder llvm::MachineIRBuilderBase::buildICmp ( CmpInst::Predicate  Pred,
DstTy &&  Dst,
UseArgsTy &&...  UseArgs 
)
inline

Definition at line 710 of file MachineIRBuilder.h.

◆ buildIndirectDbgValue()

MachineInstrBuilder MachineIRBuilderBase::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).

Definition at line 100 of file MachineIRBuilder.cpp.

References assert(), llvm::BuildMI(), getDL(), getMF(), getTII(), and insertInstr().

Referenced by getOffsetFromIndices().

◆ buildInsert()

MachineInstrBuilder MachineIRBuilderBase::buildInsert ( unsigned  Res,
unsigned  Src,
unsigned  Op,
unsigned  Index 
)

◆ buildInsertVectorElement()

MachineInstrBuilder MachineIRBuilderBase::buildInsertVectorElement ( unsigned  Res,
unsigned  Val,
unsigned  Elt,
unsigned  Idx 
)

Build and insert Res = G_INSERT_VECTOR_ELT Val, Elt, Idx.

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

Definition at line 698 of file MachineIRBuilder.cpp.

References llvm::MachineInstrBuilder::addDef(), llvm::MachineInstrBuilder::addUse(), assert(), buildInstr(), llvm::LLT::getElementType(), getMRI(), llvm::LLT::getNumElements(), llvm::MachineRegisterInfo::getType(), llvm::LLT::isScalar(), and llvm::LLT::isVector().

Referenced by getOffsetFromIndices().

◆ buildInstr()

MachineInstrBuilder MachineIRBuilderBase::buildInstr ( unsigned  Opcode)

◆ buildInstrNoInsert()

MachineInstrBuilder MachineIRBuilderBase::buildInstrNoInsert ( unsigned  Opcode)

◆ buildIntrinsic()

MachineInstrBuilder MachineIRBuilderBase::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.

Its first operand will be the result register definition unless Reg is NoReg (== 0). The second operand will be the intrinsic's ID.

Callers are expected to add the required definitions and uses afterwards.

Precondition
setBasicBlock or setMI must have been called.
Returns
a MachineInstrBuilder for the newly created instruction.

Definition at line 599 of file MachineIRBuilder.cpp.

References buildInstr().

Referenced by getOffsetFromIndices().

◆ buildLoad()

MachineInstrBuilder MachineIRBuilderBase::buildLoad ( unsigned  Res,
unsigned  Addr,
MachineMemOperand MMO 
)

Build and insert Res = G_LOAD Addr, MMO.

Loads the value stored at Addr. Puts the result in Res.

Precondition
setBasicBlock or setMI must have been called.
Res must be a generic virtual register.
Addr must be a generic virtual register with pointer type.
Returns
a MachineInstrBuilder for the newly created instruction.

Definition at line 290 of file MachineIRBuilder.cpp.

References buildLoadInstr().

Referenced by llvm::AArch64CallLowering::AArch64CallLowering(), computeValueLLTs(), llvm::MipsCallLowering::MipsHandler::handle(), llvm::AArch64LegalizerInfo::legalizeCustom(), llvm::LegalizerHelper::lower(), llvm::X86CallLowering::lowerReturn(), llvm::ARMCallLowering::lowerReturn(), llvm::AMDGPUCallLowering::lowerReturn(), and llvm::LegalizerHelper::narrowScalar().

◆ buildLoadInstr()

MachineInstrBuilder MachineIRBuilderBase::buildLoadInstr ( unsigned  Opcode,
unsigned  Res,
unsigned  Addr,
MachineMemOperand MMO 
)

Build and insert Res = <opcode> Addr, MMO.

Loads the value stored at Addr. Puts the result in Res.

Precondition
setBasicBlock or setMI must have been called.
Res must be a generic virtual register.
Addr must be a generic virtual register with pointer type.
Returns
a MachineInstrBuilder for the newly created instruction.

Definition at line 296 of file MachineIRBuilder.cpp.

References llvm::MachineInstrBuilder::addDef(), llvm::MachineInstrBuilder::addMemOperand(), llvm::MachineInstrBuilder::addUse(), assert(), buildInstr(), getMRI(), and getType().

Referenced by buildLoad().

◆ buildMerge()

MachineInstrBuilder MachineIRBuilderBase::buildMerge ( unsigned  Res,
ArrayRef< unsigned Ops 
)

Build and insert Res = G_MERGE_VALUES Op0, ...

G_MERGE_VALUES combines the input elements contiguously into a larger register.

Precondition
setBasicBlock or setMI must have been called.
The entire register Res (and no more) must be covered by the input registers.
The type of all Ops registers must be identical.
Returns
a MachineInstrBuilder for the newly created instruction.

Definition at line 479 of file MachineIRBuilder.cpp.

References llvm::MachineInstrBuilder::addDef(), llvm::MachineInstrBuilder::addUse(), assert(), buildCast(), buildInstr(), llvm::ArrayRef< T >::empty(), getMRI(), llvm::LLT::getSizeInBits(), getType(), llvm::MachineRegisterInfo::getType(), and Reg.

Referenced by buildSequence(), llvm::LegalizerHelper::fewerElementsVector(), llvm::MipsLegalizerInfo::legalizeCustom(), llvm::X86CallLowering::lowerCall(), llvm::ARMCallLowering::lowerCall(), llvm::X86CallLowering::lowerFormalArguments(), llvm::ARMCallLowering::lowerFormalArguments(), llvm::ARMCallLowering::lowerReturn(), llvm::LegalizerHelper::narrowScalar(), and llvm::LegalizationArtifactCombiner::tryCombineMerges().

◆ buildPtrMask()

MachineInstrBuilder MachineIRBuilderBase::buildPtrMask ( unsigned  Res,
unsigned  Op0,
uint32_t  NumBits 
)

Build and insert Res = G_PTR_MASK Op0, NumBits.

G_PTR_MASK clears the low bits of a pointer operand without destroying its pointer properties. This has the effect of rounding the address down to a specified alignment in bits.

Precondition
setBasicBlock or setMI must have been called.
Res and Op0 must be generic virtual registers with pointer type.
NumBits must be an integer representing the number of low bits to be cleared in Op0.
Returns
a MachineInstrBuilder for the newly created instruction.

Definition at line 218 of file MachineIRBuilder.cpp.

References llvm::MachineInstrBuilder::addDef(), llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addUse(), assert(), buildInstr(), getMRI(), and getType().

Referenced by getOffsetFromIndices(), and llvm::AArch64LegalizerInfo::legalizeCustom().

◆ buildSelect() [1/2]

MachineInstrBuilder MachineIRBuilderBase::buildSelect ( unsigned  Res,
unsigned  Tst,
unsigned  Op0,
unsigned  Op1 
)

Build and insert a Res = G_SELECT Tst, Op0, Op1.

Precondition
setBasicBlock or setMI must have been called.
Res, Op0 and Op1 must be generic virtual registers with the same type.
Tst must be a generic virtual register with scalar, pointer or vector type. If vector then it must have the same number of elements as the other parameters.
Returns
a MachineInstrBuilder for the newly created instruction.

Definition at line 670 of file MachineIRBuilder.cpp.

References llvm::MachineInstrBuilder::addDef(), llvm::MachineInstrBuilder::addUse(), assert(), buildInstr(), getMRI(), getType(), llvm::MachineRegisterInfo::getType(), llvm::LLT::isPointer(), llvm::LLT::isScalar(), llvm::LegalityPredicates::isScalar(), llvm::LLT::isVector(), and llvm::HexagonMCInstrInfo::isVector().

Referenced by llvm::LegalizerHelper::fewerElementsVector(), and getOffsetFromIndices().

◆ buildSelect() [2/2]

template<typename DstTy , typename... UseArgsTy>
MachineInstrBuilder llvm::MachineIRBuilderBase::buildSelect ( DstTy &&  Dst,
UseArgsTy &&...  UseArgs 
)
inline

Definition at line 743 of file MachineIRBuilder.h.

◆ buildSequence()

void MachineIRBuilderBase::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.

If the types of the input registers are uniform and cover the entirity of Res then a G_MERGE_VALUES will be produced. Otherwise an IMPLICIT_DEF followed by a sequence of G_INSERT instructions.

Precondition
setBasicBlock or setMI must have been called.
The final element of the sequence must not extend past the end of the destination register.
The bits defined by each Op (derived from index and scalar size) must not overlap.
Indices must be in ascending order of bit position.

Definition at line 434 of file MachineIRBuilder.cpp.

References assert(), llvm::ArrayRef< T >::begin(), buildInsert(), buildMerge(), buildUndef(), llvm::MachineRegisterInfo::createGenericVirtualRegister(), llvm::ArrayRef< T >::empty(), llvm::ArrayRef< T >::end(), getMRI(), llvm::LLT::getSizeInBits(), getType(), llvm::MachineRegisterInfo::getType(), and llvm::ArrayRef< T >::size().

Referenced by llvm::AArch64CallLowering::lowerCall().

◆ buildSExt() [1/2]

template<typename DstType , typename ArgType >
MachineInstrBuilder llvm::MachineIRBuilderBase::buildSExt ( DstType &&  Res,
ArgType &&  Arg 
)
inline

Build and insert Res = G_SEXT Op.

G_SEXT produces a register of the specified width, with bits 0 to sizeof(Ty) * 8 set to Op. The remaining bits are duplicated from the high bit of Op (i.e. 2s-complement sign extended).

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

Definition at line 338 of file MachineIRBuilder.h.

References Arg.

Referenced by llvm::CallLowering::ValueHandler::extendRegister(), and llvm::LegalizerHelper::lower().

◆ buildSExt() [2/2]

MachineInstrBuilder MachineIRBuilderBase::buildSExt ( unsigned  Res,
unsigned  Op 
)

◆ buildSExtOrTrunc() [1/2]

template<typename DstTy , typename UseArgTy >
MachineInstrBuilder llvm::MachineIRBuilderBase::buildSExtOrTrunc ( DstTy &&  Dst,
UseArgTy &&  Use 
)
inline

Build and insert Res = G_SEXT Op, Res = G_TRUNC Op, or Res = COPY Op depending on the differing sizes of Res and Op.

///

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

Definition at line 370 of file MachineIRBuilder.h.

Referenced by getOffsetFromIndices().

◆ buildSExtOrTrunc() [2/2]

MachineInstrBuilder MachineIRBuilderBase::buildSExtOrTrunc ( unsigned  Res,
unsigned  Op 
)

Definition at line 377 of file MachineIRBuilder.cpp.

References buildExtOrTrunc().

◆ buildStore()

MachineInstrBuilder MachineIRBuilderBase::buildStore ( unsigned  Val,
unsigned  Addr,
MachineMemOperand MMO 
)

Build and insert G_STORE Val, Addr, MMO.

Stores the value Val to Addr.

Precondition
setBasicBlock or setMI must have been called.
Val must be a generic virtual register.
Addr must be a generic virtual register with pointer type.
Returns
a MachineInstrBuilder for the newly created instruction.

Definition at line 307 of file MachineIRBuilder.cpp.

References llvm::MachineInstrBuilder::addMemOperand(), llvm::MachineInstrBuilder::addUse(), assert(), buildInstr(), getMRI(), and getType().

Referenced by llvm::AArch64CallLowering::AArch64CallLowering(), computeValueLLTs(), getOffsetFromIndices(), isSupportedType(), llvm::AArch64LegalizerInfo::legalizeCustom(), llvm::LegalizerHelper::narrowScalar(), and llvm::X86CallLowering::X86CallLowering().

◆ buildTrunc() [1/2]

MachineInstrBuilder MachineIRBuilderBase::buildTrunc ( unsigned  Res,
unsigned  Op 
)

Build and insert Res = G_TRUNC Op.

G_TRUNC extracts the low bits of a type. For a vector type each element is truncated independently before being packed into the destination.

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

Definition at line 611 of file MachineIRBuilder.cpp.

References llvm::MachineInstrBuilder::addDef(), llvm::MachineInstrBuilder::addUse(), and buildInstr().

Referenced by llvm::AArch64CallLowering::AArch64CallLowering(), llvm::ARMLegalizerInfo::legalizeCustom(), llvm::X86CallLowering::lowerReturn(), llvm::ARMCallLowering::lowerReturn(), and llvm::LegalizerHelper::widenScalar().

◆ buildTrunc() [2/2]

template<typename DstType , typename SrcType >
MachineInstrBuilder llvm::MachineIRBuilderBase::buildTrunc ( DstType &&  Res,
SrcType &&  Src 
)
inline

Definition at line 691 of file MachineIRBuilder.h.

◆ buildUAdde()

MachineInstrBuilder MachineIRBuilderBase::buildUAdde ( unsigned  Res,
unsigned  CarryOut,
unsigned  Op0,
unsigned  Op1,
unsigned  CarryIn 
)

Build and insert Res, CarryOut = G_UADDE Op0, Op1, CarryIn.

G_UADDE sets Res to Op0 + Op1 + CarryIn (truncated to the bit width) and sets CarryOut to 1 if the result overflowed in unsigned arithmetic.

Precondition
setBasicBlock or setMI must have been called.
Res, Op0 and Op1 must be generic virtual registers with the same scalar type.
CarryOut and CarryIn must be generic virtual registers with the same scalar type (typically s1)
Returns
The newly created instruction.

Definition at line 319 of file MachineIRBuilder.cpp.

References llvm::MachineInstrBuilder::addDef(), llvm::MachineInstrBuilder::addUse(), assert(), buildInstr(), getMRI(), getType(), and llvm::LegalityPredicates::isScalar().

Referenced by llvm::LegalizerHelper::narrowScalar().

◆ buildUndef() [1/2]

template<typename DstType >
MachineInstrBuilder llvm::MachineIRBuilderBase::buildUndef ( DstType &&  Res)
inline

◆ buildUndef() [2/2]

MachineInstrBuilder MachineIRBuilderBase::buildUndef ( unsigned  Res)

Definition at line 475 of file MachineIRBuilder.cpp.

References llvm::MachineInstrBuilder::addDef(), and buildInstr().

◆ buildUnmerge()

MachineInstrBuilder MachineIRBuilderBase::buildUnmerge ( ArrayRef< unsigned Res,
unsigned  Op 
)

Build and insert Res0, ...

= G_UNMERGE_VALUES Op

G_UNMERGE_VALUES splits contiguous bits of the input into multiple

Precondition
setBasicBlock or setMI must have been called.
The entire register Res (and no more) must be covered by the input registers.
The type of all Res registers must be identical.
Returns
a MachineInstrBuilder for the newly created instruction.

Definition at line 502 of file MachineIRBuilder.cpp.

References assert(), buildInstr(), llvm::ArrayRef< T >::empty(), getMRI(), llvm::LLT::getSizeInBits(), getType(), llvm::MachineRegisterInfo::getType(), and Reg.

Referenced by isSupportedType(), llvm::MipsLegalizerInfo::legalizeCustom(), llvm::ARMLegalizerInfo::legalizeCustom(), llvm::LegalizerHelper::legalizeInstrStep(), llvm::X86CallLowering::lowerCall(), llvm::ARMCallLowering::lowerCall(), llvm::X86CallLowering::lowerReturn(), llvm::LegalizerHelper::narrowScalar(), and llvm::LegalizationArtifactCombiner::tryCombineMerges().

◆ buildZExt() [1/2]

template<typename DstType , typename ArgType >
MachineInstrBuilder llvm::MachineIRBuilderBase::buildZExt ( DstType &&  Res,
ArgType &&  Arg 
)
inline

Build and insert Res = G_ZEXT Op.

G_ZEXT produces a register of the specified width, with bits 0 to sizeof(Ty) * 8 set to Op. The remaining bits are 0. For a vector register, each element is extended individually.

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

Definition at line 356 of file MachineIRBuilder.h.

References Arg.

Referenced by llvm::CallLowering::ValueHandler::extendRegister(), llvm::LegalizerHelper::lower(), llvm::AArch64CallLowering::lowerReturn(), and llvm::LegalizerHelper::widenScalar().

◆ buildZExt() [2/2]

MachineInstrBuilder MachineIRBuilderBase::buildZExt ( unsigned  Res,
unsigned  Op 
)

◆ buildZExtOrTrunc() [1/2]

template<typename DstTy , typename UseArgTy >
MachineInstrBuilder llvm::MachineIRBuilderBase::buildZExtOrTrunc ( DstTy &&  Dst,
UseArgTy &&  Use 
)
inline

Build and insert Res = G_ZEXT Op, Res = G_TRUNC Op, or Res = COPY Op depending on the differing sizes of Res and Op.

///

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

Definition at line 384 of file MachineIRBuilder.h.

Referenced by getOffsetFromIndices().

◆ buildZExtOrTrunc() [2/2]

MachineInstrBuilder MachineIRBuilderBase::buildZExtOrTrunc ( unsigned  Res,
unsigned  Op 
)

Definition at line 382 of file MachineIRBuilder.cpp.

References buildExtOrTrunc().

◆ getDebugLoc()

DebugLoc llvm::MachineIRBuilderBase::getDebugLoc ( )
inline

Get the current instruction's debug location.

Definition at line 164 of file MachineIRBuilder.h.

References buildGEP(), C, llvm::MachineIRBuilderState::DL, and Reg.

Referenced by getOffsetFromIndices().

◆ getDestFromArg() [1/3]

unsigned llvm::MachineIRBuilderBase::getDestFromArg ( unsigned  Reg)
inlineprotected

Definition at line 68 of file MachineIRBuilder.h.

References Reg.

Referenced by llvm::ConstantFoldingMIRBuilder::buildInstr().

◆ getDestFromArg() [2/3]

unsigned llvm::MachineIRBuilderBase::getDestFromArg ( LLT  Ty)
inlineprotected

Definition at line 69 of file MachineIRBuilder.h.

◆ getDestFromArg() [3/3]

unsigned llvm::MachineIRBuilderBase::getDestFromArg ( const TargetRegisterClass RC)
inlineprotected

Definition at line 72 of file MachineIRBuilder.h.

◆ getDL()

const DebugLoc& llvm::MachineIRBuilderBase::getDL ( )
inline

◆ getInsertPt()

MachineBasicBlock::iterator llvm::MachineIRBuilderBase::getInsertPt ( )
inline

Current insertion point for new instructions.

Definition at line 134 of file MachineIRBuilder.h.

References llvm::MachineIRBuilderState::II, llvm::MachineIRBuilderState::MBB, and llvm::MachineIRBuilderState::Observer.

Referenced by insertInstr(), and llvm::LegalizerHelper::narrowScalar().

◆ getMBB()

MachineBasicBlock& llvm::MachineIRBuilderBase::getMBB ( )
inline

◆ getMF()

MachineFunction& llvm::MachineIRBuilderBase::getMF ( )
inline

◆ getMRI()

MachineRegisterInfo* llvm::MachineIRBuilderBase::getMRI ( )
inline

◆ getRegFromArg() [1/2]

unsigned llvm::MachineIRBuilderBase::getRegFromArg ( unsigned  Reg)
inlineprotected

Definition at line 90 of file MachineIRBuilder.h.

References Reg.

Referenced by llvm::ConstantFoldingMIRBuilder::buildInstr().

◆ getRegFromArg() [2/2]

unsigned llvm::MachineIRBuilderBase::getRegFromArg ( const MachineInstrBuilder MIB)
inlineprotected

◆ getState()

MachineIRBuilderState& llvm::MachineIRBuilderBase::getState ( )
inline

Getter for the State.

Definition at line 125 of file MachineIRBuilder.h.

◆ getTII()

const TargetInstrInfo& llvm::MachineIRBuilderBase::getTII ( )
inline

◆ insertInstr()

MachineInstrBuilder MachineIRBuilderBase::insertInstr ( MachineInstrBuilder  MIB)

◆ materializeGEP()

Optional< MachineInstrBuilder > MachineIRBuilderBase::materializeGEP ( unsigned Res,
unsigned  Op0,
const LLT ValueTy,
uint64_t  Value 
)

Materialize and insert Res = G_GEP Op0, (G_CONSTANT Value)

G_GEP adds Value bytes to the pointer specified by Op0, storing the resulting pointer in Res. If Value is zero then no G_GEP or G_CONSTANT will be created and

Precondition
Op0 will be assigned to Res.
setBasicBlock or setMI must have been called.
Op0 must be a generic virtual register with pointer type.
ValueTy must be a scalar type.
Res must be 0. This is to detect confusion between materializeGEP() and buildGEP().
Postcondition
Res will either be a new generic virtual register of the same type as Op0 or Op0 itself.
Returns
a MachineInstrBuilder for the newly created instruction.

Definition at line 201 of file MachineIRBuilder.cpp.

References assert(), buildConstant(), buildGEP(), llvm::MachineRegisterInfo::createGenericVirtualRegister(), getMRI(), getType(), llvm::LLT::isScalar(), and llvm::None.

Referenced by computeValueLLTs(), and llvm::LegalizerHelper::narrowScalar().

◆ setChangeObserver()

void MachineIRBuilderBase::setChangeObserver ( GISelChangeObserver Observer)

◆ setDebugLoc()

void llvm::MachineIRBuilderBase::setDebugLoc ( const DebugLoc DL)
inline

Set the debug location to DL for all the next build instructions.

Definition at line 161 of file MachineIRBuilder.h.

References llvm::MachineIRBuilderState::DL.

◆ setInsertPt()

void MachineIRBuilderBase::setInsertPt ( MachineBasicBlock MBB,
MachineBasicBlock::iterator  II 
)

Set the insertion point before the specified position.

Precondition
MBB must be in getMF().
II must be a valid iterator in MBB.

Definition at line 49 of file MachineIRBuilder.cpp.

References assert(), llvm::GISelChangeObserver::createdInstr(), getMF(), llvm::MachineBasicBlock::getParent(), llvm::MachineIRBuilderState::II, llvm::MachineIRBuilderState::MBB, and llvm::MachineIRBuilderState::Observer.

Referenced by llvm::LegalizerHelper::narrowScalar(), and llvm::LegalizerHelper::widenScalar().

◆ setInstr()

void MachineIRBuilderBase::setInstr ( MachineInstr MI)

◆ setMBB()

void MachineIRBuilderBase::setMBB ( MachineBasicBlock MBB)

◆ setMF()

void MachineIRBuilderBase::setMF ( MachineFunction MF)

◆ stopObservingChanges()

void MachineIRBuilderBase::stopObservingChanges ( )

◆ validateBinaryOp()

void MachineIRBuilderBase::validateBinaryOp ( unsigned  Res,
unsigned  Op0,
unsigned  Op1 
)
protected

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