#include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/CodeGen/TargetLowering.h"
#include "llvm/CodeGen/TargetOpcodes.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/IR/DebugInfoMetadata.h"
usingnamespacellvm;
void MachineIRBuilder::setMF(MachineFunction &MF) { … }
MachineInstrBuilder MachineIRBuilder::buildInstrNoInsert(unsigned Opcode) { … }
MachineInstrBuilder MachineIRBuilder::insertInstr(MachineInstrBuilder MIB) { … }
MachineInstrBuilder
MachineIRBuilder::buildDirectDbgValue(Register Reg, const MDNode *Variable,
const MDNode *Expr) { … }
MachineInstrBuilder
MachineIRBuilder::buildIndirectDbgValue(Register Reg, const MDNode *Variable,
const MDNode *Expr) { … }
MachineInstrBuilder MachineIRBuilder::buildFIDbgValue(int FI,
const MDNode *Variable,
const MDNode *Expr) { … }
MachineInstrBuilder MachineIRBuilder::buildConstDbgValue(const Constant &C,
const MDNode *Variable,
const MDNode *Expr) { … }
MachineInstrBuilder MachineIRBuilder::buildDbgLabel(const MDNode *Label) { … }
MachineInstrBuilder MachineIRBuilder::buildDynStackAlloc(const DstOp &Res,
const SrcOp &Size,
Align Alignment) { … }
MachineInstrBuilder MachineIRBuilder::buildFrameIndex(const DstOp &Res,
int Idx) { … }
MachineInstrBuilder MachineIRBuilder::buildGlobalValue(const DstOp &Res,
const GlobalValue *GV) { … }
MachineInstrBuilder MachineIRBuilder::buildConstantPool(const DstOp &Res,
unsigned Idx) { … }
MachineInstrBuilder MachineIRBuilder::buildJumpTable(const LLT PtrTy,
unsigned JTI) { … }
void MachineIRBuilder::validateUnaryOp(const LLT Res, const LLT Op0) { … }
void MachineIRBuilder::validateBinaryOp(const LLT Res, const LLT Op0,
const LLT Op1) { … }
void MachineIRBuilder::validateShiftOp(const LLT Res, const LLT Op0,
const LLT Op1) { … }
MachineInstrBuilder
MachineIRBuilder::buildPtrAdd(const DstOp &Res, const SrcOp &Op0,
const SrcOp &Op1, std::optional<unsigned> Flags) { … }
std::optional<MachineInstrBuilder>
MachineIRBuilder::materializePtrAdd(Register &Res, Register Op0,
const LLT ValueTy, uint64_t Value) { … }
MachineInstrBuilder MachineIRBuilder::buildMaskLowPtrBits(const DstOp &Res,
const SrcOp &Op0,
uint32_t NumBits) { … }
MachineInstrBuilder
MachineIRBuilder::buildPadVectorWithUndefElements(const DstOp &Res,
const SrcOp &Op0) { … }
MachineInstrBuilder
MachineIRBuilder::buildDeleteTrailingVectorElements(const DstOp &Res,
const SrcOp &Op0) { … }
MachineInstrBuilder MachineIRBuilder::buildBr(MachineBasicBlock &Dest) { … }
MachineInstrBuilder MachineIRBuilder::buildBrIndirect(Register Tgt) { … }
MachineInstrBuilder MachineIRBuilder::buildBrJT(Register TablePtr,
unsigned JTI,
Register IndexReg) { … }
MachineInstrBuilder MachineIRBuilder::buildCopy(const DstOp &Res,
const SrcOp &Op) { … }
MachineInstrBuilder MachineIRBuilder::buildConstant(const DstOp &Res,
const ConstantInt &Val) { … }
MachineInstrBuilder MachineIRBuilder::buildConstant(const DstOp &Res,
int64_t Val) { … }
MachineInstrBuilder MachineIRBuilder::buildFConstant(const DstOp &Res,
const ConstantFP &Val) { … }
MachineInstrBuilder MachineIRBuilder::buildConstant(const DstOp &Res,
const APInt &Val) { … }
MachineInstrBuilder MachineIRBuilder::buildFConstant(const DstOp &Res,
double Val) { … }
MachineInstrBuilder MachineIRBuilder::buildFConstant(const DstOp &Res,
const APFloat &Val) { … }
MachineInstrBuilder
MachineIRBuilder::buildConstantPtrAuth(const DstOp &Res,
const ConstantPtrAuth *CPA,
Register Addr, Register AddrDisc) { … }
MachineInstrBuilder MachineIRBuilder::buildBrCond(const SrcOp &Tst,
MachineBasicBlock &Dest) { … }
MachineInstrBuilder
MachineIRBuilder::buildLoad(const DstOp &Dst, const SrcOp &Addr,
MachinePointerInfo PtrInfo, Align Alignment,
MachineMemOperand::Flags MMOFlags,
const AAMDNodes &AAInfo) { … }
MachineInstrBuilder MachineIRBuilder::buildLoadInstr(unsigned Opcode,
const DstOp &Res,
const SrcOp &Addr,
MachineMemOperand &MMO) { … }
MachineInstrBuilder MachineIRBuilder::buildLoadFromOffset(
const DstOp &Dst, const SrcOp &BasePtr,
MachineMemOperand &BaseMMO, int64_t Offset) { … }
MachineInstrBuilder MachineIRBuilder::buildStore(const SrcOp &Val,
const SrcOp &Addr,
MachineMemOperand &MMO) { … }
MachineInstrBuilder
MachineIRBuilder::buildStore(const SrcOp &Val, const SrcOp &Addr,
MachinePointerInfo PtrInfo, Align Alignment,
MachineMemOperand::Flags MMOFlags,
const AAMDNodes &AAInfo) { … }
MachineInstrBuilder MachineIRBuilder::buildAnyExt(const DstOp &Res,
const SrcOp &Op) { … }
MachineInstrBuilder MachineIRBuilder::buildSExt(const DstOp &Res,
const SrcOp &Op) { … }
MachineInstrBuilder MachineIRBuilder::buildZExt(const DstOp &Res,
const SrcOp &Op,
std::optional<unsigned> Flags) { … }
unsigned MachineIRBuilder::getBoolExtOp(bool IsVec, bool IsFP) const { … }
MachineInstrBuilder MachineIRBuilder::buildBoolExt(const DstOp &Res,
const SrcOp &Op,
bool IsFP) { … }
MachineInstrBuilder MachineIRBuilder::buildBoolExtInReg(const DstOp &Res,
const SrcOp &Op,
bool IsVector,
bool IsFP) { … }
MachineInstrBuilder MachineIRBuilder::buildExtOrTrunc(unsigned ExtOpc,
const DstOp &Res,
const SrcOp &Op) { … }
MachineInstrBuilder MachineIRBuilder::buildSExtOrTrunc(const DstOp &Res,
const SrcOp &Op) { … }
MachineInstrBuilder MachineIRBuilder::buildZExtOrTrunc(const DstOp &Res,
const SrcOp &Op) { … }
MachineInstrBuilder MachineIRBuilder::buildAnyExtOrTrunc(const DstOp &Res,
const SrcOp &Op) { … }
MachineInstrBuilder MachineIRBuilder::buildZExtInReg(const DstOp &Res,
const SrcOp &Op,
int64_t ImmOp) { … }
MachineInstrBuilder MachineIRBuilder::buildCast(const DstOp &Dst,
const SrcOp &Src) { … }
MachineInstrBuilder MachineIRBuilder::buildExtract(const DstOp &Dst,
const SrcOp &Src,
uint64_t Index) { … }
MachineInstrBuilder MachineIRBuilder::buildUndef(const DstOp &Res) { … }
MachineInstrBuilder MachineIRBuilder::buildMergeValues(const DstOp &Res,
ArrayRef<Register> Ops) { … }
MachineInstrBuilder
MachineIRBuilder::buildMergeLikeInstr(const DstOp &Res,
ArrayRef<Register> Ops) { … }
MachineInstrBuilder
MachineIRBuilder::buildMergeLikeInstr(const DstOp &Res,
std::initializer_list<SrcOp> Ops) { … }
unsigned MachineIRBuilder::getOpcodeForMerge(const DstOp &DstOp,
ArrayRef<SrcOp> SrcOps) const { … }
MachineInstrBuilder MachineIRBuilder::buildUnmerge(ArrayRef<LLT> Res,
const SrcOp &Op) { … }
MachineInstrBuilder MachineIRBuilder::buildUnmerge(LLT Res,
const SrcOp &Op) { … }
MachineInstrBuilder MachineIRBuilder::buildUnmerge(ArrayRef<Register> Res,
const SrcOp &Op) { … }
MachineInstrBuilder MachineIRBuilder::buildBuildVector(const DstOp &Res,
ArrayRef<Register> Ops) { … }
MachineInstrBuilder
MachineIRBuilder::buildBuildVectorConstant(const DstOp &Res,
ArrayRef<APInt> Ops) { … }
MachineInstrBuilder MachineIRBuilder::buildSplatBuildVector(const DstOp &Res,
const SrcOp &Src) { … }
MachineInstrBuilder
MachineIRBuilder::buildBuildVectorTrunc(const DstOp &Res,
ArrayRef<Register> Ops) { … }
MachineInstrBuilder MachineIRBuilder::buildShuffleSplat(const DstOp &Res,
const SrcOp &Src) { … }
MachineInstrBuilder MachineIRBuilder::buildSplatVector(const DstOp &Res,
const SrcOp &Src) { … }
MachineInstrBuilder MachineIRBuilder::buildShuffleVector(const DstOp &Res,
const SrcOp &Src1,
const SrcOp &Src2,
ArrayRef<int> Mask) { … }
MachineInstrBuilder
MachineIRBuilder::buildConcatVectors(const DstOp &Res, ArrayRef<Register> Ops) { … }
MachineInstrBuilder MachineIRBuilder::buildInsert(const DstOp &Res,
const SrcOp &Src,
const SrcOp &Op,
unsigned Index) { … }
MachineInstrBuilder MachineIRBuilder::buildVScale(const DstOp &Res,
unsigned MinElts) { … }
MachineInstrBuilder MachineIRBuilder::buildVScale(const DstOp &Res,
const ConstantInt &MinElts) { … }
MachineInstrBuilder MachineIRBuilder::buildVScale(const DstOp &Res,
const APInt &MinElts) { … }
static unsigned getIntrinsicOpcode(bool HasSideEffects, bool IsConvergent) { … }
MachineInstrBuilder
MachineIRBuilder::buildIntrinsic(Intrinsic::ID ID,
ArrayRef<Register> ResultRegs,
bool HasSideEffects, bool isConvergent) { … }
MachineInstrBuilder
MachineIRBuilder::buildIntrinsic(Intrinsic::ID ID,
ArrayRef<Register> ResultRegs) { … }
MachineInstrBuilder MachineIRBuilder::buildIntrinsic(Intrinsic::ID ID,
ArrayRef<DstOp> Results,
bool HasSideEffects,
bool isConvergent) { … }
MachineInstrBuilder MachineIRBuilder::buildIntrinsic(Intrinsic::ID ID,
ArrayRef<DstOp> Results) { … }
MachineInstrBuilder
MachineIRBuilder::buildTrunc(const DstOp &Res, const SrcOp &Op,
std::optional<unsigned> Flags) { … }
MachineInstrBuilder
MachineIRBuilder::buildFPTrunc(const DstOp &Res, const SrcOp &Op,
std::optional<unsigned> Flags) { … }
MachineInstrBuilder MachineIRBuilder::buildICmp(CmpInst::Predicate Pred,
const DstOp &Res,
const SrcOp &Op0,
const SrcOp &Op1) { … }
MachineInstrBuilder MachineIRBuilder::buildFCmp(CmpInst::Predicate Pred,
const DstOp &Res,
const SrcOp &Op0,
const SrcOp &Op1,
std::optional<unsigned> Flags) { … }
MachineInstrBuilder MachineIRBuilder::buildSCmp(const DstOp &Res,
const SrcOp &Op0,
const SrcOp &Op1) { … }
MachineInstrBuilder MachineIRBuilder::buildUCmp(const DstOp &Res,
const SrcOp &Op0,
const SrcOp &Op1) { … }
MachineInstrBuilder
MachineIRBuilder::buildSelect(const DstOp &Res, const SrcOp &Tst,
const SrcOp &Op0, const SrcOp &Op1,
std::optional<unsigned> Flags) { … }
MachineInstrBuilder MachineIRBuilder::buildInsertSubvector(const DstOp &Res,
const SrcOp &Src0,
const SrcOp &Src1,
unsigned Idx) { … }
MachineInstrBuilder MachineIRBuilder::buildExtractSubvector(const DstOp &Res,
const SrcOp &Src,
unsigned Idx) { … }
MachineInstrBuilder
MachineIRBuilder::buildInsertVectorElement(const DstOp &Res, const SrcOp &Val,
const SrcOp &Elt, const SrcOp &Idx) { … }
MachineInstrBuilder
MachineIRBuilder::buildExtractVectorElement(const DstOp &Res, const SrcOp &Val,
const SrcOp &Idx) { … }
MachineInstrBuilder MachineIRBuilder::buildAtomicCmpXchgWithSuccess(
const DstOp &OldValRes, const DstOp &SuccessRes, const SrcOp &Addr,
const SrcOp &CmpVal, const SrcOp &NewVal, MachineMemOperand &MMO) { … }
MachineInstrBuilder
MachineIRBuilder::buildAtomicCmpXchg(const DstOp &OldValRes, const SrcOp &Addr,
const SrcOp &CmpVal, const SrcOp &NewVal,
MachineMemOperand &MMO) { … }
MachineInstrBuilder MachineIRBuilder::buildAtomicRMW(
unsigned Opcode, const DstOp &OldValRes,
const SrcOp &Addr, const SrcOp &Val,
MachineMemOperand &MMO) { … }
MachineInstrBuilder
MachineIRBuilder::buildAtomicRMWXchg(Register OldValRes, Register Addr,
Register Val, MachineMemOperand &MMO) { … }
MachineInstrBuilder
MachineIRBuilder::buildAtomicRMWAdd(Register OldValRes, Register Addr,
Register Val, MachineMemOperand &MMO) { … }
MachineInstrBuilder
MachineIRBuilder::buildAtomicRMWSub(Register OldValRes, Register Addr,
Register Val, MachineMemOperand &MMO) { … }
MachineInstrBuilder
MachineIRBuilder::buildAtomicRMWAnd(Register OldValRes, Register Addr,
Register Val, MachineMemOperand &MMO) { … }
MachineInstrBuilder
MachineIRBuilder::buildAtomicRMWNand(Register OldValRes, Register Addr,
Register Val, MachineMemOperand &MMO) { … }
MachineInstrBuilder MachineIRBuilder::buildAtomicRMWOr(Register OldValRes,
Register Addr,
Register Val,
MachineMemOperand &MMO) { … }
MachineInstrBuilder
MachineIRBuilder::buildAtomicRMWXor(Register OldValRes, Register Addr,
Register Val, MachineMemOperand &MMO) { … }
MachineInstrBuilder
MachineIRBuilder::buildAtomicRMWMax(Register OldValRes, Register Addr,
Register Val, MachineMemOperand &MMO) { … }
MachineInstrBuilder
MachineIRBuilder::buildAtomicRMWMin(Register OldValRes, Register Addr,
Register Val, MachineMemOperand &MMO) { … }
MachineInstrBuilder
MachineIRBuilder::buildAtomicRMWUmax(Register OldValRes, Register Addr,
Register Val, MachineMemOperand &MMO) { … }
MachineInstrBuilder
MachineIRBuilder::buildAtomicRMWUmin(Register OldValRes, Register Addr,
Register Val, MachineMemOperand &MMO) { … }
MachineInstrBuilder
MachineIRBuilder::buildAtomicRMWFAdd(
const DstOp &OldValRes, const SrcOp &Addr, const SrcOp &Val,
MachineMemOperand &MMO) { … }
MachineInstrBuilder
MachineIRBuilder::buildAtomicRMWFSub(const DstOp &OldValRes, const SrcOp &Addr, const SrcOp &Val,
MachineMemOperand &MMO) { … }
MachineInstrBuilder
MachineIRBuilder::buildAtomicRMWFMax(const DstOp &OldValRes, const SrcOp &Addr,
const SrcOp &Val, MachineMemOperand &MMO) { … }
MachineInstrBuilder
MachineIRBuilder::buildAtomicRMWFMin(const DstOp &OldValRes, const SrcOp &Addr,
const SrcOp &Val, MachineMemOperand &MMO) { … }
MachineInstrBuilder
MachineIRBuilder::buildFence(unsigned Ordering, unsigned Scope) { … }
MachineInstrBuilder MachineIRBuilder::buildPrefetch(const SrcOp &Addr,
unsigned RW,
unsigned Locality,
unsigned CacheType,
MachineMemOperand &MMO) { … }
MachineInstrBuilder
MachineIRBuilder::buildBlockAddress(Register Res, const BlockAddress *BA) { … }
void MachineIRBuilder::validateTruncExt(const LLT DstTy, const LLT SrcTy,
bool IsExtend) { … }
void MachineIRBuilder::validateSelectOp(const LLT ResTy, const LLT TstTy,
const LLT Op0Ty, const LLT Op1Ty) { … }
MachineInstrBuilder
MachineIRBuilder::buildInstr(unsigned Opc, ArrayRef<DstOp> DstOps,
ArrayRef<SrcOp> SrcOps,
std::optional<unsigned> Flags) { … }