LLVM API Documentation

TargetLowering.cpp File Reference

#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetSubtarget.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/GlobalVariable.h"
#include "llvm/DerivedTypes.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/SelectionDAG.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/MathExtras.h"

Include dependency graph for TargetLowering.cpp:

Go to the source code of this file.

Classes

struct  mu
struct  ms

Functions

static void InitLibcallNames (const char **Names)
static void InitCmpLibcallCCs (ISD::CondCode *CCs)
static bool ValueHasExactlyOneBitSet (SDValue Val, const SelectionDAG &DAG)
static unsigned getConstraintGenerality (TargetLowering::ConstraintType CT)
static void ChooseConstraint (TargetLowering::AsmOperandInfo &OpInfo, bool hasMemory, const TargetLowering &TLI, SDValue Op, SelectionDAG *DAG)
static mu magicu (const APInt &d)
static ms magic (const APInt &d)


Function Documentation

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

ChooseConstraint - 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 2196 of file TargetLowering.cpp.

References 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(), and llvm::TargetLowering::LowerAsmOperandForConstraint().

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

static unsigned getConstraintGenerality ( TargetLowering::ConstraintType  CT  )  [static]

getConstraintGenerality - Return an integer indicating how general CT is.

Definition at line 2161 of file TargetLowering.cpp.

References llvm::TargetLowering::C_Memory, llvm::TargetLowering::C_Other, llvm::TargetLowering::C_Register, llvm::TargetLowering::C_RegisterClass, and llvm::TargetLowering::C_Unknown.

Referenced by ChooseConstraint().

static void InitCmpLibcallCCs ( ISD::CondCode *  CCs  )  [static]

static void InitLibcallNames ( const char **  Names  )  [static]

InitLibcallNames - Set default libcall names.

Definition at line 31 of file TargetLowering.cpp.

References llvm::RTLIB::ADD_F32, llvm::RTLIB::ADD_F64, llvm::RTLIB::ADD_F80, llvm::RTLIB::ADD_PPCF128, llvm::RTLIB::CEIL_F32, llvm::RTLIB::CEIL_F64, llvm::RTLIB::CEIL_F80, llvm::RTLIB::CEIL_PPCF128, llvm::RTLIB::COS_F32, llvm::RTLIB::COS_F64, llvm::RTLIB::COS_F80, llvm::RTLIB::COS_PPCF128, llvm::RTLIB::DIV_F32, llvm::RTLIB::DIV_F64, llvm::RTLIB::DIV_F80, llvm::RTLIB::DIV_PPCF128, llvm::RTLIB::EXP2_F32, llvm::RTLIB::EXP2_F64, llvm::RTLIB::EXP2_F80, llvm::RTLIB::EXP2_PPCF128, llvm::RTLIB::EXP_F32, llvm::RTLIB::EXP_F64, llvm::RTLIB::EXP_F80, llvm::RTLIB::EXP_PPCF128, llvm::RTLIB::FLOOR_F32, llvm::RTLIB::FLOOR_F64, llvm::RTLIB::FLOOR_F80, llvm::RTLIB::FLOOR_PPCF128, llvm::RTLIB::FPEXT_F32_F64, llvm::RTLIB::FPROUND_F64_F32, llvm::RTLIB::FPROUND_F80_F32, llvm::RTLIB::FPROUND_F80_F64, llvm::RTLIB::FPROUND_PPCF128_F32, llvm::RTLIB::FPROUND_PPCF128_F64, llvm::RTLIB::FPTOSINT_F32_I128, llvm::RTLIB::FPTOSINT_F32_I32, llvm::RTLIB::FPTOSINT_F32_I64, llvm::RTLIB::FPTOSINT_F64_I128, llvm::RTLIB::FPTOSINT_F64_I32, llvm::RTLIB::FPTOSINT_F64_I64, llvm::RTLIB::FPTOSINT_F80_I128, llvm::RTLIB::FPTOSINT_F80_I32, llvm::RTLIB::FPTOSINT_F80_I64, llvm::RTLIB::FPTOSINT_PPCF128_I128, llvm::RTLIB::FPTOSINT_PPCF128_I32, llvm::RTLIB::FPTOSINT_PPCF128_I64, llvm::RTLIB::FPTOUINT_F32_I128, llvm::RTLIB::FPTOUINT_F32_I32, llvm::RTLIB::FPTOUINT_F32_I64, llvm::RTLIB::FPTOUINT_F64_I128, llvm::RTLIB::FPTOUINT_F64_I32, llvm::RTLIB::FPTOUINT_F64_I64, llvm::RTLIB::FPTOUINT_F80_I128, llvm::RTLIB::FPTOUINT_F80_I32, llvm::RTLIB::FPTOUINT_F80_I64, llvm::RTLIB::FPTOUINT_PPCF128_I128, llvm::RTLIB::FPTOUINT_PPCF128_I32, llvm::RTLIB::FPTOUINT_PPCF128_I64, llvm::RTLIB::LOG10_F32, llvm::RTLIB::LOG10_F64, llvm::RTLIB::LOG10_F80, llvm::RTLIB::LOG10_PPCF128, llvm::RTLIB::LOG2_F32, llvm::RTLIB::LOG2_F64, llvm::RTLIB::LOG2_F80, llvm::RTLIB::LOG2_PPCF128, llvm::RTLIB::LOG_F32, llvm::RTLIB::LOG_F64, llvm::RTLIB::LOG_F80, llvm::RTLIB::LOG_PPCF128, llvm::RTLIB::MUL_F32, llvm::RTLIB::MUL_F64, llvm::RTLIB::MUL_F80, llvm::RTLIB::MUL_I128, llvm::RTLIB::MUL_I16, llvm::RTLIB::MUL_I32, llvm::RTLIB::MUL_I64, llvm::RTLIB::MUL_PPCF128, llvm::RTLIB::NEARBYINT_F32, llvm::RTLIB::NEARBYINT_F64, llvm::RTLIB::NEARBYINT_F80, llvm::RTLIB::NEARBYINT_PPCF128, llvm::RTLIB::NEG_I32, llvm::RTLIB::NEG_I64, llvm::RTLIB::O_F32, llvm::RTLIB::O_F64, llvm::RTLIB::OEQ_F32, llvm::RTLIB::OEQ_F64, llvm::RTLIB::OGE_F32, llvm::RTLIB::OGE_F64, llvm::RTLIB::OGT_F32, llvm::RTLIB::OGT_F64, llvm::RTLIB::OLE_F32, llvm::RTLIB::OLE_F64, llvm::RTLIB::OLT_F32, llvm::RTLIB::OLT_F64, llvm::RTLIB::POW_F32, llvm::RTLIB::POW_F64, llvm::RTLIB::POW_F80, llvm::RTLIB::POW_PPCF128, llvm::RTLIB::POWI_F32, llvm::RTLIB::POWI_F64, llvm::RTLIB::POWI_F80, llvm::RTLIB::POWI_PPCF128, llvm::RTLIB::REM_F32, llvm::RTLIB::REM_F64, llvm::RTLIB::REM_F80, llvm::RTLIB::REM_PPCF128, llvm::RTLIB::RINT_F32, llvm::RTLIB::RINT_F64, llvm::RTLIB::RINT_F80, llvm::RTLIB::RINT_PPCF128, llvm::RTLIB::SDIV_I128, llvm::RTLIB::SDIV_I32, llvm::RTLIB::SDIV_I64, llvm::RTLIB::SHL_I128, llvm::RTLIB::SHL_I16, llvm::RTLIB::SHL_I32, llvm::RTLIB::SHL_I64, llvm::RTLIB::SIN_F32, llvm::RTLIB::SIN_F64, llvm::RTLIB::SIN_F80, llvm::RTLIB::SIN_PPCF128, llvm::RTLIB::SINTTOFP_I128_F32, llvm::RTLIB::SINTTOFP_I128_F64, llvm::RTLIB::SINTTOFP_I128_F80, llvm::RTLIB::SINTTOFP_I128_PPCF128, llvm::RTLIB::SINTTOFP_I32_F32, llvm::RTLIB::SINTTOFP_I32_F64, llvm::RTLIB::SINTTOFP_I32_F80, llvm::RTLIB::SINTTOFP_I32_PPCF128, llvm::RTLIB::SINTTOFP_I64_F32, llvm::RTLIB::SINTTOFP_I64_F64, llvm::RTLIB::SINTTOFP_I64_F80, llvm::RTLIB::SINTTOFP_I64_PPCF128, llvm::RTLIB::SQRT_F32, llvm::RTLIB::SQRT_F64, llvm::RTLIB::SQRT_F80, llvm::RTLIB::SQRT_PPCF128, llvm::RTLIB::SRA_I128, llvm::RTLIB::SRA_I16, llvm::RTLIB::SRA_I32, llvm::RTLIB::SRA_I64, llvm::RTLIB::SREM_I128, llvm::RTLIB::SREM_I32, llvm::RTLIB::SREM_I64, llvm::RTLIB::SRL_I128, llvm::RTLIB::SRL_I16, llvm::RTLIB::SRL_I32, llvm::RTLIB::SRL_I64, llvm::RTLIB::SUB_F32, llvm::RTLIB::SUB_F64, llvm::RTLIB::SUB_F80, llvm::RTLIB::SUB_PPCF128, llvm::RTLIB::TRUNC_F32, llvm::RTLIB::TRUNC_F64, llvm::RTLIB::TRUNC_F80, llvm::RTLIB::TRUNC_PPCF128, llvm::RTLIB::UDIV_I128, llvm::RTLIB::UDIV_I32, llvm::RTLIB::UDIV_I64, llvm::RTLIB::UINTTOFP_I128_F32, llvm::RTLIB::UINTTOFP_I128_F64, llvm::RTLIB::UINTTOFP_I128_F80, llvm::RTLIB::UINTTOFP_I128_PPCF128, llvm::RTLIB::UINTTOFP_I32_F32, llvm::RTLIB::UINTTOFP_I32_F64, llvm::RTLIB::UINTTOFP_I32_F80, llvm::RTLIB::UINTTOFP_I32_PPCF128, llvm::RTLIB::UINTTOFP_I64_F32, llvm::RTLIB::UINTTOFP_I64_F64, llvm::RTLIB::UINTTOFP_I64_F80, llvm::RTLIB::UINTTOFP_I64_PPCF128, llvm::RTLIB::UNE_F32, llvm::RTLIB::UNE_F64, llvm::RTLIB::UO_F32, llvm::RTLIB::UO_F64, llvm::RTLIB::UREM_I128, llvm::RTLIB::UREM_I32, and llvm::RTLIB::UREM_I64.

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

static ms magic ( const APInt &  d  )  [static]

static mu magicu ( const APInt &  d  )  [static]

magicu - calculate the magic numbers required to codegen an integer udiv as a sequence of multiply, add and shifts. Requires that the divisor not be 0.

Definition at line 2319 of file TargetLowering.cpp.

References mu::a, llvm::APInt::getAllOnesValue(), llvm::APInt::getBitWidth(), llvm::APInt::getSignedMaxValue(), llvm::APInt::getSignedMinValue(), mu::m, mu::s, llvm::APInt::udiv(), llvm::APInt::uge(), llvm::APInt::ult(), and llvm::APIntOps::urem().

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

static bool ValueHasExactlyOneBitSet ( SDValue  Val,
const SelectionDAG &  DAG 
) [static]