LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Macros | Functions | Variables
SelectionDAGBuilder.cpp File Reference
#include "SelectionDAGBuilder.h"
#include "SDNodeDbgValue.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/BranchProbabilityInfo.h"
#include "llvm/Analysis/ConstantFolding.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/CodeGen/Analysis.h"
#include "llvm/CodeGen/FastISel.h"
#include "llvm/CodeGen/FunctionLoweringInfo.h"
#include "llvm/CodeGen/GCMetadata.h"
#include "llvm/CodeGen/GCStrategy.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineJumpTableInfo.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/SelectionDAG.h"
#include "llvm/CodeGen/StackMaps.h"
#include "llvm/DebugInfo.h"
#include "llvm/IR/CallingConv.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetFrameLowering.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetIntrinsicInfo.h"
#include "llvm/Target/TargetLibraryInfo.h"
#include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Target/TargetSelectionDAGInfo.h"
#include <algorithm>
#include "llvm/IR/Instruction.def"
#include "llvm/CodeGen/SelectionDAGISel.h"

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "isel"
 
#define HANDLE_INST(NUM, OPCODE, CLASS)   case Instruction::OPCODE: visit##OPCODE((const CLASS&)I); break;
 

Functions

static SDValue getCopyFromPartsVector (SelectionDAG &DAG, SDLoc DL, const SDValue *Parts, unsigned NumParts, MVT PartVT, EVT ValueVT, const Value *V)
 
static SDValue getCopyFromParts (SelectionDAG &DAG, SDLoc DL, const SDValue *Parts, unsigned NumParts, MVT PartVT, EVT ValueVT, const Value *V, ISD::NodeType AssertOp=ISD::DELETED_NODE)
 
static void getCopyToPartsVector (SelectionDAG &DAG, SDLoc dl, SDValue Val, SDValue *Parts, unsigned NumParts, MVT PartVT, const Value *V)
 
static void getCopyToParts (SelectionDAG &DAG, SDLoc DL, SDValue Val, SDValue *Parts, unsigned NumParts, MVT PartVT, const Value *V, ISD::NodeType ExtendKind=ISD::ANY_EXTEND)
 
static bool InBlock (const Value *V, const BasicBlock *BB)
 
static bool areJTsAllowed (const TargetLowering &TLI)
 
static APInt ComputeRange (const APInt &First, const APInt &Last)
 
static bool isSequentialInRange (const SmallVectorImpl< int > &Mask, unsigned Pos, unsigned Size, int Low)
 
static SDValue InsertFenceForAtomic (SDValue Chain, AtomicOrdering Order, SynchronizationScope Scope, bool Before, SDLoc dl, SelectionDAG &DAG, const TargetLowering &TLI)
 
static SDValue GetSignificand (SelectionDAG &DAG, SDValue Op, SDLoc dl)
 
static SDValue GetExponent (SelectionDAG &DAG, SDValue Op, const TargetLowering &TLI, SDLoc dl)
 
static SDValue getF32Constant (SelectionDAG &DAG, unsigned Flt)
 getF32Constant - Get 32-bit floating point constant. More...
 
static SDValue expandExp (SDLoc dl, SDValue Op, SelectionDAG &DAG, const TargetLowering &TLI)
 
static SDValue expandLog (SDLoc dl, SDValue Op, SelectionDAG &DAG, const TargetLowering &TLI)
 
static SDValue expandLog2 (SDLoc dl, SDValue Op, SelectionDAG &DAG, const TargetLowering &TLI)
 
static SDValue expandLog10 (SDLoc dl, SDValue Op, SelectionDAG &DAG, const TargetLowering &TLI)
 
static SDValue expandExp2 (SDLoc dl, SDValue Op, SelectionDAG &DAG, const TargetLowering &TLI)
 
static SDValue expandPow (SDLoc dl, SDValue LHS, SDValue RHS, SelectionDAG &DAG, const TargetLowering &TLI)
 
static SDValue ExpandPowI (SDLoc DL, SDValue LHS, SDValue RHS, SelectionDAG &DAG)
 ExpandPowI - Expand a llvm.powi intrinsic. More...
 
static unsigned getTruncatedArgReg (const SDValue &N)
 
static bool IsOnlyUsedInZeroEqualityComparison (const Value *V)
 
static SDValue getMemCmpLoad (const Value *PtrVal, MVT LoadVT, Type *LoadTy, SelectionDAGBuilder &Builder)
 
static void GetRegistersForValue (SelectionDAG &DAG, const TargetLowering &TLI, SDLoc DL, SDISelAsmOperandInfo &OpInfo)
 
static bool isOnlyUsedInEntryBlock (const Argument *A, bool FastISel)
 

Variables

static unsigned LimitFloatPrecision
 
static cl::opt< unsigned, trueLimitFPPrecision ("limit-float-precision", cl::desc("Generate low-precision inline sequences ""for some float libcalls"), cl::location(LimitFloatPrecision), cl::init(0))
 
static const unsigned MaxParallelChains = 64
 

Macro Definition Documentation

#define DEBUG_TYPE   "isel"

Definition at line 14 of file SelectionDAGBuilder.cpp.

#define HANDLE_INST (   NUM,
  OPCODE,
  CLASS 
)    case Instruction::OPCODE: visit##OPCODE((const CLASS&)I); break;

Function Documentation

static bool areJTsAllowed ( const TargetLowering TLI)
inlinestatic
static APInt ComputeRange ( const APInt First,
const APInt Last 
)
static

Definition at line 2181 of file SelectionDAGBuilder.cpp.

References llvm::APInt::getBitWidth(), and llvm::APInt::sext().

static SDValue expandExp ( SDLoc  dl,
SDValue  Op,
SelectionDAG DAG,
const TargetLowering TLI 
)
static
static SDValue expandExp2 ( SDLoc  dl,
SDValue  Op,
SelectionDAG DAG,
const TargetLowering TLI 
)
static
static SDValue expandLog ( SDLoc  dl,
SDValue  Op,
SelectionDAG DAG,
const TargetLowering TLI 
)
static
static SDValue expandLog10 ( SDLoc  dl,
SDValue  Op,
SelectionDAG DAG,
const TargetLowering TLI 
)
static
static SDValue expandLog2 ( SDLoc  dl,
SDValue  Op,
SelectionDAG DAG,
const TargetLowering TLI 
)
static
static SDValue expandPow ( SDLoc  dl,
SDValue  LHS,
SDValue  RHS,
SelectionDAG DAG,
const TargetLowering TLI 
)
static
static SDValue ExpandPowI ( SDLoc  DL,
SDValue  LHS,
SDValue  RHS,
SelectionDAG DAG 
)
static
static SDValue getCopyFromParts ( SelectionDAG DAG,
SDLoc  DL,
const SDValue Parts,
unsigned  NumParts,
MVT  PartVT,
EVT  ValueVT,
const Value V,
ISD::NodeType  AssertOp = ISD::DELETED_NODE 
)
static
static SDValue getCopyFromPartsVector ( SelectionDAG DAG,
SDLoc  DL,
const SDValue Parts,
unsigned  NumParts,
MVT  PartVT,
EVT  ValueVT,
const Value V 
)
static
static void getCopyToParts ( SelectionDAG DAG,
SDLoc  DL,
SDValue  Val,
SDValue Parts,
unsigned  NumParts,
MVT  PartVT,
const Value V,
ISD::NodeType  ExtendKind = ISD::ANY_EXTEND 
)
static
static void getCopyToPartsVector ( SelectionDAG DAG,
SDLoc  DL,
SDValue  Val,
SDValue Parts,
unsigned  NumParts,
MVT  PartVT,
const Value V 
)
static
static SDValue GetExponent ( SelectionDAG DAG,
SDValue  Op,
const TargetLowering TLI,
SDLoc  dl 
)
static

GetExponent - Get the exponent:

(float)(int)(((Op & 0x7f800000) >> 23) - 127);

where Op is the hexadecimal representation of floating point value.

Definition at line 3793 of file SelectionDAGBuilder.cpp.

References llvm::ISD::AND, llvm::MVT::f32, llvm::SelectionDAG::getConstant(), llvm::SelectionDAG::getNode(), llvm::TargetLoweringBase::getPointerTy(), llvm::MVT::i32, llvm::ISD::SINT_TO_FP, llvm::ISD::SRL, and llvm::ISD::SUB.

Referenced by expandLog(), expandLog10(), and expandLog2().

static SDValue getF32Constant ( SelectionDAG DAG,
unsigned  Flt 
)
static

getF32Constant - Get 32-bit floating point constant.

Definition at line 3806 of file SelectionDAGBuilder.cpp.

References llvm::lltok::APFloat, llvm::MVT::f32, llvm::SelectionDAG::getConstantFP(), and llvm::APFloat::IEEEsingle.

Referenced by expandExp(), expandExp2(), expandLog(), expandLog10(), expandLog2(), and expandPow().

static SDValue getMemCmpLoad ( const Value PtrVal,
MVT  LoadVT,
Type LoadTy,
SelectionDAGBuilder Builder 
)
static
static void GetRegistersForValue ( SelectionDAG DAG,
const TargetLowering TLI,
SDLoc  DL,
SDISelAsmOperandInfo &  OpInfo 
)
static

GetRegistersForValue - Assign registers (virtual or physical) for the specified operand. We prefer to assign virtual registers, to allow the register allocator to handle the assignment process. However, if the asm uses features that we can't model on machineinstrs, we have SDISel do the allocation. This produces generally horrible, but correct, code.

OpInfo describes the operand.

Definition at line 6085 of file SelectionDAGBuilder.cpp.

References llvm::TargetRegisterClass::begin(), llvm::ISD::BITCAST, llvm::MachineRegisterInfo::createVirtualRegister(), llvm::TargetRegisterClass::end(), llvm::SelectionDAG::getContext(), llvm::MVT::getIntegerVT(), llvm::SelectionDAG::getMachineFunction(), llvm::SelectionDAG::getNode(), llvm::TargetLoweringBase::getNumRegisters(), llvm::TargetLowering::getRegForInlineAsmConstraint(), llvm::MachineFunction::getRegInfo(), llvm::MVT::getSizeInBits(), I, llvm::InlineAsm::isInput, llvm::MVT::isInteger(), llvm::MVT::Other, llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), and llvm::TargetRegisterClass::vt_begin().

static SDValue GetSignificand ( SelectionDAG DAG,
SDValue  Op,
SDLoc  dl 
)
static

GetSignificand - Get the significand and build it into a floating-point number with exponent of 1:

Op = (Op & 0x007fffff) | 0x3f800000;

where Op is the hexadecimal representation of floating point value.

Definition at line 3779 of file SelectionDAGBuilder.cpp.

References llvm::ISD::AND, llvm::ISD::BITCAST, llvm::MVT::f32, llvm::SelectionDAG::getConstant(), llvm::SelectionDAG::getNode(), llvm::MVT::i32, and llvm::ISD::OR.

Referenced by expandLog(), expandLog10(), and expandLog2().

static unsigned getTruncatedArgReg ( const SDValue N)
static
static bool InBlock ( const Value V,
const BasicBlock BB 
)
static
static SDValue InsertFenceForAtomic ( SDValue  Chain,
AtomicOrdering  Order,
SynchronizationScope  Scope,
bool  Before,
SDLoc  dl,
SelectionDAG DAG,
const TargetLowering TLI 
)
static
static bool isOnlyUsedInEntryBlock ( const Argument A,
bool  FastISel 
)
static

isOnlyUsedInEntryBlock - If the specified argument is only used in the entry block, return true. This includes arguments used by switches, since the switch may expand into multiple basic blocks.

Definition at line 7198 of file SelectionDAGBuilder.cpp.

References llvm::Function::begin(), llvm::Argument::getParent(), llvm::Value::use_begin(), llvm::Value::use_empty(), and llvm::Value::use_end().

static bool IsOnlyUsedInZeroEqualityComparison ( const Value V)
static

IsOnlyUsedInZeroEqualityComparison - Return true if it only matters that the value is equal or not-equal to zero.

Definition at line 5510 of file SelectionDAGBuilder.cpp.

References llvm::Constant::isNullValue(), llvm::Value::use_begin(), and llvm::Value::use_end().

static bool isSequentialInRange ( const SmallVectorImpl< int > &  Mask,
unsigned  Pos,
unsigned  Size,
int  Low 
)
static

Definition at line 2982 of file SelectionDAGBuilder.cpp.

Variable Documentation

unsigned LimitFloatPrecision
static

LimitFloatPrecision - Generate low-precision inline sequences for some float libcalls (6, 8 or 12 bits).

Definition at line 67 of file SelectionDAGBuilder.cpp.

Referenced by expandExp(), expandExp2(), expandLog(), expandLog10(), expandLog2(), and expandPow().

cl::opt<unsigned, true> LimitFPPrecision("limit-float-precision", cl::desc("Generate low-precision inline sequences ""for some float libcalls"), cl::location(LimitFloatPrecision), cl::init(0))
static
const unsigned MaxParallelChains = 64
static

Definition at line 90 of file SelectionDAGBuilder.cpp.