LLVM  7.0.0svn
TargetLowering.cpp File Reference
#include "llvm/CodeGen/TargetLowering.h"
#include "llvm/ADT/BitVector.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/TargetLoweringObjectFile.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/TargetMachine.h"
#include <cctype>
Include dependency graph for TargetLowering.cpp:

Go to the source code of this file.


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, SDValue Op1, APInt d, const SDLoc &dl, SelectionDAG &DAG, std::vector< SDNode *> &Created)
 Given an exact SDIV by a constant, create a multiplication with the multiplicative inverse of the constant. More...
static SDValue clampDynamicVectorIndex (SelectionDAG &DAG, SDValue Idx, EVT VecVT, const SDLoc &dl)

Function Documentation

◆ BuildExactSDIV()

static SDValue BuildExactSDIV ( const TargetLowering TLI,
SDValue  Op1,
APInt  d,
const SDLoc dl,
SelectionDAG DAG,
std::vector< SDNode *> &  Created 

◆ ChooseConstraint()

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.

"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 2854 of file TargetLowering.cpp.

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

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

◆ clampDynamicVectorIndex()

static SDValue clampDynamicVectorIndex ( SelectionDAG DAG,
SDValue  Idx,
const SDLoc dl 

◆ getConstraintGenerality()

static unsigned getConstraintGenerality ( TargetLowering::ConstraintType  CT)