LLVM 17.0.0git
Classes | Namespaces | Macros | Functions | Variables
AArch64PreLegalizerCombiner.cpp File Reference
#include "AArch64GlobalISelUtils.h"
#include "AArch64TargetMachine.h"
#include "llvm/CodeGen/GlobalISel/CSEInfo.h"
#include "llvm/CodeGen/GlobalISel/Combiner.h"
#include "llvm/CodeGen/GlobalISel/CombinerHelper.h"
#include "llvm/CodeGen/GlobalISel/CombinerInfo.h"
#include "llvm/CodeGen/GlobalISel/GISelKnownBits.h"
#include "llvm/CodeGen/GlobalISel/MIPatternMatch.h"
#include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
#include "llvm/CodeGen/MachineDominators.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/TargetPassConfig.h"
#include "llvm/IR/Instructions.h"
#include "llvm/Support/Debug.h"
#include "AArch64GenPreLegalizeGICombiner.inc"
Include dependency graph for AArch64PreLegalizerCombiner.cpp:

Go to the source code of this file.

Classes

class  AArch64PreLegalizerCombinerHelperState
 

Namespaces

namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.
 

Macros

#define DEBUG_TYPE   "aarch64-prelegalizer-combiner"
 
#define AARCH64PRELEGALIZERCOMBINERHELPER_GENCOMBINERHELPER_DEPS
 
#define AARCH64PRELEGALIZERCOMBINERHELPER_GENCOMBINERHELPER_H
 
#define AARCH64PRELEGALIZERCOMBINERHELPER_GENCOMBINERHELPER_CPP
 

Functions

static bool matchFConstantToConstant (MachineInstr &MI, MachineRegisterInfo &MRI)
 Return true if a G_FCONSTANT instruction is known to be better-represented as a G_CONSTANT.
 
static void applyFConstantToConstant (MachineInstr &MI)
 Change a G_FCONSTANT into a G_CONSTANT.
 
static bool matchICmpRedundantTrunc (MachineInstr &MI, MachineRegisterInfo &MRI, GISelKnownBits *KB, Register &MatchInfo)
 Try to match a G_ICMP of a G_TRUNC with zero, in which the truncated bits are sign bits.
 
static bool applyICmpRedundantTrunc (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &Builder, GISelChangeObserver &Observer, Register &WideReg)
 
static bool matchFoldGlobalOffset (MachineInstr &MI, MachineRegisterInfo &MRI, std::pair< uint64_t, uint64_t > &MatchInfo)
 
static bool applyFoldGlobalOffset (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &B, GISelChangeObserver &Observer, std::pair< uint64_t, uint64_t > &MatchInfo)
 
static bool tryToSimplifyUADDO (MachineInstr &MI, MachineIRBuilder &B, CombinerHelper &Helper, GISelChangeObserver &Observer)
 
 INITIALIZE_PASS_BEGIN (AArch64PreLegalizerCombiner, DEBUG_TYPE, "Combine AArch64 machine instrs before legalization", false, false) INITIALIZE_PASS_END(AArch64PreLegalizerCombiner
 
FunctionPassllvm::createAArch64PreLegalizerCombiner ()
 

Variables

 DEBUG_TYPE
 
Combine AArch64 machine instrs before legalization
 
Combine AArch64 machine instrs before false
 

Macro Definition Documentation

◆ AARCH64PRELEGALIZERCOMBINERHELPER_GENCOMBINERHELPER_CPP

#define AARCH64PRELEGALIZERCOMBINERHELPER_GENCOMBINERHELPER_CPP

Definition at line 415 of file AArch64PreLegalizerCombiner.cpp.

◆ AARCH64PRELEGALIZERCOMBINERHELPER_GENCOMBINERHELPER_DEPS

#define AARCH64PRELEGALIZERCOMBINERHELPER_GENCOMBINERHELPER_DEPS

Definition at line 349 of file AArch64PreLegalizerCombiner.cpp.

◆ AARCH64PRELEGALIZERCOMBINERHELPER_GENCOMBINERHELPER_H

#define AARCH64PRELEGALIZERCOMBINERHELPER_GENCOMBINERHELPER_H

Definition at line 354 of file AArch64PreLegalizerCombiner.cpp.

◆ DEBUG_TYPE

#define DEBUG_TYPE   "aarch64-prelegalizer-combiner"

Definition at line 31 of file AArch64PreLegalizerCombiner.cpp.

Function Documentation

◆ applyFConstantToConstant()

static void applyFConstantToConstant ( MachineInstr MI)
static

Change a G_FCONSTANT into a G_CONSTANT.

Definition at line 54 of file AArch64PreLegalizerCombiner.cpp.

References assert(), llvm::APFloat::bitcastToAPInt(), llvm::MachineIRBuilder::buildConstant(), and MI.

◆ applyFoldGlobalOffset()

static bool applyFoldGlobalOffset ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder B,
GISelChangeObserver Observer,
std::pair< uint64_t, uint64_t > &  MatchInfo 
)
static

◆ applyICmpRedundantTrunc()

static bool applyICmpRedundantTrunc ( MachineInstr MI,
MachineRegisterInfo MRI,
MachineIRBuilder Builder,
GISelChangeObserver Observer,
Register WideReg 
)
static

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( AArch64PreLegalizerCombiner  ,
DEBUG_TYPE  ,
"Combine AArch64 machine instrs before legalization"  ,
false  ,
false   
)

◆ matchFConstantToConstant()

static bool matchFConstantToConstant ( MachineInstr MI,
MachineRegisterInfo MRI 
)
static

Return true if a G_FCONSTANT instruction is known to be better-represented as a G_CONSTANT.

Definition at line 38 of file AArch64PreLegalizerCombiner.cpp.

References llvm::all_of(), assert(), MI, and MRI.

◆ matchFoldGlobalOffset()

static bool matchFoldGlobalOffset ( MachineInstr MI,
MachineRegisterInfo MRI,
std::pair< uint64_t, uint64_t > &  MatchInfo 
)
static
Returns
true if it is possible to fold a constant into a G_GLOBAL_VALUE.

e.g.

g = G_GLOBAL_VALUE @x -> g = G_GLOBAL_VALUE @x + cst

Definition at line 117 of file AArch64PreLegalizerCombiner.cpp.

References assert(), llvm::AArch64Subtarget::ClassifyGlobalReference(), llvm::getIConstantVRegValWithLookThrough(), llvm::MachineFunction::getSubtarget(), llvm::MachineFunction::getTarget(), MI, llvm::AArch64II::MO_NO_FLAG, and MRI.

◆ matchICmpRedundantTrunc()

static bool matchICmpRedundantTrunc ( MachineInstr MI,
MachineRegisterInfo MRI,
GISelKnownBits KB,
Register MatchInfo 
)
static

Try to match a G_ICMP of a G_TRUNC with zero, in which the truncated bits are sign bits.

In this case, we can transform the G_ICMP to directly compare the wide value with a zero.

Definition at line 65 of file AArch64PreLegalizerCombiner.cpp.

References assert(), llvm::GISelKnownBits::computeNumSignBits(), llvm::LLT::getSizeInBits(), llvm::ICmpInst::isEquality(), llvm::LLT::isScalar(), LHS, llvm::MIPatternMatch::m_GTrunc(), llvm::MIPatternMatch::m_Reg(), llvm::MIPatternMatch::m_SpecificICst(), MI, llvm::MIPatternMatch::mi_match(), MRI, and RHS.

◆ tryToSimplifyUADDO()

static bool tryToSimplifyUADDO ( MachineInstr MI,
MachineIRBuilder B,
CombinerHelper Helper,
GISelChangeObserver Observer 
)
static

Variable Documentation

◆ DEBUG_TYPE

DEBUG_TYPE

Definition at line 483 of file AArch64PreLegalizerCombiner.cpp.

◆ false

Combine AArch64 machine instrs before false

Definition at line 484 of file AArch64PreLegalizerCombiner.cpp.

◆ legalization

Combine AArch64 machine instrs before legalization

Definition at line 484 of file AArch64PreLegalizerCombiner.cpp.