LLVM  10.0.0
Functions
TargetLowering.cpp File Reference
#include "llvm/CodeGen/TargetLowering.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/CodeGen/CallingConvLower.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineJumpTableInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/SelectionDAG.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/KnownBits.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetMachine.h"
#include <cctype>
Include dependency graph for TargetLowering.cpp:

Go to the source code of this file.

Functions

static APInt getKnownUndefForVectorBinop (SDValue BO, SelectionDAG &DAG, const APInt &UndefOp0, const APInt &UndefOp1)
 Given a vector binary operation and known undefined elements for each input operand, compute whether each element of the output is undefined. More...
 
static unsigned getConstraintGenerality (TargetLowering::ConstraintType CT)
 Return an integer indicating how general CT is. More...
 
static void ChooseConstraint (TargetLowering::AsmOperandInfo &OpInfo, const TargetLowering &TLI, SDValue Op, SelectionDAG *DAG)
 If there are multiple different constraints that we could pick for this operand (e.g. More...
 
static SDValue BuildExactSDIV (const TargetLowering &TLI, SDNode *N, const SDLoc &dl, SelectionDAG &DAG, SmallVectorImpl< SDNode *> &Created)
 Given an exact SDIV by a constant, create a multiplication with the multiplicative inverse of the constant. More...
 
static void turnVectorIntoSplatVector (MutableArrayRef< SDValue > Values, std::function< bool(SDValue)> Predicate, SDValue AlternativeReplacement=SDValue())
 If all values in Values that don't match the predicate are same 'splat' value, then replace all values with that splat value. More...
 
static SDValue clampDynamicVectorIndex (SelectionDAG &DAG, SDValue Idx, EVT VecVT, const SDLoc &dl)
 

Function Documentation

◆ BuildExactSDIV()

static SDValue BuildExactSDIV ( const TargetLowering &  TLI,
SDNode *  N,
const SDLoc &  dl,
SelectionDAG &  DAG,
SmallVectorImpl< SDNode *> &  Created 
)
static

◆ ChooseConstraint()

static void ChooseConstraint ( TargetLowering::AsmOperandInfo &  OpInfo,
const TargetLowering &  TLI,
SDValue  Op,
SelectionDAG *  DAG 
)
static

If there are multiple different constraints that we could pick for this operand (e.g.

"imr") try to pick the 'best' one. This is somewhat tricky: constraints fall into four classes: Other -> immediates and magic values Register -> one specific register RegisterClass -> a group of regs Memory -> memory Ideally, we would pick the most specific constraint possible: if we have something that fits into a register, we would pick it. The problem here is that if we have something that could either be in a register or in memory that use of the register could cause selection of other operands to fail: they might only succeed if we pick memory. Because of this the heuristic we use is:

1) If there is an 'other' constraint, and if the operand is valid for that constraint, use it. This makes us take advantage of 'i' constraints when available. 2) Otherwise, pick the most general constraint present. This prefers 'm' over 'r', for example.

Definition at line 4540 of file TargetLowering.cpp.

References assert(), llvm::TargetLowering::C_Immediate, llvm::TargetLowering::C_Memory, llvm::TargetLowering::C_Other, llvm::TargetLowering::C_Register, llvm::TargetLowering::C_RegisterClass, llvm::TargetLowering::C_Unknown, llvm::InlineAsm::ConstraintInfo::Codes, llvm::TargetLowering::AsmOperandInfo::ConstraintCode, llvm::TargetLowering::AsmOperandInfo::ConstraintType, llvm::numbers::e, getConstraintGenerality(), llvm::TargetLowering::getConstraintType(), llvm::SDValue::getNode(), llvm::InlineAsm::ConstraintInfo::hasMatchingInput(), llvm::InlineAsm::ConstraintInfo::isIndirect, and llvm::TargetLowering::LowerAsmOperandForConstraint().

Referenced by llvm::TargetLowering::ComputeConstraintToUse().

◆ clampDynamicVectorIndex()

static SDValue clampDynamicVectorIndex ( SelectionDAG &  DAG,
SDValue  Idx,
EVT  VecVT,
const SDLoc &  dl 
)
static

◆ getConstraintGenerality()

static unsigned getConstraintGenerality ( TargetLowering::ConstraintType  CT)
static

◆ getKnownUndefForVectorBinop()

static APInt getKnownUndefForVectorBinop ( SDValue  BO,
SelectionDAG &  DAG,
const APInt &  UndefOp0,
const APInt &  UndefOp1 
)
static

◆ turnVectorIntoSplatVector()

static void turnVectorIntoSplatVector ( MutableArrayRef< SDValue >  Values,
std::function< bool(SDValue)>  Predicate,
SDValue  AlternativeReplacement = SDValue() 
)
static

If all values in Values that don't match the predicate are same 'splat' value, then replace all values with that splat value.

Else, if AlternativeReplacement was provided, then replace all values that do match predicate with AlternativeReplacement value.

Definition at line 4951 of file TargetLowering.cpp.

References llvm::all_of(), llvm::MutableArrayRef< T >::begin(), llvm::MutableArrayRef< T >::end(), and llvm::find_if_not().