LLVM API Documentation
#include "llvm/CodeGen/SelectionDAGISel.h"
#include "llvm/CodeGen/ScheduleDAG.h"
#include "llvm/CallingConv.h"
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Function.h"
#include "llvm/GlobalVariable.h"
#include "llvm/InlineAsm.h"
#include "llvm/Instructions.h"
#include "llvm/Intrinsics.h"
#include "llvm/IntrinsicInst.h"
#include "llvm/CodeGen/IntrinsicLowering.h"
#include "llvm/CodeGen/MachineDebugInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/SelectionDAG.h"
#include "llvm/CodeGen/SSARegMap.h"
#include "llvm/Target/MRegisterInfo.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetFrameInfo.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/Debug.h"
#include <map>
#include <set>
#include <iostream>
#include <algorithm>
#include "llvm/Instruction.def"
#include "llvm/Intrinsics.gen"
Include dependency graph for SelectionDAGISel.cpp:
Go to the source code of this file.
Namespaces | |
namespace | llvm |
Classes | |
class | llvm::FunctionLoweringInfo |
class | llvm::SelectionDAGLowering |
struct | llvm::SelectionDAGLowering::CaseRec |
struct | llvm::SelectionDAGLowering::CaseCmp |
The comparison function for sorting Case values. | |
Defines | |
#define | DEBUG_TYPE "isel" |
#define | HANDLE_INST(NUM, OPCODE, CLASS) case Instruction::OPCODE:return visit##OPCODE((CLASS&)I); |
#define | GET_NO_MEMORY_INTRINSICS |
#define | GET_SIDE_EFFECT_INFO |
Enumerations | |
enum | SchedHeuristics { defaultScheduling, noScheduling, simpleScheduling, simpleNoItinScheduling, listSchedulingBURR, listSchedulingTD } |
Functions | |
static bool | isUsedOutsideOfDefiningBlock (Instruction *I) |
static bool | isOnlyUsedInEntryBlock (Argument *A) |
static bool | IntrinsicCannotAccessMemory (unsigned IntrinsicID) |
static bool | IntrinsicOnlyReadsMemory (unsigned IntrinsicID) |
static const TargetRegisterClass * | isAllocatableRegister (unsigned Reg, MachineFunction &MF, const TargetLowering &TLI, const MRegisterInfo *MRI) |
static SDOperand | getMemsetValue (SDOperand Value, MVT::ValueType VT, SelectionDAG &DAG) |
static SDOperand | getMemsetStringVal (MVT::ValueType VT, SelectionDAG &DAG, TargetLowering &TLI, std::string &Str, unsigned Offset) |
static SDOperand | getMemBasePlusOffset (SDOperand Base, unsigned Offset, SelectionDAG &DAG, TargetLowering &TLI) |
getMemBasePlusOffset - Returns base and offset node for the | |
static bool | MeetsMaxMemopRequirement (std::vector< MVT::ValueType > &MemOps, unsigned Limit, uint64_t Size, unsigned Align, TargetLowering &TLI) |
static Value * | InsertGEPComputeCode (Value *&V, BasicBlock *BB, Instruction *GEPI, Value *Ptr, Value *PtrOffset) |
static void | OptimizeGEPExpression (GetElementPtrInst *GEPI, const TargetData &TD) |
Variables | |
static cl::opt< bool > | ViewISelDAGs ("view-isel-dags", cl::Hidden, cl::desc("Pop up a window to show isel dags as they are selected")) |
static cl::opt< bool > | ViewSchedDAGs ("view-sched-dags", cl::Hidden, cl::desc("Pop up a window to show sched dags as they are processed")) |
cl::opt< SchedHeuristics > | ISHeuristic ("sched", cl::desc("Choose scheduling style"), cl::init(defaultScheduling), cl::values(clEnumValN(defaultScheduling,"default","Target preferred scheduling style"), clEnumValN(noScheduling,"none","No scheduling: breadth first sequencing"), clEnumValN(simpleScheduling,"simple","Simple two pass scheduling: minimize critical path ""and maximize processor utilization"), clEnumValN(simpleNoItinScheduling,"simple-noitin","Simple two pass scheduling: Same as simple ""except using generic latency"), clEnumValN(listSchedulingBURR,"list-burr","Bottom up register reduction list scheduling"), clEnumValN(listSchedulingTD,"list-td","Top-down list scheduler"), clEnumValEnd)) |
std::vector< unsigned > | Regs |
MVT::ValueType | RegVT |
MVT::ValueType | ValueVT |
#define DEBUG_TYPE "isel" |
Definition at line 14 of file SelectionDAGISel.cpp.
#define GET_NO_MEMORY_INTRINSICS |
#define GET_SIDE_EFFECT_INFO |
#define HANDLE_INST | ( | NUM, | |||
OPCODE, | |||||
CLASS | ) | case Instruction::OPCODE:return visit##OPCODE((CLASS&)I); |
enum SchedHeuristics |
defaultScheduling | |
noScheduling | |
simpleScheduling | |
simpleNoItinScheduling | |
listSchedulingBURR | |
listSchedulingTD |
Definition at line 61 of file SelectionDAGISel.cpp.
static SDOperand getMemBasePlusOffset | ( | SDOperand | Base, | |
unsigned | Offset, | |||
SelectionDAG & | DAG, | |||
TargetLowering & | TLI | |||
) | [static] |
getMemBasePlusOffset - Returns base and offset node for the
Definition at line 2430 of file SelectionDAGISel.cpp.
References llvm::ISD::ADD, Base, DAG, llvm::SelectionDAG::getConstant(), and llvm::SelectionDAG::getNode().
Referenced by llvm::SelectionDAGLowering::visitMemIntrinsic().
static SDOperand getMemsetStringVal | ( | MVT::ValueType | VT, | |
SelectionDAG & | DAG, | |||
TargetLowering & | TLI, | |||
std::string & | Str, | |||
unsigned | Offset | |||
) | [static] |
getMemsetStringVal - Similar to getMemsetValue. Except this is only used when a memcpy is turned into a memset when the source is a constant string ptr.
Definition at line 2414 of file SelectionDAGISel.cpp.
References DAG, llvm::SelectionDAG::getConstant(), llvm::MVT::getSizeInBits(), llvm::TargetLowering::isLittleEndian(), TLI, and Val.
Referenced by llvm::SelectionDAGLowering::visitMemIntrinsic().
static SDOperand getMemsetValue | ( | SDOperand | Value, | |
MVT::ValueType | VT, | |||
SelectionDAG & | DAG | |||
) | [static] |
getMemsetValue - Vectorized representation of the memset value operand.
Definition at line 2383 of file SelectionDAGISel.cpp.
References DAG, llvm::SelectionDAG::getConstant(), llvm::SelectionDAG::getNode(), llvm::MVT::i8, llvm::ISD::OR, llvm::ISD::SHL, Val, and llvm::ISD::ZERO_EXTEND.
Referenced by llvm::SelectionDAGLowering::visitMemIntrinsic().
static Value* InsertGEPComputeCode | ( | Value *& | V, | |
BasicBlock * | BB, | |||
Instruction * | GEPI, | |||
Value * | Ptr, | |||
Value * | PtrOffset | |||
) | [static] |
InsertGEPComputeCode - Insert code into BB to compute Ptr+PtrOffset, casting to the type of GEPI.
Definition at line 2614 of file SelectionDAGISel.cpp.
References BB, llvm::BasicBlock::begin(), llvm::Instruction::getParent(), llvm::Value::getType(), and V.
Referenced by OptimizeGEPExpression().
static bool IntrinsicCannotAccessMemory | ( | unsigned | IntrinsicID | ) | [static] |
IntrinsicCannotAccessMemory - Return true if the specified intrinsic cannot access memory and has no other side effects at all.
Definition at line 1259 of file SelectionDAGISel.cpp.
Referenced by llvm::SelectionDAGLowering::visitTargetIntrinsic().
static bool IntrinsicOnlyReadsMemory | ( | unsigned | IntrinsicID | ) | [static] |
Definition at line 1268 of file SelectionDAGISel.cpp.
Referenced by llvm::SelectionDAGLowering::visitTargetIntrinsic().
static const TargetRegisterClass* isAllocatableRegister | ( | unsigned | Reg, | |
MachineFunction & | MF, | |||
const TargetLowering & | TLI, | |||
const MRegisterInfo * | MRI | |||
) | [static] |
isAllocatableRegister - If the specified register is safe to allocate, i.e. it isn't a stack pointer or some other special register, return the register class for the register. Otherwise, return null.
Definition at line 1711 of file SelectionDAGISel.cpp.
References E, llvm::MVT::getSizeInBits(), llvm::TargetLowering::isTypeLegal(), MF, MRI, llvm::MVT::Other, RC, llvm::MRegisterInfo::regclass_begin(), llvm::MRegisterInfo::regclass_end(), and TLI.
Referenced by llvm::SelectionDAGLowering::GetRegistersForValue().
static bool isOnlyUsedInEntryBlock | ( | Argument * | A | ) | [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 200 of file SelectionDAGISel.cpp.
Referenced by llvm::FunctionLoweringInfo::FunctionLoweringInfo().
static bool isUsedOutsideOfDefiningBlock | ( | Instruction * | I | ) | [static] |
isUsedOutsideOfDefiningBlock - Return true if this instruction is used by PHI nodes or outside of the basic block that defines it, or used by a switch instruction, which may expand to multiple basic blocks.
Definition at line 187 of file SelectionDAGISel.cpp.
References BB, E, and llvm::BasicBlock::getParent().
Referenced by llvm::FunctionLoweringInfo::FunctionLoweringInfo().
static bool MeetsMaxMemopRequirement | ( | std::vector< MVT::ValueType > & | MemOps, | |
unsigned | Limit, | |||
uint64_t | Size, | |||
unsigned | Align, | |||
TargetLowering & | TLI | |||
) | [static] |
MeetsMaxMemopRequirement - Determines if the number of memory ops required to replace the memset / memcpy is below the threshold. It also returns the types of the sequence of memory ops to perform memset / memcpy.
Definition at line 2439 of file SelectionDAGISel.cpp.
References llvm::TargetLowering::allowsUnalignedMemoryAccesses(), llvm::MVT::getSizeInBits(), llvm::MVT::i16, llvm::MVT::i32, llvm::MVT::i64, llvm::MVT::i8, llvm::MVT::isInteger(), llvm::TargetLowering::isTypeLegal(), and TLI.
Referenced by llvm::SelectionDAGLowering::visitMemIntrinsic().
static void OptimizeGEPExpression | ( | GetElementPtrInst * | GEPI, | |
const TargetData & | TD | |||
) | [static] |
OptimizeGEPExpression - Since we are doing basic-block-at-a-time instruction selection, we want to be a bit careful about some things. In particular, if we have a GEP instruction that is used in a different block than it is defined, the addressing expression of the GEP cannot be folded into loads or stores that use it. In this case, decompose the GEP and move constant indices into blocks that use it.
Definition at line 2649 of file SelectionDAGISel.cpp.
References E, llvm::Instruction::eraseFromParent(), llvm::ConstantUInt::get(), llvm::TargetData::getIntPtrType(), llvm::User::getOperand(), llvm::Instruction::getParent(), llvm::Type::getPrimitiveSizeInBits(), llvm::TargetData::getStructLayout(), llvm::Value::getType(), llvm::TargetData::getTypeSize(), Idx, InsertGEPComputeCode(), llvm::StructLayout::MemberOffsets, OI, llvm::User::op_begin(), llvm::User::op_end(), TD, Ty, UIntPtrTy, llvm::Value::use_back(), llvm::Value::use_begin(), llvm::Value::use_empty(), and llvm::Value::use_end().
Referenced by llvm::SelectionDAGISel::runOnFunction().
cl::opt<SchedHeuristics> ISHeuristic("sched", cl::desc("Choose scheduling style"), cl::init(defaultScheduling), cl::values(clEnumValN(defaultScheduling,"default","Target preferred scheduling style"),clEnumValN(noScheduling,"none","No scheduling: breadth first sequencing"),clEnumValN(simpleScheduling,"simple","Simple two pass scheduling: minimize critical path ""and maximize processor utilization"),clEnumValN(simpleNoItinScheduling,"simple-noitin","Simple two pass scheduling: Same as simple ""except using generic latency"),clEnumValN(listSchedulingBURR,"list-burr","Bottom up register reduction list scheduling"),clEnumValN(listSchedulingTD,"list-td","Top-down list scheduler"),clEnumValEnd)) [static] |
Referenced by llvm::SelectionDAGISel::ScheduleAndEmitDAG().
std::vector<unsigned> Regs |
Regs - This list hold the register (for legal and promoted values) or register set (for expanded values) that the value should be assigned to.
Definition at line 103 of file SelectionDAGISel.cpp.
Referenced by llvm::SelectionDAGLowering::GetRegistersForValue(), llvm::LiveVariables::removeVirtualRegistersDead(), llvm::LiveVariables::removeVirtualRegistersKilled(), and llvm::SelectionDAGLowering::visitInlineAsm().
RegVT - The value type of each register.
Definition at line 107 of file SelectionDAGISel.cpp.
ValueVT - The value type of the LLVM value, which may be promoted from RegVT or made from merging the two expanded parts.
Definition at line 111 of file SelectionDAGISel.cpp.
Referenced by llvm::SelectionDAGLowering::GetRegistersForValue().
cl::opt<bool> ViewISelDAGs("view-isel-dags", cl::Hidden, cl::desc("Pop up a window to show isel dags as they are selected")) [static] |
cl::opt<bool> ViewSchedDAGs("view-sched-dags", cl::Hidden, cl::desc("Pop up a window to show sched dags as they are processed")) [static] |
Referenced by llvm::SelectionDAGISel::ScheduleAndEmitDAG().