LLVM
22.0.0git
lib
CodeGen
GlobalISel
MachineFloatingPointPredicateUtils.cpp
Go to the documentation of this file.
1
//===- MachineFloatingPointPredicateUtils.cpp -----------------------------===//
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
9
#include "
llvm/CodeGen/GlobalISel/MachineFloatingPointPredicateUtils.h
"
10
#include "
llvm/CodeGen/GlobalISel/MIPatternMatch.h
"
11
#include "
llvm/CodeGen/LowLevelTypeUtils.h
"
12
#include "
llvm/CodeGen/MachineRegisterInfo.h
"
13
#include "
llvm/CodeGen/MachineSSAContext.h
"
14
#include "
llvm/IR/Constants.h
"
15
#include <optional>
16
17
namespace
llvm
{
18
19
using namespace
MIPatternMatch
;
20
21
template
<>
22
DenormalMode
23
MachineFloatingPointPredicateUtils::queryDenormalMode(
const
MachineFunction
&MF,
24
Register
Val) {
25
const
MachineRegisterInfo &
MRI
= MF.getRegInfo();
26
LLT Ty =
MRI
.getType(Val).getScalarType();
27
return
MF.getDenormalMode(
getFltSemanticForLLT
(Ty));
28
}
29
30
template
<>
31
bool
MachineFloatingPointPredicateUtils::lookThroughFAbs(
32
const
MachineFunction
&MF,
Register
LHS
,
Register
&Src) {
33
const
MachineRegisterInfo &
MRI
= MF.getRegInfo();
34
return
mi_match
(
LHS
,
MRI
,
m_GFabs
(
m_Reg
(Src)));
35
}
36
37
template
<>
38
std::optional<APFloat> MachineFloatingPointPredicateUtils::matchConstantFloat(
39
const
MachineFunction
&MF,
Register
Val) {
40
const
MachineRegisterInfo &
MRI
= MF.getRegInfo();
41
const
ConstantFP
*ConstVal;
42
if
(
mi_match
(Val,
MRI
,
m_GFCst
(ConstVal)))
43
return
ConstVal->getValueAPF();
44
45
return
std::nullopt;
46
}
47
48
}
// namespace llvm
MRI
unsigned const MachineRegisterInfo * MRI
Definition
AArch64AdvSIMDScalarPass.cpp:103
Constants.h
This file contains the declarations for the subclasses of Constant, which represent the different fla...
LowLevelTypeUtils.h
Implement a low-level type suitable for MachineInstr level instruction selection.
MIPatternMatch.h
Contains matchers for matching SSA Machine Instructions.
MachineFloatingPointPredicateUtils.h
MachineRegisterInfo.h
MachineSSAContext.h
This file declares a specialization of the GenericSSAContext<X> template class for Machine IR.
LHS
Value * LHS
Definition
X86PartialReduction.cpp:73
llvm::MachineFunction
Definition
MachineFunction.h:286
llvm::Register
Wrapper class representing virtual and physical registers.
Definition
Register.h:19
llvm::ISD::ConstantFP
@ ConstantFP
Definition
ISDOpcodes.h:87
llvm::MIPatternMatch
Definition
MIPatternMatch.h:25
llvm::MIPatternMatch::m_Reg
operand_type_match m_Reg()
Definition
MIPatternMatch.h:310
llvm::MIPatternMatch::mi_match
bool mi_match(Reg R, const MachineRegisterInfo &MRI, Pattern &&P)
Definition
MIPatternMatch.h:28
llvm::MIPatternMatch::m_GFCst
GFCstAndRegMatch m_GFCst(std::optional< FPValueAndVReg > &FPValReg)
Definition
MIPatternMatch.h:174
llvm::MIPatternMatch::m_GFabs
UnaryOp_match< SrcTy, TargetOpcode::G_FABS > m_GFabs(const SrcTy &Src)
Definition
MIPatternMatch.h:744
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition
AddressRanges.h:18
llvm::getFltSemanticForLLT
LLVM_ABI const llvm::fltSemantics & getFltSemanticForLLT(LLT Ty)
Get the appropriate floating point arithmetic semantic based on the bit size of the given scalar LLT.
Definition
LowLevelTypeUtils.cpp:74
llvm::DenormalMode
Represent subnormal handling kind for floating point instruction inputs and outputs.
Definition
FloatingPointMode.h:71
Generated on
for LLVM by
1.14.0