LLVM 24.0.0git
AArch64GlobalISelUtils.h
Go to the documentation of this file.
1//===- AArch64GlobalISelUtils.h ----------------------------------*- C++ -*-==//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8/// \file APIs for AArch64-specific helper functions used in the GlobalISel
9/// pipeline.
10//===----------------------------------------------------------------------===//
11
12#ifndef LLVM_LIB_TARGET_AARCH64_GISEL_AARCH64GLOBALISELUTILS_H
13#define LLVM_LIB_TARGET_AARCH64_GISEL_AARCH64GLOBALISELUTILS_H
19#include "llvm/IR/InstrTypes.h"
20#include <cstdint>
21
22namespace llvm {
23
25
26/// \returns true if \p MaybeSub and \p Pred are part of a CMN tree for an
27/// integer compare.
28bool isCMN(const MachineInstr *MaybeSub, const CmpInst::Predicate &Pred,
30
31/// \returns true if \p Reg is a valid immediate for a vector shift right of
32/// type \p Ty: a constant splat with 1 <= value <= element bits, stored in
33/// \p Cnt. Undef lanes (e.g. from widening odd-sized vectors) are allowed.
35 int64_t &Cnt);
36
37/// Replace a G_MEMSET with a value of 0 with a G_BZERO instruction if it is
38/// supported and beneficial to do so.
39///
40/// \note This only applies on Darwin.
41///
42/// \returns true if \p MI can be replaced with a G_BZERO.
44 const LibcallLoweringInfo &Libcalls, bool MinSize);
45///
46/// Replace \p MI with a G_BZERO.
48
49/// Detect and apply Mul(And(Srl(X, 15), 0x10001), 0xffff) to CMLTz pattern.
51 Register &SrcReg);
53 MachineIRBuilder &B, Register &SrcReg);
54
55/// Analyze a ptrauth discriminator value to try to find the constant integer
56/// and address parts, cracking a ptrauth_blend intrinsic if there is one.
57/// \returns integer/address disc. parts, with NoRegister if no address disc.
58std::tuple<uint16_t, Register>
60
61/// Find the AArch64 condition codes necessary to represent \p P for a scalar
62/// floating point comparison.
63///
64/// \param [out] CondCode is the first condition code.
65/// \param [out] CondCode2 is the second condition code if necessary.
66/// AArch64CC::AL otherwise.
68 AArch64CC::CondCode &CondCode,
69 AArch64CC::CondCode &CondCode2);
70
71/// Find the AArch64 condition codes necessary to represent \p P for a vector
72/// floating point comparison.
73///
74/// \param [out] CondCode - The first condition code.
75/// \param [out] CondCode2 - The second condition code if necessary.
76/// AArch64CC::AL otherwise.
77/// \param [out] Invert - True if the comparison must be inverted with a NOT.
79 AArch64CC::CondCode &CondCode,
80 AArch64CC::CondCode &CondCode2,
81 bool &Invert);
82
83} // namespace AArch64GISelUtils
84} // namespace llvm
85
86#endif
SDValue Pred
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
IRTranslator LLVM IR MI
This file declares the MachineIRBuilder class.
Register Reg
#define P(N)
MachineRegisterInfo & MRI
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Definition InstrTypes.h:740
Tracks which library functions to use for a particular subtarget or function.
Helper class to build MachineInstr.
Representation of each machine instruction.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Wrapper class representing virtual and physical registers.
Definition Register.h:20
std::tuple< uint16_t, Register > extractPtrauthBlendDiscriminators(Register Disc, MachineRegisterInfo &MRI)
Analyze a ptrauth discriminator value to try to find the constant integer and address parts,...
bool matchEmitBZero(const MachineInstr &MI, const MachineRegisterInfo &MRI, const LibcallLoweringInfo &Libcalls, bool MinSize)
Replace a G_MEMSET with a value of 0 with a G_BZERO instruction if it is supported and beneficial to ...
void changeFCMPPredToAArch64CC(const CmpInst::Predicate P, AArch64CC::CondCode &CondCode, AArch64CC::CondCode &CondCode2)
Find the AArch64 condition codes necessary to represent P for a scalar floating point comparison.
void applyCombineMulCMLT(MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B, Register &SrcReg)
bool matchCombineMulCMLT(MachineInstr &MI, MachineRegisterInfo &MRI, Register &SrcReg)
Detect and apply Mul(And(Srl(X, 15), 0x10001), 0xffff) to CMLTz pattern.
bool isVShiftRImm(Register Reg, const MachineRegisterInfo &MRI, LLT Ty, int64_t &Cnt)
void changeVectorFCMPPredToAArch64CC(const CmpInst::Predicate P, AArch64CC::CondCode &CondCode, AArch64CC::CondCode &CondCode2, bool &Invert)
Find the AArch64 condition codes necessary to represent P for a vector floating point comparison.
bool isCMN(const MachineInstr *MaybeSub, const CmpInst::Predicate &Pred, const MachineRegisterInfo &MRI)
void applyEmitBZero(MachineInstr &MI, MachineIRBuilder &MIRBuilder)
Replace MI with a G_BZERO.
This is an optimization pass for GlobalISel generic memory operations.