23 if (MaybeOp1Cst && MaybeOp2Cst) {
30 case TargetOpcode::G_ADD:
32 case TargetOpcode::G_AND:
34 case TargetOpcode::G_ASHR:
36 case TargetOpcode::G_LSHR:
38 case TargetOpcode::G_MUL:
40 case TargetOpcode::G_OR:
42 case TargetOpcode::G_SHL:
44 case TargetOpcode::G_SUB:
46 case TargetOpcode::G_XOR:
48 case TargetOpcode::G_UDIV:
49 if (!C2.getBoolValue())
52 case TargetOpcode::G_SDIV:
53 if (!C2.getBoolValue())
56 case TargetOpcode::G_UREM:
57 if (!C2.getBoolValue())
60 case TargetOpcode::G_SREM:
61 if (!C2.getBoolValue())
83 unsigned Src0,
unsigned Src1) {
91 template <
typename DstTy,
typename UseArg1Ty,
typename UseArg2Ty>
106 case TargetOpcode::G_ADD:
107 case TargetOpcode::G_AND:
108 case TargetOpcode::G_ASHR:
109 case TargetOpcode::G_LSHR:
110 case TargetOpcode::G_MUL:
111 case TargetOpcode::G_OR:
112 case TargetOpcode::G_SHL:
113 case TargetOpcode::G_SUB:
114 case TargetOpcode::G_XOR:
115 case TargetOpcode::G_UDIV:
116 case TargetOpcode::G_SDIV:
117 case TargetOpcode::G_UREM:
118 case TargetOpcode::G_SREM: {
126 template <
typename DstTy,
typename... UseArgsTy>
128 UseArgsTy &&...
Args) {
Compute iterated dominance frontiers using a linear time algorithm.
APInt sdiv(const APInt &RHS) const
Signed division function for APInt.
A CRTP class that contains methods for building instructions that can be constant folded...
APInt udiv(const APInt &RHS) const
Unsigned division operation.
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 buildInstr(unsigned Opc, unsigned Dst, unsigned Src0, unsigned Src1)
static Optional< APInt > ConstantFoldBinOp(unsigned Opcode, const unsigned Op1, const unsigned Op2, const MachineRegisterInfo &MRI)
const MachineInstrBuilder & addUse(unsigned RegNo, unsigned Flags=0, unsigned SubReg=0) const
Add a virtual register use operand.
unsigned getRegFromArg(unsigned Reg)
MachineInstrBuilder buildBinaryOp(unsigned Opcode, unsigned Dst, unsigned Src0, unsigned Src1)
unsigned const MachineRegisterInfo * MRI
APInt urem(const APInt &RHS) const
Unsigned remainder operation.
An MIRBuilder which does trivial constant folding of binary ops.
void addUsesFromArgs(MachineInstrBuilder &MIB)
void validateBinaryOp(unsigned Res, unsigned Op0, unsigned Op1)
APInt lshr(unsigned shiftAmt) const
Logical right-shift function.
unsigned getDestFromArg(unsigned Reg)
APInt ashr(unsigned ShiftAmt) const
Arithmetic right-shift function.
MachineInstrBuilder buildInstr(unsigned Opc, DstTy &&Ty, UseArg1Ty &&Arg1, UseArg2Ty &&Arg2)
unsigned getSizeInBits() const
Returns the total size of the type. Must only be called on sized types.
This file declares the MachineIRBuilder class.
Class for arbitrary precision integers.
Optional< int64_t > getConstantVRegVal(unsigned VReg, const MachineRegisterInfo &MRI)
MachineInstrBuilder buildConstant(unsigned Res, const ConstantInt &Val)
Build and insert Res = G_CONSTANT Val.
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
APInt srem(const APInt &RHS) const
Function for signed remainder operation.
MachineFunction & getMF()
Getter for the function we currently build.
MachineInstrBuilder buildInstr(unsigned Opc, DstTy &&Ty, UseArgsTy &&... Args)
const MachineInstrBuilder & addDef(unsigned RegNo, unsigned Flags=0, unsigned SubReg=0) const
Add a virtual register definition operand.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.