LLVM  14.0.0git
Classes | Namespaces | Macros | Functions | Variables
AArch64PreLegalizerCombiner.cpp File Reference
#include "AArch64GlobalISelUtils.h"
#include "AArch64TargetMachine.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

 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. More...
 
static void applyFConstantToConstant (MachineInstr &MI)
 Change a G_FCONSTANT into a G_CONSTANT. More...
 
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. More...
 
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 412 of file AArch64PreLegalizerCombiner.cpp.

◆ AARCH64PRELEGALIZERCOMBINERHELPER_GENCOMBINERHELPER_DEPS

#define AARCH64PRELEGALIZERCOMBINERHELPER_GENCOMBINERHELPER_DEPS

Definition at line 347 of file AArch64PreLegalizerCombiner.cpp.

◆ AARCH64PRELEGALIZERCOMBINERHELPER_GENCOMBINERHELPER_H

#define AARCH64PRELEGALIZERCOMBINERHELPER_GENCOMBINERHELPER_H

Definition at line 352 of file AArch64PreLegalizerCombiner.cpp.

◆ DEBUG_TYPE

#define DEBUG_TYPE   "aarch64-prelegalizer-combiner"

Definition at line 30 of file AArch64PreLegalizerCombiner.cpp.

Function Documentation

◆ applyFConstantToConstant()

static void applyFConstantToConstant ( MachineInstr MI)
static

Change a G_FCONSTANT into a G_CONSTANT.

Definition at line 53 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 37 of file AArch64PreLegalizerCombiner.cpp.

References llvm::all_of(), assert(), llvm::LLT::getSizeInBits(), llvm::MachineRegisterInfo::getType(), MI, MRI, and llvm::MachineRegisterInfo::use_nodbg_instructions().

◆ matchFoldGlobalOffset()

static bool matchFoldGlobalOffset ( MachineInstr MI,
MachineRegisterInfo MRI,
std::pair< uint64_t, uint64_t > &  MatchInfo 
)
static

◆ 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 64 of file AArch64PreLegalizerCombiner.cpp.

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

◆ tryToSimplifyUADDO()

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

Variable Documentation

◆ DEBUG_TYPE

DEBUG_TYPE

Definition at line 480 of file AArch64PreLegalizerCombiner.cpp.

◆ false

Combine AArch64 machine instrs before false

Definition at line 481 of file AArch64PreLegalizerCombiner.cpp.

◆ legalization

Combine AArch64 machine instrs before legalization

Definition at line 481 of file AArch64PreLegalizerCombiner.cpp.