25#define DEBUG_TYPE "gi-combiner"
29bool CombinerHelper::constantFoldICmp(
const GICmp &ICmp,
37 LLT DstTy =
MRI.getType(Dst);
54 B.buildConstant(Dst, 0);
60bool CombinerHelper::constantFoldFCmp(
const GFCmp &FCmp,
68 LLT DstTy =
MRI.getType(Dst);
79 MatchInfo = [=](MachineIRBuilder &
B) {
85 B.buildConstant(Dst, 0);
103 return constantFoldICmp(*Cmp, *CLHS, *CRHS, MatchInfo);
129 return constantFoldFCmp(*Cmp, *CLHS, *CRHS, MatchInfo);
136 B.buildFCmp(Pred, Dst, LHS, RHS, Cmp->getFlags());
unsigned const MachineRegisterInfo * MRI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
This contains common combine transformations that may be used in a combine pass,or by the target else...
Declares convenience wrapper classes for interpreting MachineInstr instances as specific generic oper...
Interface for Targets to specify which operations they can successfully select and how the others sho...
This file declares the MachineIRBuilder class.
Promote Memory to Register
Class for arbitrary precision integers.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Predicate getSwappedPredicate() const
For example, EQ->EQ, SLE->SGE, ULT->UGT, OEQ->OEQ, ULE->UGE, OLT->OGT, etc.
static bool isFPPredicate(Predicate P)
static bool isIntPredicate(Predicate P)
const TargetLowering & getTargetLowering() const
bool matchCanonicalizeFCmp(const MachineInstr &MI, BuildFnTy &MatchInfo) const
bool isConstantLegalOrBeforeLegalizer(const LLT Ty) const
MachineRegisterInfo & MRI
bool matchCanonicalizeICmp(const MachineInstr &MI, BuildFnTy &MatchInfo) const
static LLVM_ABI bool compare(const APFloat &LHS, const APFloat &RHS, FCmpInst::Predicate Pred)
Return result of LHS Pred RHS comparison.
CmpInst::Predicate getCond() const
An floating-point-like constant.
static LLVM_ABI std::optional< GFConstant > getConstant(Register Const, const MachineRegisterInfo &MRI)
GFConstantKind getKind() const
Returns the kind of of this constant, e.g, Scalar.
LLVM_ABI APFloat getScalarValue() const
Returns the value, if this constant is a scalar.
An integer-like constant.
LLVM_ABI APInt getScalarValue() const
Returns the value, if this constant is a scalar.
static LLVM_ABI std::optional< GIConstant > getConstant(Register Const, const MachineRegisterInfo &MRI)
GIConstantKind getKind() const
Returns the kind of of this constant, e.g, Scalar.
Register getReg(unsigned Idx) const
Access the Idx'th operand as a register and return it.
static LLVM_ABI bool compare(const APInt &LHS, const APInt &RHS, ICmpInst::Predicate Pred)
Return result of LHS Pred RHS comparison.
constexpr bool isVector() const
Helper class to build MachineInstr.
Representation of each machine instruction.
Wrapper class representing virtual and physical registers.
This is an optimization pass for GlobalISel generic memory operations.
std::function< void(MachineIRBuilder &)> BuildFnTy
LLVM_ABI int64_t getICmpTrueVal(const TargetLowering &TLI, bool IsVector, bool IsFP)
Returns an integer representing true, as defined by the TargetBooleanContents.
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.