40 "Basic block is in a different function");
54 "Basic block is in a different function");
92 assert(isa<DILocalVariable>(Variable) &&
"not a variable");
93 assert(cast<DIExpression>(Expr)->isValid() &&
"not an expression");
95 cast<DILocalVariable>(Variable)->isValidLocationForIntrinsic(
getDL()) &&
96 "Expected inlined-at fields to agree");
98 getTII().
get(TargetOpcode::DBG_VALUE),
99 false, Reg, Variable, Expr));
105 assert(isa<DILocalVariable>(Variable) &&
"not a variable");
106 assert(cast<DIExpression>(Expr)->isValid() &&
"not an expression");
108 cast<DILocalVariable>(Variable)->isValidLocationForIntrinsic(
getDL()) &&
109 "Expected inlined-at fields to agree");
111 getTII().
get(TargetOpcode::DBG_VALUE),
112 true, Reg, Variable, Expr));
118 assert(isa<DILocalVariable>(Variable) &&
"not a variable");
119 assert(cast<DIExpression>(Expr)->isValid() &&
"not an expression");
121 cast<DILocalVariable>(Variable)->isValidLocationForIntrinsic(
getDL()) &&
122 "Expected inlined-at fields to agree");
133 assert(isa<DILocalVariable>(Variable) &&
"not a variable");
134 assert(cast<DIExpression>(Expr)->isValid() &&
"not an expression");
136 cast<DILocalVariable>(Variable)->isValidLocationForIntrinsic(
getDL()) &&
137 "Expected inlined-at fields to agree");
138 auto MIB =
buildInstr(TargetOpcode::DBG_VALUE);
139 if (
auto *CI = dyn_cast<ConstantInt>(&C)) {
140 if (CI->getBitWidth() > 64)
143 MIB.addImm(CI->getZExtValue());
144 }
else if (
auto *CFP = dyn_cast<ConstantFP>(&C)) {
151 return MIB.addImm(0).addMetadata(Variable).addMetadata(Expr);
155 assert(isa<DILabel>(Label) &&
"not a label");
156 assert(cast<DILabel>(Label)->isValidLocationForIntrinsic(State.
DL) &&
157 "Expected inlined-at fields to agree");
158 auto MIB =
buildInstr(TargetOpcode::DBG_LABEL);
160 return MIB.addMetadata(Label);
165 return buildInstr(TargetOpcode::G_FRAME_INDEX)
175 "address space mismatch");
177 return buildInstr(TargetOpcode::G_GLOBAL_VALUE)
185 assert((Res == Op0 && Res == Op1) &&
"type mismatch");
202 const LLT &ValueTy, uint64_t
Value) {
203 assert(Res == 0 &&
"Res is a result argument");
240 return buildInstr(TargetOpcode::COPY, Res, Op);
254 auto MIB =
buildInstr(TargetOpcode::G_CONSTANT);
272 auto MIB =
buildInstr(TargetOpcode::G_FCONSTANT);
324 const DstOp &CarryOut,
327 const SrcOp &CarryIn) {
328 return buildInstr(TargetOpcode::G_UADDE, {Res, CarryOut},
329 {Op0, Op1, CarryIn});
334 return buildInstr(TargetOpcode::G_ANYEXT, Res, Op);
339 return buildInstr(TargetOpcode::G_SEXT, Res, Op);
344 return buildInstr(TargetOpcode::G_ZEXT, Res, Op);
350 assert((TargetOpcode::G_ANYEXT == ExtOpc || TargetOpcode::G_ZEXT == ExtOpc ||
351 TargetOpcode::G_SEXT == ExtOpc) &&
352 "Expecting Extending Opc");
358 unsigned Opcode = TargetOpcode::COPY;
364 Opcode = TargetOpcode::G_TRUNC;
395 Opcode = TargetOpcode::G_PTRTOINT;
397 Opcode = TargetOpcode::G_INTTOPTR;
400 Opcode = TargetOpcode::G_BITCAST;
413 "extracting off end of register");
418 assert(Index == 0 &&
"insertion past the end of a register");
432 assert(!Ops.
empty() &&
"invalid trivial sequence");
434 "sequence offsets must be in ascending order");
444 bool MaybeMerge =
true;
445 for (
unsigned i = 0; i < Ops.size(); ++i) {
446 if (
getMRI()->
getType(Ops[i]) != OpTy || Indices[i] != i * OpSize) {
452 if (MaybeMerge && Ops.size() * OpSize == ResTy.
getSizeInBits()) {
460 for (
unsigned i = 0; i < Ops.size(); ++i) {
461 unsigned ResOut = i + 1 == Ops.size()
470 return buildInstr(TargetOpcode::G_IMPLICIT_DEF, {Res}, {});
479 return buildInstr(TargetOpcode::G_MERGE_VALUES, Res, TmpVec);
488 return buildInstr(TargetOpcode::G_UNMERGE_VALUES, TmpVec, Op);
497 return buildInstr(TargetOpcode::G_UNMERGE_VALUES, TmpVec, Op);
506 return buildInstr(TargetOpcode::G_BUILD_VECTOR, Res, TmpVec);
516 return buildInstr(TargetOpcode::G_BUILD_VECTOR_TRUNC, Res, TmpVec);
525 return buildInstr(TargetOpcode::G_CONCAT_VECTORS, Res, TmpVec);
532 "insertion past the end of a register");
548 bool HasSideEffects) {
550 buildInstr(HasSideEffects ? TargetOpcode::G_INTRINSIC_W_SIDE_EFFECTS
551 : TargetOpcode::G_INTRINSIC);
554 MIB.addIntrinsicID(ID);
560 return buildInstr(TargetOpcode::G_TRUNC, Res, Op);
565 return buildInstr(TargetOpcode::G_FPTRUNC, Res, Op);
572 return buildInstr(TargetOpcode::G_ICMP, Res, {Pred, Op0, Op1});
580 return buildInstr(TargetOpcode::G_FCMP, Res, {Pred, Op0, Op1});
588 return buildInstr(TargetOpcode::G_SELECT, {Res}, {Tst, Op0, Op1});
594 return buildInstr(TargetOpcode::G_INSERT_VECTOR_ELT, Res, {Val, Elt, Idx});
600 return buildInstr(TargetOpcode::G_EXTRACT_VECTOR_ELT, Res, {Val, Idx});
604 unsigned OldValRes,
unsigned SuccessRes,
unsigned Addr,
unsigned CmpVal,
617 assert(OldValResTy == CmpValTy &&
"type mismatch");
618 assert(OldValResTy == NewValTy &&
"type mismatch");
621 return buildInstr(TargetOpcode::G_ATOMIC_CMPXCHG_WITH_SUCCESS)
632 unsigned CmpVal,
unsigned NewVal,
643 assert(OldValResTy == CmpValTy &&
"type mismatch");
644 assert(OldValResTy == NewValTy &&
"type mismatch");
647 return buildInstr(TargetOpcode::G_ATOMIC_CMPXCHG)
667 assert(OldValResTy == ValTy &&
"type mismatch");
680 return buildAtomicRMW(TargetOpcode::G_ATOMICRMW_XCHG, OldValRes, Addr, Val,
686 return buildAtomicRMW(TargetOpcode::G_ATOMICRMW_ADD, OldValRes, Addr, Val,
692 return buildAtomicRMW(TargetOpcode::G_ATOMICRMW_SUB, OldValRes, Addr, Val,
698 return buildAtomicRMW(TargetOpcode::G_ATOMICRMW_AND, OldValRes, Addr, Val,
704 return buildAtomicRMW(TargetOpcode::G_ATOMICRMW_NAND, OldValRes, Addr, Val,
711 return buildAtomicRMW(TargetOpcode::G_ATOMICRMW_OR, OldValRes, Addr, Val,
717 return buildAtomicRMW(TargetOpcode::G_ATOMICRMW_XOR, OldValRes, Addr, Val,
723 return buildAtomicRMW(TargetOpcode::G_ATOMICRMW_MAX, OldValRes, Addr, Val,
729 return buildAtomicRMW(TargetOpcode::G_ATOMICRMW_MIN, OldValRes, Addr, Val,
735 return buildAtomicRMW(TargetOpcode::G_ATOMICRMW_UMAX, OldValRes, Addr, Val,
741 return buildAtomicRMW(TargetOpcode::G_ATOMICRMW_UMIN, OldValRes, Addr, Val,
758 assert(SrcTy.
isVector() &&
"mismatched cast between vector and non-vector");
760 "different number of elements in a trunc/ext");
766 "invalid narrowing extend");
769 "invalid widening trunc");
774 const LLT &Op0Ty,
const LLT &Op1Ty) {
777 "invalid operand type");
778 assert((ResTy == Op0Ty && ResTy == Op1Ty) &&
"type mismatch");
796 case TargetOpcode::G_SELECT: {
797 assert(DstOps.
size() == 1 &&
"Invalid select");
798 assert(SrcOps.
size() == 3 &&
"Invalid select");
800 DstOps[0].getLLTTy(*
getMRI()), SrcOps[0].getLLTTy(*
getMRI()),
801 SrcOps[1].getLLTTy(*
getMRI()), SrcOps[2].getLLTTy(*
getMRI()));
804 case TargetOpcode::G_ADD:
805 case TargetOpcode::G_AND:
806 case TargetOpcode::G_ASHR:
807 case TargetOpcode::G_LSHR:
808 case TargetOpcode::G_MUL:
809 case TargetOpcode::G_OR:
810 case TargetOpcode::G_SHL:
811 case TargetOpcode::G_SUB:
812 case TargetOpcode::G_XOR:
813 case TargetOpcode::G_UDIV:
814 case TargetOpcode::G_SDIV:
815 case TargetOpcode::G_UREM:
816 case TargetOpcode::G_SREM: {
821 SrcOps[0].getLLTTy(*
getMRI()),
822 SrcOps[1].getLLTTy(*
getMRI()));
824 case TargetOpcode::G_SEXT:
825 case TargetOpcode::G_ZEXT:
826 case TargetOpcode::G_ANYEXT:
830 SrcOps[0].getLLTTy(*
getMRI()),
true);
832 case TargetOpcode::G_TRUNC:
833 case TargetOpcode::G_FPTRUNC:
837 SrcOps[0].getLLTTy(*
getMRI()),
false);
840 case TargetOpcode::COPY:
844 SrcOps[0].getLLTTy(*
getMRI()) ==
LLT() ||
845 DstOps[0].getLLTTy(*
getMRI()) == SrcOps[0].getLLTTy(*
getMRI()));
847 case TargetOpcode::G_FCMP:
848 case TargetOpcode::G_ICMP: {
849 assert(DstOps.
size() == 1 &&
"Invalid Dst Operands");
850 assert(SrcOps.
size() == 3 &&
"Invalid Src Operands");
854 "Expecting predicate");
859 }() &&
"Invalid predicate");
863 LLT Op0Ty = SrcOps[1].getLLTTy(*
getMRI());
864 LLT DstTy = DstOps[0].getLLTTy(*
getMRI());
870 }() &&
"Type Mismatch");
873 case TargetOpcode::G_UNMERGE_VALUES: {
874 assert(!DstOps.
empty() &&
"Invalid trivial sequence");
875 assert(SrcOps.
size() == 1 &&
"Invalid src for Unmerge");
879 DstOps[0].getLLTTy(*
getMRI());
881 "type mismatch in output list");
883 SrcOps[0].getLLTTy(*
getMRI()).getSizeInBits() &&
884 "input operands do not cover output register");
887 case TargetOpcode::G_MERGE_VALUES: {
888 assert(!SrcOps.
empty() &&
"invalid trivial sequence");
893 SrcOps[0].getLLTTy(*
getMRI());
895 "type mismatch in input list");
897 DstOps[0].getLLTTy(*
getMRI()).getSizeInBits() &&
898 "input operands do not cover output register");
899 if (SrcOps.
size() == 1)
901 if (DstOps[0].getLLTTy(*
getMRI()).isVector())
902 return buildInstr(TargetOpcode::G_CONCAT_VECTORS, DstOps, SrcOps);
905 case TargetOpcode::G_EXTRACT_VECTOR_ELT: {
906 assert(DstOps.
size() == 1 &&
"Invalid Dst size");
907 assert(SrcOps.
size() == 2 &&
"Invalid Src size");
910 DstOps[0].getLLTTy(*
getMRI()).isPointer()) &&
911 "Invalid operand type");
913 assert(SrcOps[0].getLLTTy(*
getMRI()).getElementType() ==
914 DstOps[0].getLLTTy(*
getMRI()) &&
918 case TargetOpcode::G_INSERT_VECTOR_ELT: {
919 assert(DstOps.
size() == 1 &&
"Invalid dst size");
920 assert(SrcOps.
size() == 3 &&
"Invalid src size");
922 SrcOps[0].getLLTTy(*
getMRI()).
isVector() &&
"Invalid operand type");
923 assert(DstOps[0].getLLTTy(*
getMRI()).getElementType() ==
924 SrcOps[1].getLLTTy(*
getMRI()) &&
927 assert(DstOps[0].getLLTTy(*
getMRI()).getNumElements() ==
928 SrcOps[0].getLLTTy(*
getMRI()).getNumElements() &&
932 case TargetOpcode::G_BUILD_VECTOR: {
934 "Must have at least 2 operands");
935 assert(DstOps.
size() == 1 &&
"Invalid DstOps");
937 "Res type must be a vector");
941 SrcOps[0].getLLTTy(*
getMRI());
943 "type mismatch in input list");
945 DstOps[0].getLLTTy(*
getMRI()).getSizeInBits() &&
946 "input scalars do not exactly cover the outpur vector register");
949 case TargetOpcode::G_BUILD_VECTOR_TRUNC: {
951 "Must have at least 2 operands");
952 assert(DstOps.
size() == 1 &&
"Invalid DstOps");
954 "Res type must be a vector");
958 SrcOps[0].getLLTTy(*
getMRI());
960 "type mismatch in input list");
963 return buildInstr(TargetOpcode::G_BUILD_VECTOR, DstOps, SrcOps);
966 case TargetOpcode::G_CONCAT_VECTORS: {
967 assert(DstOps.
size() == 1 &&
"Invalid DstOps");
969 "Must have at least 2 operands");
972 return (
Op.getLLTTy(*
getMRI()).isVector() &&
974 SrcOps[0].getLLTTy(*
getMRI()));
976 "type mismatch in input list");
978 DstOps[0].getLLTTy(*
getMRI()).getSizeInBits() &&
979 "input vectors do not exactly cover the outpur vector register");
982 case TargetOpcode::G_UADDE: {
983 assert(DstOps.
size() == 2 &&
"Invalid no of dst operands");
984 assert(SrcOps.
size() == 3 &&
"Invalid no of src operands");
987 (DstOps[0].getLLTTy(*
getMRI()) == SrcOps[1].getLLTTy(*
getMRI())) &&
1000 Op.addSrcToMIB(MIB);
1002 MIB->setFlags(*Flags);
bool isFPPredicate() const
const MachineInstrBuilder & addMetadata(const MDNode *MD) const
virtual MachineInstrBuilder buildConstant(const DstOp &Res, const ConstantInt &Val)
Build and insert Res = G_CONSTANT Val.
void addDefToMIB(MachineRegisterInfo &MRI, MachineInstrBuilder &MIB) const
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...
MachineInstrBuilder buildUnmerge(ArrayRef< LLT > Res, const SrcOp &Op)
Build and insert Res0, ...
MachineInstrBuilder buildGEP(unsigned Res, unsigned Op0, unsigned Op1)
Build and insert Res = G_GEP Op0, Op1.
This class represents lattice values for constants.
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 me...
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...
MachineInstrBuilder buildAtomicRMWSub(unsigned OldValRes, unsigned Addr, unsigned Val, MachineMemOperand &MMO)
Build and insert OldValRes<def> = G_ATOMICRMW_SUB Addr, Val, MMO.
GISelChangeObserver * Observer
MachineInstrBuilder buildCast(const DstOp &Dst, const SrcOp &Src)
Build and insert an appropriate cast between two registers of equal size.
MachineInstrBuilder buildAtomicRMWXor(unsigned OldValRes, unsigned Addr, unsigned Val, MachineMemOperand &MMO)
Build and insert OldValRes<def> = G_ATOMICRMW_XOR Addr, Val, MMO.
LLT getType(unsigned Reg) const
Get the low-level type of Reg or LLT{} if Reg is not a generic (target independent) virtual register...
MachineInstrBuilder buildConcatVectors(const DstOp &Res, ArrayRef< unsigned > Ops)
Build and insert Res = G_CONCAT_VECTORS Op0, ...
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly...
const MachineInstrBuilder & addGlobalAddress(const GlobalValue *GV, int64_t Offset=0, unsigned char TargetFlags=0) const
MachineInstrBuilder buildExtract(unsigned Res, unsigned Src, uint64_t Index)
Build and insert `Res0, ...
void validateSelectOp(const LLT &ResTy, const LLT &TstTy, const LLT &Op0Ty, const LLT &Op1Ty)
unsigned getBitWidth() const
getBitWidth - Return the bitwidth of this constant.
MachineInstrBuilder buildAtomicRMWNand(unsigned OldValRes, unsigned Addr, unsigned Val, MachineMemOperand &MMO)
Build and insert OldValRes<def> = G_ATOMICRMW_NAND Addr, Val, MMO.
MachineInstrBuilder buildStore(unsigned Val, unsigned Addr, MachineMemOperand &MMO)
Build and insert G_STORE Val, Addr, MMO.
void setMF(MachineFunction &MF)
The address of a basic block.
MachineInstrBuilder buildBlockAddress(unsigned Res, const BlockAddress *BA)
Build and insert Res = G_BLOCK_ADDR BA.
A description of a memory reference used in the backend.
void setInsertPt(MachineBasicBlock &MBB, MachineBasicBlock::iterator II)
Set the insertion point before the specified position.
MachineInstrBuilder buildAnyExt(const DstOp &Res, const SrcOp &Op)
Build and insert Res = G_ANYEXT Op0.
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...
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.
const MachineInstrBuilder & addUse(unsigned RegNo, unsigned Flags=0, unsigned SubReg=0) const
Add a virtual register use operand.
void validateTruncExt(const LLT &Dst, const LLT &Src, bool IsExtend)
MachineInstrBuilder buildAnyExtOrTrunc(const DstOp &Res, const SrcOp &Op)
Res = COPY Op depending on the differing sizes of Res and Op.
MachineBasicBlock::iterator II
void recordInsertion(MachineInstr *MI) const
APFloat getAPFloatFromSize(double Val, unsigned Size)
Returns an APFloat from Val converted to the appropriate size.
MachineInstrBuilder buildInstrNoInsert(unsigned Opcode)
Build but don't insert <empty> = Opcode <empty>.
APInt sextOrTrunc(unsigned width) const
Sign extend or truncate to width.
MachineInstrBuilder buildAtomicRMW(unsigned Opcode, unsigned OldValRes, unsigned Addr, unsigned Val, MachineMemOperand &MMO)
Build and insert OldValRes<def> = G_ATOMICRMW_<Opcode> Addr, Val, MMO.
void validateBinaryOp(const LLT &Res, const LLT &Op0, const LLT &Op1)
MachineFunction & getMF()
Getter for the function we currently build.
MachineInstrBuilder buildAtomicRMWUmin(unsigned OldValRes, unsigned Addr, unsigned Val, MachineMemOperand &MMO)
Build and insert OldValRes<def> = G_ATOMICRMW_UMIN Addr, Val, MMO.
const APInt & getValue() const
Return the constant as an APInt value reference.
virtual const TargetInstrInfo * getInstrInfo() const
MachineInstrBuilder buildAtomicRMWUmax(unsigned OldValRes, unsigned Addr, unsigned Val, MachineMemOperand &MMO)
Build and insert OldValRes<def> = G_ATOMICRMW_UMAX Addr, Val, MMO.
static Function * getFunction(Constant *C)
instr_iterator insert(instr_iterator I, MachineInstr *M)
Insert MI into the instruction list before I, possibly inside a bundle.
MachineInstrBuilder buildExtractVectorElement(const DstOp &Res, const SrcOp &Val, const SrcOp &Idx)
Build and insert Res = G_EXTRACT_VECTOR_ELT Val, Idx.
Analysis containing CSE Info
void setChangeObserver(GISelChangeObserver &Observer)
MachineBasicBlock::iterator getInsertPt()
Current insertion point for new instructions.
MachineInstrBuilder buildDbgLabel(const MDNode *Label)
Build and insert a DBG_LABEL instructions specifying that Label is given.
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
MachineInstrBundleIterator< MachineInstr > iterator
MachineInstrBuilder buildSExt(const DstOp &Res, const SrcOp &Op)
Build and insert Res = G_SEXT Op.
MachineRegisterInfo * getMRI()
Getter for MRI.
Abstract class that contains various methods for clients to notify about changes. ...
MachineInstrBuilder buildFPTrunc(const DstOp &Res, const SrcOp &Op)
Build and insert Res = G_FPTRUNC Op.
const MachineInstrBuilder & addBlockAddress(const BlockAddress *BA, int64_t Offset=0, unsigned char TargetFlags=0) const
const TargetInstrInfo * TII
Information used to access the description of the opcodes.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineInstrBuilder buildInstr(unsigned Opcode)
Build and insert <empty> = Opcode <empty>.
size_t size() const
size - Get the array size.
MachineInstrBuilder buildZExt(const DstOp &Res, const SrcOp &Op)
Build and insert Res = G_ZEXT Op.
This is an important base class in LLVM.
MachineInstrBuilder buildPtrMask(unsigned Res, unsigned Op0, uint32_t NumBits)
Build and insert Res = G_PTR_MASK Op0, NumBits.
virtual void createdInstr(MachineInstr &MI)=0
An instruction was created and inserted into the function.
ConstantFP - Floating Point Values [float, double].
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 inst...
void stopObservingChanges()
MachineInstrBuilder buildAtomicRMWAdd(unsigned OldValRes, unsigned Addr, unsigned Val, MachineMemOperand &MMO)
Build and insert OldValRes<def> = G_ATOMICRMW_ADD Addr, Val, MMO.
void setInstr(MachineInstr &MI)
Set the insertion point to before MI.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
MachineInstrBuilder buildInsert(unsigned Res, unsigned Src, unsigned Op, unsigned Index)
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 th...
unsigned getAddressSpace() const
Return the address space of the Pointer type.
DebugLoc DL
Debug location to be set to any instruction we create.
self_iterator getIterator()
const MachineInstrBuilder & addFrameIndex(int Idx) const
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
MachineInstrBuilder buildBrIndirect(unsigned Tgt)
Build and insert G_BRINDIRECT Tgt.
MachineInstrBuilder buildCopy(const DstOp &Res, const SrcOp &Op)
Build and insert Res = COPY Op.
MachineInstrBuilder buildTrunc(const DstOp &Res, const SrcOp &Op)
Build and insert Res = G_TRUNC Op.
static wasm::ValType getType(const TargetRegisterClass *RC)
MachineInstrBuilder buildLoadInstr(unsigned Opcode, unsigned Res, unsigned Addr, MachineMemOperand &MMO)
Build and insert Res = <opcode> Addr, MMO.
MachineInstrBuilder buildFrameIndex(unsigned Res, int Idx)
Build and insert Res = G_FRAME_INDEX Idx.
MachineInstrBuilder buildAtomicRMWXchg(unsigned OldValRes, unsigned Addr, unsigned Val, MachineMemOperand &MMO)
Build and insert OldValRes<def> = G_ATOMICRMW_XCHG Addr, Val, MMO.
MachineInstrBuilder buildBr(MachineBasicBlock &Dest)
Build and insert G_BR Dest.
unsigned createGenericVirtualRegister(LLT Ty, StringRef Name="")
Create and return a new generic virtual register with low-level type Ty.
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 b...
static IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
MachineInstrBuilder buildMerge(const DstOp &Res, ArrayRef< unsigned > Ops)
Build and insert Res = G_MERGE_VALUES Op0, ...
MachineInstrBuilder buildICmp(CmpInst::Predicate Pred, const DstOp &Res, const SrcOp &Op0, const SrcOp &Op1)
Build and insert a Res = G_ICMP Pred, Op0, Op1.
This is the shared class of boolean and integer constants.
virtual MachineInstrBuilder buildFConstant(const DstOp &Res, const ConstantFP &Val)
Build and insert Res = G_FCONSTANT Val.
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 registe...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
bool isVector(MCInstrInfo const &MCII, MCInst const &MCI)
unsigned getSizeInBits() const
Returns the total size of the type. Must only be called on sized types.
const MachineInstrBuilder & addMemOperand(MachineMemOperand *MMO) const
MachineInstrBuilder buildBrCond(unsigned Tst, MachineBasicBlock &Dest)
Build and insert G_BRCOND Tst, Dest.
const TargetInstrInfo & getTII()
static Constant * get(Type *Ty, uint64_t V, bool isSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
MachineInstrBuilder buildSelect(const DstOp &Res, const SrcOp &Tst, const SrcOp &Op0, const SrcOp &Op1)
Build and insert a Res = G_SELECT Tst, Op0, Op1.
LegalityPredicate isScalar(unsigned TypeIdx)
True iff the specified type index is a scalar.
static Constant * get(Type *Ty, double V)
This returns a ConstantFP, or a vector containing a splat of a ConstantFP, for the specified value in...
LLT getLLTTy(const MachineRegisterInfo &MRI) const
const Function & getFunction() const
Return the LLVM function that this machine code represents.
MachineInstrBuilder buildAtomicRMWAnd(unsigned OldValRes, unsigned Addr, unsigned Val, MachineMemOperand &MMO)
Build and insert OldValRes<def> = G_ATOMICRMW_AND Addr, Val, MMO.
void setCSEInfo(GISelCSEInfo *Info)
This file declares the MachineIRBuilder class.
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.
bool isIntPredicate() const
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.
LLT getLLTTy(const MachineRegisterInfo &MRI) const
const MachineBasicBlock * getParent() const
Representation of each machine instruction.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
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 Re...
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
MachineInstrBuilder buildFCmp(CmpInst::Predicate Pred, const DstOp &Res, const SrcOp &Op0, const SrcOp &Op1)
Build and insert a Res = G_FCMP PredOp0, Op1.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
MachineInstrBuilder buildBuildVector(const DstOp &Res, ArrayRef< unsigned > Ops)
Build and insert Res = G_BUILD_VECTOR Op0, ...
const MachineBasicBlock & getMBB() const
Getter for the basic block we currently build.
void setMBB(MachineBasicBlock &MBB)
Set the insertion point to the end of MBB.
MachineInstrBuilder buildBuildVectorTrunc(const DstOp &Res, ArrayRef< unsigned > Ops)
Build and insert Res = G_BUILD_VECTOR_TRUNC Op0, ...
Optional< MachineInstrBuilder > materializeGEP(unsigned &Res, unsigned Op0, const LLT &ValueTy, uint64_t Value)
Materialize and insert Res = G_GEP Op0, (G_CONSTANT Value)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
MachineInstrBuilder insertInstr(MachineInstrBuilder MIB)
Insert an existing instruction at the insertion point.
LLVM Value Representation.
unsigned getSizeInBits(unsigned Reg, const MachineRegisterInfo &MRI, const TargetRegisterInfo &TRI) const
Get the size in bits of Reg.
uint16_t getNumElements() const
Returns the number of elements in a vector LLT.
MachineInstrBuilder buildAtomicRMWMin(unsigned OldValRes, unsigned Addr, unsigned Val, MachineMemOperand &MMO)
Build and insert OldValRes<def> = G_ATOMICRMW_MIN Addr, Val, MMO.
MachineInstrBuilder buildLoad(unsigned Res, unsigned Addr, MachineMemOperand &MMO)
Build and insert Res = G_LOAD Addr, MMO.
MachineInstrBuilder buildAtomicCmpXchg(unsigned OldValRes, unsigned Addr, unsigned CmpVal, unsigned NewVal, MachineMemOperand &MMO)
Build and insert OldValRes<def> = G_ATOMIC_CMPXCHG Addr, CmpVal, NewVal, MMO.
const MachineInstrBuilder & addDef(unsigned RegNo, unsigned Flags=0, unsigned SubReg=0) const
Add a virtual register definition operand.
MachineInstrBuilder buildUndef(const DstOp &Res)
Build and insert Res = IMPLICIT_DEF.
MachineFunction * MF
MachineFunction under construction.
MachineInstrBuilder buildAtomicRMWOr(unsigned OldValRes, unsigned Addr, unsigned Val, MachineMemOperand &MMO)
Build and insert OldValRes<def> = G_ATOMICRMW_OR Addr, Val, MMO.
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned char TargetFlags=0) const
MachineInstrBuilder buildGlobalValue(unsigned Res, const GlobalValue *GV)
Build and insert Res = G_GLOBAL_VALUE GV.
const DebugLoc & getDL()
Getter for DebugLoc.
MachineInstrBuilder buildAtomicRMWMax(unsigned OldValRes, unsigned Addr, unsigned Val, MachineMemOperand &MMO)
Build and insert OldValRes<def> = G_ATOMICRMW_MAX Addr, Val, MMO.
PointerType * getType() const
Global values are always pointers.
bool empty() const
empty - Check if the array is empty.
MachineRegisterInfo * MRI
Information used to verify types are consistent and to create virtual registers.