LLVM API Documentation

Functions
TargetLowering.cpp File Reference
#include "llvm/Target/TargetLowering.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/CodeGen/Analysis.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineJumpTableInfo.h"
#include "llvm/CodeGen/SelectionDAG.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/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Target/TargetSubtargetInfo.h"
#include <cctype>
Include dependency graph for TargetLowering.cpp:

Go to the source code of this file.

Functions

static bool ValueHasExactlyOneBitSet (SDValue Val, const SelectionDAG &DAG)
static unsigned getConstraintGenerality (TargetLowering::ConstraintType CT)
static void ChooseConstraint (TargetLowering::AsmOperandInfo &OpInfo, const TargetLowering &TLI, SDValue Op, SelectionDAG *DAG)

Function Documentation

static void ChooseConstraint ( TargetLowering::AsmOperandInfo OpInfo,
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 2533 of file TargetLowering.cpp.

References 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().

getConstraintGenerality - Return an integer indicating how general CT is.

Definition at line 2425 of file TargetLowering.cpp.

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

Referenced by ChooseConstraint().

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

ValueHasExactlyOneBitSet - Test if the given value is known to have exactly one bit set. This differs from computeKnownBits in that it doesn't need to determine which bit is set.

Definition at line 1121 of file TargetLowering.cpp.

References llvm::CallingConv::C, llvm::SelectionDAG::computeKnownBits(), llvm::APInt::countPopulation(), llvm::SDValue::getNode(), llvm::SDValue::getOpcode(), llvm::SDNode::getOperand(), llvm::EVT::getScalarType(), llvm::EVT::getSizeInBits(), llvm::SDValue::getValueType(), llvm::ISD::SHL, and llvm::ISD::SRL.

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