LLVM API Documentation
#include <FastISel.h>
Classes | |
struct | SavePoint |
Public Member Functions | |
MachineInstr * | getLastLocalValue () |
void | setLastLocalValue (MachineInstr *I) |
void | startNewBlock () |
DebugLoc | getCurDebugLoc () const |
Return current debug location information. More... | |
bool | LowerArguments () |
bool | SelectInstruction (const Instruction *I) |
bool | SelectOperator (const User *I, unsigned Opcode) |
unsigned | getRegForValue (const Value *V) |
unsigned | lookUpRegForValue (const Value *V) |
std::pair< unsigned, bool > | getRegForGEPIndex (const Value *V) |
bool | tryToFoldLoad (const LoadInst *LI, const Instruction *FoldInst) |
We're checking to see if we can fold LI into FoldInst . Note that we could have a sequence where multiple LLVM IR instructions are folded into the same machineinstr. For example we could have: More... | |
virtual bool | tryToFoldLoadIntoMI (MachineInstr *, unsigned, const LoadInst *) |
The specified machine instr operand is a vreg, and that vreg is being provided by the specified load instruction. If possible, try to fold the load as an operand to the instruction, returning true if possible. More... | |
void | recomputeInsertPt () |
void | removeDeadCode (MachineBasicBlock::iterator I, MachineBasicBlock::iterator E) |
Remove all dead instructions between the I and E. More... | |
SavePoint | enterLocalValueArea () |
void | leaveLocalValueArea (SavePoint Old) |
Reset InsertPt to the given old insert position. More... | |
virtual | ~FastISel () |
Protected Member Functions | |
FastISel (FunctionLoweringInfo &funcInfo, const TargetLibraryInfo *libInfo) | |
virtual bool | TargetSelectInstruction (const Instruction *I)=0 |
virtual bool | FastLowerArguments () |
virtual unsigned | FastEmit_ (MVT VT, MVT RetVT, unsigned Opcode) |
virtual unsigned | FastEmit_r (MVT VT, MVT RetVT, unsigned Opcode, unsigned Op0, bool Op0IsKill) |
virtual unsigned | FastEmit_rr (MVT VT, MVT RetVT, unsigned Opcode, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) |
virtual unsigned | FastEmit_ri (MVT VT, MVT RetVT, unsigned Opcode, unsigned Op0, bool Op0IsKill, uint64_t Imm) |
virtual unsigned | FastEmit_rf (MVT VT, MVT RetVT, unsigned Opcode, unsigned Op0, bool Op0IsKill, const ConstantFP *FPImm) |
virtual unsigned | FastEmit_rri (MVT VT, MVT RetVT, unsigned Opcode, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill, uint64_t Imm) |
unsigned | FastEmit_ri_ (MVT VT, unsigned Opcode, unsigned Op0, bool Op0IsKill, uint64_t Imm, MVT ImmType) |
This method is a wrapper of FastEmit_ri. More... | |
virtual unsigned | FastEmit_i (MVT VT, MVT RetVT, unsigned Opcode, uint64_t Imm) |
virtual unsigned | FastEmit_f (MVT VT, MVT RetVT, unsigned Opcode, const ConstantFP *FPImm) |
unsigned | FastEmitInst_ (unsigned MachineInstOpcode, const TargetRegisterClass *RC) |
unsigned | FastEmitInst_r (unsigned MachineInstOpcode, const TargetRegisterClass *RC, unsigned Op0, bool Op0IsKill) |
unsigned | FastEmitInst_rr (unsigned MachineInstOpcode, const TargetRegisterClass *RC, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) |
unsigned | FastEmitInst_rrr (unsigned MachineInstOpcode, const TargetRegisterClass *RC, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill, unsigned Op2, bool Op2IsKill) |
unsigned | FastEmitInst_ri (unsigned MachineInstOpcode, const TargetRegisterClass *RC, unsigned Op0, bool Op0IsKill, uint64_t Imm) |
unsigned | FastEmitInst_rii (unsigned MachineInstOpcode, const TargetRegisterClass *RC, unsigned Op0, bool Op0IsKill, uint64_t Imm1, uint64_t Imm2) |
Emit a MachineInstr with one register operand and two immediate operands. More... | |
unsigned | FastEmitInst_rf (unsigned MachineInstOpcode, const TargetRegisterClass *RC, unsigned Op0, bool Op0IsKill, const ConstantFP *FPImm) |
unsigned | FastEmitInst_rri (unsigned MachineInstOpcode, const TargetRegisterClass *RC, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill, uint64_t Imm) |
unsigned | FastEmitInst_rrii (unsigned MachineInstOpcode, const TargetRegisterClass *RC, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill, uint64_t Imm1, uint64_t Imm2) |
unsigned | FastEmitInst_i (unsigned MachineInstrOpcode, const TargetRegisterClass *RC, uint64_t Imm) |
unsigned | FastEmitInst_ii (unsigned MachineInstrOpcode, const TargetRegisterClass *RC, uint64_t Imm1, uint64_t Imm2) |
Emit a MachineInstr with a two immediate operands. More... | |
unsigned | FastEmitInst_extractsubreg (MVT RetVT, unsigned Op0, bool Op0IsKill, uint32_t Idx) |
unsigned | FastEmitZExtFromI1 (MVT VT, unsigned Op0, bool Op0IsKill) |
void | FastEmitBranch (MachineBasicBlock *MBB, DebugLoc DL) |
void | UpdateValueMap (const Value *I, unsigned Reg, unsigned NumRegs=1) |
unsigned | createResultReg (const TargetRegisterClass *RC) |
virtual unsigned | TargetMaterializeConstant (const Constant *C) |
virtual unsigned | TargetMaterializeAlloca (const AllocaInst *C) |
Emit an alloca address in a register using target-specific logic. More... | |
virtual unsigned | TargetMaterializeFloatZero (const ConstantFP *CF) |
bool | canFoldAddIntoGEP (const User *GEP, const Value *Add) |
Check if Add is an add that can be safely folded into GEP . More... | |
Protected Attributes | |
DenseMap< const Value *, unsigned > | LocalValueMap |
FunctionLoweringInfo & | FuncInfo |
MachineRegisterInfo & | MRI |
MachineFrameInfo & | MFI |
MachineConstantPool & | MCP |
DebugLoc | DL |
const TargetMachine & | TM |
const DataLayout & | TD |
const TargetInstrInfo & | TII |
const TargetLowering & | TLI |
const TargetRegisterInfo & | TRI |
const TargetLibraryInfo * | LibInfo |
MachineInstr * | LastLocalValue |
MachineInstr * | EmitStartPt |
This is a fast-path instruction selection class that generates poor code and doesn't support illegal types or non-trivial lowering, but runs quickly.
Definition at line 47 of file FastISel.h.
|
virtual |
Definition at line 1106 of file FastISel.cpp.
|
explicitprotected |
Definition at line 1092 of file FastISel.cpp.
Check if Add
is an add that can be safely folded into GEP
.
Add
can be folded into GEP
if:
Add
is an add,Add's
size matches GEP's
,Add
is in the same basic block as GEP
, andAdd
has a constant operand. Definition at line 1574 of file FastISel.cpp.
References FuncInfo, getParent(), llvm::Value::getType(), llvm::DataLayout::getTypeSizeInBits(), llvm::FunctionLoweringInfo::MBB, llvm::FunctionLoweringInfo::MBBMap, and TD.
|
protected |
Definition at line 1203 of file FastISel.cpp.
References llvm::MachineRegisterInfo::createVirtualRegister(), and MRI.
Referenced by FastEmitInst_(), FastEmitInst_extractsubreg(), FastEmitInst_i(), FastEmitInst_ii(), FastEmitInst_r(), FastEmitInst_rf(), FastEmitInst_ri(), FastEmitInst_rii(), FastEmitInst_rr(), FastEmitInst_rri(), FastEmitInst_rrii(), and FastEmitInst_rrr().
FastISel::SavePoint FastISel::enterLocalValueArea | ( | ) |
Prepare InsertPt to begin inserting instructions into the local value area and return the old insert position.
Definition at line 336 of file FastISel.cpp.
References DL, FuncInfo, llvm::FunctionLoweringInfo::InsertPt, and recomputeInsertPt().
Referenced by getRegForValue().
This method is called by target-independent code to request that an instruction with the given type and opcode be emitted.
Definition at line 1112 of file FastISel.cpp.
|
protectedvirtual |
This method is called by target-independent code to request that an instruction with the given type, opcode, and floating-point immediate operand be emitted.
Definition at line 1134 of file FastISel.cpp.
This method is called by target-independent code to request that an instruction with the given type, opcode, and immediate operand be emitted.
Definition at line 1130 of file FastISel.cpp.
Referenced by FastEmit_ri_().
|
protectedvirtual |
This method is called by target-independent code to request that an instruction with the given type, opcode, and register operand be emitted.
Definition at line 1117 of file FastISel.cpp.
Referenced by getRegForGEPIndex().
|
protectedvirtual |
This method is called by target-independent code to request that an instruction with the given type, opcode, and register and floating-point immediate operands be emitted.
Definition at line 1146 of file FastISel.cpp.
|
protectedvirtual |
This method is called by target-independent code to request that an instruction with the given type, opcode, and register and immediate operands be emitted.
Definition at line 1139 of file FastISel.cpp.
Referenced by FastEmit_ri_(), and FastEmitZExtFromI1().
|
protected |
This method is a wrapper of FastEmit_ri.
It first tries to emit an instruction with an immediate operand using FastEmit_ri. If that fails, it materializes the immediate into a register and try FastEmit_rr instead.
FastEmit_ri_ - This method is a wrapper of FastEmit_ri. It first tries to emit an instruction with an immediate operand using FastEmit_ri. If that fails, it materializes the immediate into a register and try FastEmit_rr instead.
Definition at line 1165 of file FastISel.cpp.
References llvm::ISD::Constant, FastEmit_i(), FastEmit_ri(), FastEmit_rr(), llvm::FunctionLoweringInfo::Fn, FuncInfo, llvm::IntegerType::get(), llvm::ConstantInt::get(), llvm::Function::getContext(), getRegForValue(), llvm::MVT::getSizeInBits(), llvm::isPowerOf2_64(), llvm::Log2_64(), llvm::ISD::MUL, llvm::ISD::SHL, llvm::ISD::SRA, llvm::ISD::SRL, and llvm::ISD::UDIV.
|
protectedvirtual |
This method is called by target-independent code to request that an instruction with the given type, opcode, and register operands be emitted.
Definition at line 1123 of file FastISel.cpp.
Referenced by FastEmit_ri_().
|
protectedvirtual |
This method is called by target-independent code to request that an instruction with the given type, opcode, and register and immediate operands be emitted.
Definition at line 1153 of file FastISel.cpp.
|
protected |
Emit an unconditional branch to the given block, unless it is the immediate (fall-through) successor, and update the CFG.
FastEmitBranch - Emit an unconditional branch to the given block, unless it is the immediate (fall-through) successor, and update the CFG.
Definition at line 874 of file FastISel.cpp.
References llvm::MachineBasicBlock::addSuccessor(), FuncInfo, llvm::MachineBasicBlock::getBasicBlock(), llvm::TargetInstrInfo::InsertBranch(), llvm::MachineBasicBlock::isLayoutSuccessor(), llvm::FunctionLoweringInfo::MBB, llvm::BasicBlock::size(), and TII.
Referenced by SelectOperator().
|
protected |
Emit a MachineInstr with no operands and a result register in the given register class.
Definition at line 1207 of file FastISel.cpp.
References llvm::BuildMI(), createResultReg(), DL, FuncInfo, llvm::MCInstrInfo::get(), llvm::FunctionLoweringInfo::InsertPt, llvm::FunctionLoweringInfo::MBB, and TII.
|
protected |
Emit a MachineInstr for an extract_subreg from a specified index of a superregister to a specified type.
Definition at line 1426 of file FastISel.cpp.
References llvm::BuildMI(), llvm::MachineRegisterInfo::constrainRegClass(), llvm::TargetOpcode::COPY, createResultReg(), DL, FuncInfo, llvm::MCInstrInfo::get(), llvm::getKillRegState(), llvm::MachineRegisterInfo::getRegClass(), llvm::TargetLoweringBase::getRegClassFor(), llvm::TargetRegisterInfo::getSubClassWithSubReg(), llvm::FunctionLoweringInfo::InsertPt, llvm::TargetRegisterInfo::isVirtualRegister(), llvm::FunctionLoweringInfo::MBB, MRI, TII, TLI, and TRI.
|
protected |
Emit a MachineInstr with a single immediate operand, and a result register in the given register class.
Definition at line 1393 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::BuildMI(), llvm::TargetOpcode::COPY, createResultReg(), DL, FuncInfo, llvm::MCInstrInfo::get(), llvm::MCInstrDesc::getNumDefs(), llvm::MCInstrDesc::ImplicitDefs, llvm::FunctionLoweringInfo::InsertPt, llvm::FunctionLoweringInfo::MBB, and TII.
|
protected |
Emit a MachineInstr with a two immediate operands.
Definition at line 1409 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::BuildMI(), llvm::TargetOpcode::COPY, createResultReg(), DL, FuncInfo, llvm::MCInstrInfo::get(), llvm::MCInstrDesc::getNumDefs(), llvm::MCInstrDesc::ImplicitDefs, llvm::FunctionLoweringInfo::InsertPt, llvm::FunctionLoweringInfo::MBB, and TII.
|
protected |
Emit a MachineInstr with one register operand and a result register in the given register class.
Definition at line 1216 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), llvm::TargetOpcode::COPY, createResultReg(), DL, FuncInfo, llvm::MCInstrInfo::get(), llvm::MCInstrDesc::getNumDefs(), llvm::MCInstrDesc::ImplicitDefs, llvm::FunctionLoweringInfo::InsertPt, llvm::RegState::Kill, llvm::FunctionLoweringInfo::MBB, and TII.
|
protected |
Emit a MachineInstr with two register operands and a result register in the given register class.
Definition at line 1324 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addFPImm(), llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), llvm::TargetOpcode::COPY, createResultReg(), DL, FuncInfo, llvm::MCInstrInfo::get(), llvm::MCInstrDesc::getNumDefs(), llvm::MCInstrDesc::ImplicitDefs, llvm::FunctionLoweringInfo::InsertPt, llvm::RegState::Kill, llvm::FunctionLoweringInfo::MBB, and TII.
|
protected |
Emit a MachineInstr with a register operand, an immediate, and a result register in the given register class.
Definition at line 1280 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), llvm::TargetOpcode::COPY, createResultReg(), DL, FuncInfo, llvm::MCInstrInfo::get(), llvm::MCInstrDesc::getNumDefs(), llvm::MCInstrDesc::ImplicitDefs, llvm::FunctionLoweringInfo::InsertPt, llvm::RegState::Kill, llvm::FunctionLoweringInfo::MBB, and TII.
|
protected |
Emit a MachineInstr with one register operand and two immediate operands.
Definition at line 1301 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), llvm::TargetOpcode::COPY, createResultReg(), DL, FuncInfo, llvm::MCInstrInfo::get(), llvm::MCInstrDesc::getNumDefs(), llvm::MCInstrDesc::ImplicitDefs, llvm::FunctionLoweringInfo::InsertPt, llvm::RegState::Kill, llvm::FunctionLoweringInfo::MBB, and TII.
|
protected |
Emit a MachineInstr with two register operands and a result register in the given register class.
Definition at line 1235 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), llvm::TargetOpcode::COPY, createResultReg(), DL, FuncInfo, llvm::MCInstrInfo::get(), llvm::MCInstrDesc::getNumDefs(), llvm::MCInstrDesc::ImplicitDefs, llvm::FunctionLoweringInfo::InsertPt, llvm::RegState::Kill, llvm::FunctionLoweringInfo::MBB, and TII.
|
protected |
Emit a MachineInstr with two register operands, an immediate, and a result register in the given register class.
Definition at line 1345 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), llvm::TargetOpcode::COPY, createResultReg(), DL, FuncInfo, llvm::MCInstrInfo::get(), llvm::MCInstrDesc::getNumDefs(), llvm::MCInstrDesc::ImplicitDefs, llvm::FunctionLoweringInfo::InsertPt, llvm::RegState::Kill, llvm::FunctionLoweringInfo::MBB, and TII.
|
protected |
Emit a MachineInstr with two register operands, two immediates operands, and a result register in the given register class.
Definition at line 1369 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), llvm::TargetOpcode::COPY, createResultReg(), DL, FuncInfo, llvm::MCInstrInfo::get(), llvm::MCInstrDesc::getNumDefs(), llvm::MCInstrDesc::ImplicitDefs, llvm::FunctionLoweringInfo::InsertPt, llvm::RegState::Kill, llvm::FunctionLoweringInfo::MBB, and TII.
|
protected |
Emit a MachineInstr with three register operands and a result register in the given register class.
Definition at line 1256 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), llvm::TargetOpcode::COPY, createResultReg(), DL, FuncInfo, llvm::MCInstrInfo::get(), llvm::MCInstrDesc::getNumDefs(), llvm::MCInstrDesc::ImplicitDefs, llvm::FunctionLoweringInfo::InsertPt, llvm::RegState::Kill, llvm::FunctionLoweringInfo::MBB, and TII.
Emit MachineInstrs to compute the value of Op with all but the least significant bit set to zero.
FastEmitZExtFromI1 - Emit MachineInstrs to compute the value of Op with all but the least significant bit set to zero.
Definition at line 1442 of file FastISel.cpp.
References llvm::ISD::AND, and FastEmit_ri().
|
protectedvirtual |
This method is called by target-independent code to do target specific argument lowering. It returns true if it was successful.
Definition at line 1108 of file FastISel.cpp.
Referenced by LowerArguments().
|
inline |
|
inline |
Return the position of the last instruction emitted for materializing constants for use in the current block.
Definition at line 76 of file FastISel.h.
References LastLocalValue.
Referenced by recomputeInsertPt().
This is a wrapper around getRegForValue that also takes care of truncating or sign-extending the given getelementptr index value.
Definition at line 286 of file FastISel.cpp.
References llvm::EVT::bitsGT(), llvm::EVT::bitsLT(), FastEmit_r(), llvm::EVT::getEVT(), llvm::TargetLoweringBase::getPointerTy(), getRegForValue(), llvm::EVT::getSimpleVT(), llvm::Value::getType(), llvm::ISD::SIGN_EXTEND, TLI, and llvm::ISD::TRUNCATE.
Create a virtual register and arrange for it to be assigned the value for the given LLVM value.
Definition at line 139 of file FastISel.cpp.
References enterLocalValueArea(), FuncInfo, llvm::Value::getContext(), llvm::EVT::getSimpleVT(), llvm::Value::getType(), llvm::TargetLoweringBase::getTypeToTransformTo(), llvm::TargetLoweringBase::getValueType(), llvm::MVT::i1, llvm::MVT::i16, llvm::MVT::i8, llvm::FunctionLoweringInfo::InitializeRegForValue(), llvm::EVT::isSimple(), llvm::TargetLoweringBase::isTypeLegal(), leaveLocalValueArea(), lookUpRegForValue(), llvm::FunctionLoweringInfo::StaticAllocaMap, and TLI.
Referenced by FastEmit_ri_(), getRegForGEPIndex(), SelectOperator(), and tryToFoldLoad().
void FastISel::leaveLocalValueArea | ( | SavePoint | Old | ) |
Reset InsertPt to the given old insert position.
Definition at line 345 of file FastISel.cpp.
References llvm::MachineBasicBlock::begin(), DL, llvm::FastISel::SavePoint::DL, FuncInfo, llvm::FunctionLoweringInfo::InsertPt, llvm::FastISel::SavePoint::InsertPt, LastLocalValue, llvm::FunctionLoweringInfo::MBB, and llvm::prior().
Referenced by getRegForValue().
Look up the value to see if its value is already cached in a register. It may be defined by instructions across blocks or defined locally.
Definition at line 250 of file FastISel.cpp.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::find(), FuncInfo, LocalValueMap, and llvm::FunctionLoweringInfo::ValueMap.
Referenced by getRegForValue().
bool FastISel::LowerArguments | ( | ) |
Do "fast" instruction selection for function arguments and append machine instructions to the current block. Return true if it is successful.
Definition at line 88 of file FastISel.cpp.
References llvm::Function::arg_begin(), llvm::Function::arg_end(), llvm::FunctionLoweringInfo::CanLowerReturn, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::end(), FastLowerArguments(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::find(), llvm::FunctionLoweringInfo::Fn, FuncInfo, I, LocalValueMap, and llvm::FunctionLoweringInfo::ValueMap.
void FastISel::recomputeInsertPt | ( | ) |
Reset InsertPt to prepare for inserting instructions into the current block.
Definition at line 310 of file FastISel.cpp.
References llvm::TargetOpcode::EH_LABEL, llvm::MachineBasicBlock::end(), FuncInfo, llvm::MachineBasicBlock::getFirstNonPHI(), getLastLocalValue(), llvm::FunctionLoweringInfo::InsertPt, and llvm::FunctionLoweringInfo::MBB.
Referenced by enterLocalValueArea(), removeDeadCode(), and SelectInstruction().
void FastISel::removeDeadCode | ( | MachineBasicBlock::iterator | I, |
MachineBasicBlock::iterator | E | ||
) |
Remove all dead instructions between the I and E.
Definition at line 324 of file FastISel.cpp.
References llvm::RegState::Dead, llvm::MachineInstr::eraseFromParent(), I, and recomputeInsertPt().
Referenced by SelectInstruction().
bool FastISel::SelectInstruction | ( | const Instruction * | I | ) |
Do "fast" instruction selection for the given LLVM IR instruction, and append generated machine instructions to the current block. Return true if selection was successful.
Definition at line 818 of file FastISel.cpp.
References DL, FuncInfo, llvm::CallInst::getCalledFunction(), llvm::Instruction::getDebugLoc(), llvm::TargetLibraryInfo::getLibFunc(), llvm::Value::getName(), llvm::Instruction::getOpcode(), llvm::Instruction::getParent(), llvm::GlobalValue::hasLocalLinkage(), llvm::Value::hasName(), llvm::TargetLibraryInfo::hasOptimizedCodeGen(), llvm::FunctionLoweringInfo::InsertPt, LibInfo, recomputeInsertPt(), removeDeadCode(), SelectOperator(), and TargetSelectInstruction().
Do "fast" instruction selection for the given LLVM IR operator (Instruction or ConstantExpr), and append generated machine instructions to the current block. Return true if selection was successful.
Definition at line 977 of file FastISel.cpp.
References llvm::ISD::ADD, llvm::ISD::AND, llvm::APIntOps::And(), llvm::EVT::bitsGT(), llvm::EVT::bitsLT(), llvm::Call, llvm::ISD::FADD, FastEmitBranch(), llvm::ISD::FDIV, llvm::ISD::FMUL, llvm::ISD::FP_TO_SINT, llvm::ISD::FREM, llvm::ISD::FSUB, FuncInfo, llvm::Instruction::getDebugLoc(), llvm::User::getOperand(), getRegForValue(), llvm::BranchInst::getSuccessor(), llvm::Value::getType(), llvm::TargetLoweringBase::getValueType(), I, llvm::BinaryOperator::isFNeg(), llvm::BranchInst::isUnconditional(), llvm_unreachable, llvm::FunctionLoweringInfo::MBBMap, llvm::ISD::MUL, llvm::ISD::OR, llvm::APIntOps::Or(), llvm::TargetOpcode::PHI, llvm::ISD::SDIV, llvm::ISD::SHL, llvm::ISD::SIGN_EXTEND, llvm::ISD::SINT_TO_FP, llvm::ISD::SRA, llvm::ISD::SREM, llvm::ISD::SRL, llvm::FunctionLoweringInfo::StaticAllocaMap, llvm::ISD::SUB, TLI, llvm::ISD::TRUNCATE, llvm::ISD::UDIV, UpdateValueMap(), llvm::ISD::UREM, llvm::ISD::XOR, llvm::APIntOps::Xor(), and llvm::ISD::ZERO_EXTEND.
Referenced by SelectInstruction().
|
inline |
Update the position of the last instruction emitted for materializing constants for use in the current block.
Definition at line 80 of file FastISel.h.
References EmitStartPt, I, and LastLocalValue.
void FastISel::startNewBlock | ( | ) |
Set the current block to which generated machine instructions will be appended, and clear the local CSE map.
startNewBlock - Set the current block to which generated machine instructions will be appended, and clear the local CSE map.
Definition at line 76 of file FastISel.cpp.
References llvm::MachineBasicBlock::back(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::clear(), EmitStartPt, llvm::MachineBasicBlock::empty(), FuncInfo, LastLocalValue, LocalValueMap, and llvm::FunctionLoweringInfo::MBB.
|
inlineprotectedvirtual |
Emit an alloca address in a register using target-specific logic.
Definition at line 353 of file FastISel.h.
|
inlineprotectedvirtual |
Emit a constant in a register using target-specific logic, such as constant pool loads.
Definition at line 348 of file FastISel.h.
|
inlineprotectedvirtual |
Definition at line 357 of file FastISel.h.
|
protectedpure virtual |
This method is called by target-independent code when the normal FastISel process fails to select an instruction. This gives targets a chance to emit code for anything that doesn't fit into FastISel's framework. It returns true if it was successful.
Referenced by SelectInstruction().
bool FastISel::tryToFoldLoad | ( | const LoadInst * | LI, |
const Instruction * | FoldInst | ||
) |
We're checking to see if we can fold LI
into FoldInst
. Note that we could have a sequence where multiple LLVM IR instructions are folded into the same machineinstr. For example we could have:
A: x = load i32 *P B: y = icmp A, 42 C: br y, ...
In this scenario, LI
is "A", and FoldInst
is "C". We know about "B" (and any other folded instructions) because it is between A and C.
If we succeed folding, return true.
Definition at line 1518 of file FastISel.cpp.
References FuncInfo, llvm::MachineRegisterInfo::defusechain_iterator< Uses, Defs, SkipDebug >::getOperandNo(), llvm::Instruction::getParent(), llvm::MachineInstr::getParent(), getRegForValue(), llvm::Value::hasOneUse(), llvm::MachineRegisterInfo::hasOneUse(), llvm::FunctionLoweringInfo::InsertPt, llvm::LoadInst::isVolatile(), LI, llvm::FunctionLoweringInfo::MBB, MRI, llvm::MachineRegisterInfo::reg_begin(), tryToFoldLoadIntoMI(), and llvm::Instruction::use_back().
|
inlinevirtual |
The specified machine instr operand is a vreg, and that vreg is being provided by the specified load instruction. If possible, try to fold the load as an operand to the instruction, returning true if possible.
This method should be implemented by targets.
Definition at line 138 of file FastISel.h.
Referenced by tryToFoldLoad().
UpdateValueMap - Update the value map to include the new mapping for this instruction, or insert an extra copy to get the result in a previous determined register. NOTE: This is only necessary because we might select a block that uses a value before we select the block that defines the value. It might be possible to fix this by selecting blocks in reverse postorder.
Definition at line 267 of file FastISel.cpp.
References FuncInfo, I, LocalValueMap, llvm::FunctionLoweringInfo::RegFixups, and llvm::FunctionLoweringInfo::ValueMap.
Referenced by SelectOperator().
|
protected |
Definition at line 54 of file FastISel.h.
Referenced by enterLocalValueArea(), FastEmitInst_(), FastEmitInst_extractsubreg(), FastEmitInst_i(), FastEmitInst_ii(), FastEmitInst_r(), FastEmitInst_rf(), FastEmitInst_ri(), FastEmitInst_rii(), FastEmitInst_rr(), FastEmitInst_rri(), FastEmitInst_rrii(), FastEmitInst_rrr(), getCurDebugLoc(), leaveLocalValueArea(), and SelectInstruction().
|
protected |
The top most instruction in the current block that is allowed for emitting local variables. LastLocalValue resets to EmitStartPt when it makes sense (for example, on function calls)
Definition at line 71 of file FastISel.h.
Referenced by setLastLocalValue(), and startNewBlock().
|
protected |
Definition at line 50 of file FastISel.h.
Referenced by canFoldAddIntoGEP(), enterLocalValueArea(), FastEmit_ri_(), FastEmitBranch(), FastEmitInst_(), FastEmitInst_extractsubreg(), FastEmitInst_i(), FastEmitInst_ii(), FastEmitInst_r(), FastEmitInst_rf(), FastEmitInst_ri(), FastEmitInst_rii(), FastEmitInst_rr(), FastEmitInst_rri(), FastEmitInst_rrii(), FastEmitInst_rrr(), getRegForValue(), leaveLocalValueArea(), lookUpRegForValue(), LowerArguments(), recomputeInsertPt(), SelectInstruction(), SelectOperator(), startNewBlock(), tryToFoldLoad(), and UpdateValueMap().
|
protected |
The position of the last instruction for materializing constants for use in the current block. It resets to EmitStartPt when it makes sense (for example, it's usually profitable to avoid function calls between the definition and the use)
Definition at line 66 of file FastISel.h.
Referenced by getLastLocalValue(), leaveLocalValueArea(), setLastLocalValue(), and startNewBlock().
|
protected |
Definition at line 60 of file FastISel.h.
Referenced by SelectInstruction().
Definition at line 49 of file FastISel.h.
Referenced by lookUpRegForValue(), LowerArguments(), startNewBlock(), and UpdateValueMap().
|
protected |
Definition at line 53 of file FastISel.h.
|
protected |
Definition at line 52 of file FastISel.h.
|
protected |
Definition at line 51 of file FastISel.h.
Referenced by createResultReg(), FastEmitInst_extractsubreg(), and tryToFoldLoad().
|
protected |
Definition at line 56 of file FastISel.h.
Referenced by canFoldAddIntoGEP().
|
protected |
Definition at line 57 of file FastISel.h.
Referenced by FastEmitBranch(), FastEmitInst_(), FastEmitInst_extractsubreg(), FastEmitInst_i(), FastEmitInst_ii(), FastEmitInst_r(), FastEmitInst_rf(), FastEmitInst_ri(), FastEmitInst_rii(), FastEmitInst_rr(), FastEmitInst_rri(), FastEmitInst_rrii(), and FastEmitInst_rrr().
|
protected |
Definition at line 58 of file FastISel.h.
Referenced by FastEmitInst_extractsubreg(), getRegForGEPIndex(), getRegForValue(), and SelectOperator().
|
protected |
Definition at line 55 of file FastISel.h.
|
protected |
Definition at line 59 of file FastISel.h.
Referenced by FastEmitInst_extractsubreg().