LLVM API Documentation
#include <FastISel.h>
Definition at line 43 of file FastISel.h.
| FastISel::~FastISel | ( | ) | [virtual] |
Definition at line 722 of file FastISel.cpp.
| FastISel::FastISel | ( | MachineFunction & | mf, | |
| MachineModuleInfo * | mmi, | |||
| DwarfWriter * | dw, | |||
| DenseMap< const Value *, unsigned > & | vm, | |||
| DenseMap< const BasicBlock *, MachineBasicBlock * > & | bm, | |||
| DenseMap< const AllocaInst *, int > & | am, | |||
| SmallSet< Instruction *, 8 > & | cil | |||
| ) | [protected] |
Definition at line 693 of file FastISel.cpp.
| void llvm::FastISel::startNewBlock | ( | MachineBasicBlock * | mbb | ) | [inline] |
startNewBlock - Set the current block to which generated machine instructions will be appended, and clear the local CSE map.
Definition at line 69 of file FastISel.h.
References LocalValueMap, and setCurrentBlock().
| void llvm::FastISel::setCurrentBlock | ( | MachineBasicBlock * | mbb | ) | [inline] |
setCurrentBlock - Set the current block to which generated machine instructions will be appended.
Definition at line 77 of file FastISel.h.
References MBB.
Referenced by startNewBlock().
| void llvm::FastISel::setCurDebugLoc | ( | DebugLoc | dl | ) | [inline] |
setCurDebugLoc - Set the current debug location information, which is used when creating a machine instruction.
Definition at line 84 of file FastISel.h.
References DL.
| bool FastISel::SelectInstruction | ( | Instruction * | I | ) |
SelectInstruction - 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 561 of file FastISel.cpp.
References llvm::Instruction::getOpcode(), and SelectOperator().
SelectInstruction - 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 583 of file FastISel.cpp.
References llvm::ISD::ADD, Add(), llvm::ISD::AND, And(), BitCast, llvm::MVT::bitsGT(), llvm::MVT::bitsLT(), Call, llvm::ISD::FADD, FastEmitBranch(), llvm::ISD::FDIV, llvm::ISD::FMUL, llvm::ISD::FP_TO_SINT, llvm::ISD::FREM, llvm::ISD::FSUB, llvm::User::getOperand(), getRegForValue(), llvm::BranchInst::getSuccessor(), llvm::Value::getType(), llvm::TargetLowering::getValueType(), llvm::Type::isFPOrFPVector(), llvm::BranchInst::isUnconditional(), LShr, MBBMap, llvm::ISD::MUL, llvm::ISD::OR, llvm::APIntOps::Or(), PHI, PtrToInt, llvm::ISD::SDIV, llvm::Attribute::SExt, llvm::ISD::SHL, llvm::ISD::SIGN_EXTEND, llvm::ISD::SINT_TO_FP, llvm::ISD::SRA, llvm::ISD::SREM, llvm::ISD::SRL, StaticAllocaMap, llvm::ISD::SUB, TLI, llvm::ISD::TRUNCATE, llvm::ISD::UDIV, UpdateValueMap(), llvm::ISD::UREM, llvm::ISD::XOR, llvm::APIntOps::Xor(), llvm::ISD::ZERO_EXTEND, and ZExt.
Referenced by getRegForValue(), and SelectInstruction().
| virtual bool llvm::FastISel::TargetSelectInstruction | ( | Instruction * | I | ) | [pure virtual] |
TargetSelectInstruction - 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.
Implemented in X86FastISel.
getRegForValue - Create a virtual register and arrange for it to be assigned the value for the given LLVM value.
Definition at line 59 of file FastISel.cpp.
References llvm::BuildMI(), llvm::ISD::Constant, llvm::ISD::ConstantFP, llvm::APFloat::convertToInteger(), createResultReg(), DL, FastEmit_f(), FastEmit_i(), FastEmit_r(), llvm::TargetInstrInfo::get(), llvm::ConstantInt::get(), llvm::TargetData::getIntPtrType(), llvm::Constant::getNullValue(), llvm::TargetLowering::getPointerTy(), llvm::TargetLowering::getRegClassFor(), llvm::MVT::getSimpleVT(), llvm::MVT::getSizeInBits(), llvm::Value::getType(), llvm::TargetLowering::getTypeToTransformTo(), llvm::TargetLowering::getValueType(), llvm::MVT::i1, llvm::TargetInstrInfo::IMPLICIT_DEF, llvm::TargetLowering::isTypeLegal(), LocalValueMap, MBB, Reg, llvm::APFloat::rmTowardZero, SelectOperator(), llvm::ISD::SINT_TO_FP, TargetMaterializeAlloca(), TargetMaterializeConstant(), TD, TII, TLI, and VT.
Referenced by getRegForGEPIndex(), and SelectOperator().
lookUpRegForValue - 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 132 of file FastISel.cpp.
References LocalValueMap.
getRegForGEPIndex - This is a wrapper around getRegForValue that also takes care of truncating or sign-extending the given getelementptr index value.
Definition at line 160 of file FastISel.cpp.
References llvm::MVT::bitsGT(), llvm::MVT::bitsLT(), FastEmit_r(), llvm::MVT::getMVT(), llvm::TargetLowering::getPointerTy(), getRegForValue(), llvm::MVT::getSimpleVT(), llvm::Value::getType(), llvm::ISD::SIGN_EXTEND, TLI, and llvm::ISD::TRUNCATE.
| unsigned FastISel::FastEmit_ | ( | MVT::SimpleValueType | VT, | |
| MVT::SimpleValueType | RetVT, | |||
| ISD::NodeType | Opcode | |||
| ) | [protected, virtual] |
FastEmit_r - This method is called by target-independent code to request that an instruction with the given type and opcode be emitted.
Definition at line 724 of file FastISel.cpp.
| unsigned FastISel::FastEmit_r | ( | MVT::SimpleValueType | VT, | |
| MVT::SimpleValueType | RetVT, | |||
| ISD::NodeType | Opcode, | |||
| unsigned | Op0 | |||
| ) | [protected, virtual] |
FastEmit_r - 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 729 of file FastISel.cpp.
Referenced by FastEmit_rf_(), getRegForGEPIndex(), and getRegForValue().
| unsigned FastISel::FastEmit_rr | ( | MVT::SimpleValueType | VT, | |
| MVT::SimpleValueType | RetVT, | |||
| ISD::NodeType | Opcode, | |||
| unsigned | Op0, | |||
| unsigned | Op1 | |||
| ) | [protected, virtual] |
FastEmit_rr - 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 734 of file FastISel.cpp.
Referenced by FastEmit_rf_(), and FastEmit_ri_().
| unsigned FastISel::FastEmit_ri | ( | MVT::SimpleValueType | VT, | |
| MVT::SimpleValueType | RetVT, | |||
| ISD::NodeType | Opcode, | |||
| unsigned | Op0, | |||
| uint64_t | Imm | |||
| ) | [protected, virtual] |
FastEmit_ri - 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 750 of file FastISel.cpp.
Referenced by FastEmit_ri_().
| unsigned FastISel::FastEmit_rf | ( | MVT::SimpleValueType | VT, | |
| MVT::SimpleValueType | RetVT, | |||
| ISD::NodeType | Opcode, | |||
| unsigned | Op0, | |||
| ConstantFP * | FPImm | |||
| ) | [protected, virtual] |
FastEmit_rf - 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 756 of file FastISel.cpp.
Referenced by FastEmit_rf_().
| unsigned FastISel::FastEmit_rri | ( | MVT::SimpleValueType | VT, | |
| MVT::SimpleValueType | RetVT, | |||
| ISD::NodeType | Opcode, | |||
| unsigned | Op0, | |||
| unsigned | Op1, | |||
| uint64_t | Imm | |||
| ) | [protected, virtual] |
FastEmit_rri - 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 762 of file FastISel.cpp.
| unsigned FastISel::FastEmit_ri_ | ( | MVT::SimpleValueType | VT, | |
| ISD::NodeType | Opcode, | |||
| unsigned | Op0, | |||
| uint64_t | Imm, | |||
| MVT::SimpleValueType | ImmType | |||
| ) | [protected] |
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.
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 773 of file FastISel.cpp.
References llvm::ISD::Constant, FastEmit_i(), FastEmit_ri(), and FastEmit_rr().
| unsigned FastISel::FastEmit_rf_ | ( | MVT::SimpleValueType | VT, | |
| ISD::NodeType | Opcode, | |||
| unsigned | Op0, | |||
| ConstantFP * | FPImm, | |||
| MVT::SimpleValueType | ImmType | |||
| ) | [protected] |
FastEmit_rf_ - This method is a wrapper of FastEmit_rf. It first tries to emit an instruction with an immediate operand using FastEmit_rf. If that fails, it materializes the immediate into a register and try FastEmit_rr instead.
FastEmit_rf_ - This method is a wrapper of FastEmit_ri. It first tries to emit an instruction with a floating-point immediate operand using FastEmit_rf. If that fails, it materializes the immediate into a register and try FastEmit_rr instead.
Definition at line 790 of file FastISel.cpp.
References llvm::ISD::Constant, llvm::ISD::ConstantFP, llvm::APFloat::convertToInteger(), FastEmit_f(), FastEmit_i(), FastEmit_r(), FastEmit_rf(), FastEmit_rr(), llvm::TargetLowering::getPointerTy(), llvm::MVT::getSimpleVT(), llvm::MVT::getSizeInBits(), llvm::ConstantFP::getValueAPF(), llvm::APInt::getZExtValue(), llvm::APFloat::rmTowardZero, llvm::ISD::SINT_TO_FP, and TLI.
| unsigned FastISel::FastEmit_i | ( | MVT::SimpleValueType | VT, | |
| MVT::SimpleValueType | RetVT, | |||
| ISD::NodeType | Opcode, | |||
| uint64_t | Imm | |||
| ) | [protected, virtual] |
FastEmit_i - 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 740 of file FastISel.cpp.
Referenced by FastEmit_rf_(), FastEmit_ri_(), and getRegForValue().
| unsigned FastISel::FastEmit_f | ( | MVT::SimpleValueType | VT, | |
| MVT::SimpleValueType | RetVT, | |||
| ISD::NodeType | Opcode, | |||
| ConstantFP * | FPImm | |||
| ) | [protected, virtual] |
FastEmit_f - 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 745 of file FastISel.cpp.
Referenced by FastEmit_rf_(), and getRegForValue().
| unsigned FastISel::FastEmitInst_ | ( | unsigned | MachineInstOpcode, | |
| const TargetRegisterClass * | RC | |||
| ) | [protected] |
FastEmitInst_ - Emit a MachineInstr with no operands and a result register in the given register class.
Definition at line 835 of file FastISel.cpp.
References llvm::BuildMI(), createResultReg(), DL, llvm::TargetInstrInfo::get(), MBB, and TII.
| unsigned FastISel::FastEmitInst_r | ( | unsigned | MachineInstOpcode, | |
| const TargetRegisterClass * | RC, | |||
| unsigned | Op0 | |||
| ) | [protected] |
FastEmitInst_r - Emit a MachineInstr with one register operand and a result register in the given register class.
Definition at line 844 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), llvm::TargetInstrInfo::copyRegToReg(), createResultReg(), DL, llvm::MachineBasicBlock::end(), llvm::TargetInstrInfo::get(), llvm::TargetInstrDesc::getNumDefs(), llvm::TargetInstrDesc::ImplicitDefs, MBB, and TII.
| unsigned FastISel::FastEmitInst_rr | ( | unsigned | MachineInstOpcode, | |
| const TargetRegisterClass * | RC, | |||
| unsigned | Op0, | |||
| unsigned | Op1 | |||
| ) | [protected] |
FastEmitInst_rr - Emit a MachineInstr with two register operands and a result register in the given register class.
Definition at line 863 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), llvm::TargetInstrInfo::copyRegToReg(), createResultReg(), DL, llvm::MachineBasicBlock::end(), llvm::TargetInstrInfo::get(), llvm::TargetInstrDesc::getNumDefs(), llvm::TargetInstrDesc::ImplicitDefs, MBB, and TII.
| unsigned FastISel::FastEmitInst_ri | ( | unsigned | MachineInstOpcode, | |
| const TargetRegisterClass * | RC, | |||
| unsigned | Op0, | |||
| uint64_t | Imm | |||
| ) | [protected] |
FastEmitInst_ri - Emit a MachineInstr with two register operands and a result register in the given register class.
Definition at line 881 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), llvm::TargetInstrInfo::copyRegToReg(), createResultReg(), DL, llvm::MachineBasicBlock::end(), llvm::TargetInstrInfo::get(), llvm::TargetInstrDesc::getNumDefs(), llvm::TargetInstrDesc::ImplicitDefs, MBB, and TII.
| unsigned FastISel::FastEmitInst_rf | ( | unsigned | MachineInstOpcode, | |
| const TargetRegisterClass * | RC, | |||
| unsigned | Op0, | |||
| ConstantFP * | FPImm | |||
| ) | [protected] |
FastEmitInst_rf - Emit a MachineInstr with two register operands and a result register in the given register class.
Definition at line 899 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addFPImm(), llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), llvm::TargetInstrInfo::copyRegToReg(), createResultReg(), DL, llvm::MachineBasicBlock::end(), llvm::TargetInstrInfo::get(), llvm::TargetInstrDesc::getNumDefs(), llvm::TargetInstrDesc::ImplicitDefs, MBB, and TII.
| unsigned FastISel::FastEmitInst_rri | ( | unsigned | MachineInstOpcode, | |
| const TargetRegisterClass * | RC, | |||
| unsigned | Op0, | |||
| unsigned | Op1, | |||
| uint64_t | Imm | |||
| ) | [protected] |
FastEmitInst_rri - Emit a MachineInstr with two register operands, an immediate, and a result register in the given register class.
Definition at line 917 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), llvm::TargetInstrInfo::copyRegToReg(), createResultReg(), DL, llvm::MachineBasicBlock::end(), llvm::TargetInstrInfo::get(), llvm::TargetInstrDesc::getNumDefs(), llvm::TargetInstrDesc::ImplicitDefs, MBB, and TII.
| unsigned FastISel::FastEmitInst_i | ( | unsigned | MachineInstrOpcode, | |
| const TargetRegisterClass * | RC, | |||
| uint64_t | Imm | |||
| ) | [protected] |
FastEmitInst_i - Emit a MachineInstr with a single immediate operand, and a result register in the given register class.
Definition at line 935 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::BuildMI(), llvm::TargetInstrInfo::copyRegToReg(), createResultReg(), DL, llvm::MachineBasicBlock::end(), llvm::TargetInstrInfo::get(), llvm::TargetInstrDesc::getNumDefs(), llvm::TargetInstrDesc::ImplicitDefs, MBB, and TII.
| unsigned FastISel::FastEmitInst_extractsubreg | ( | MVT::SimpleValueType | RetVT, | |
| unsigned | Op0, | |||
| uint32_t | Idx | |||
| ) | [protected] |
FastEmitInst_extractsubreg - Emit a MachineInstr for an extract_subreg from a specified index of a superregister to a specified type.
Definition at line 953 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), llvm::TargetInstrInfo::copyRegToReg(), createResultReg(), DL, llvm::MachineBasicBlock::end(), llvm::TargetInstrInfo::EXTRACT_SUBREG, llvm::TargetInstrInfo::get(), llvm::MachineRegisterInfo::getRegClass(), llvm::TargetLowering::getRegClassFor(), MBB, MRI, TII, and TLI.
| void FastISel::FastEmitBranch | ( | MachineBasicBlock * | MSucc | ) | [protected] |
FastEmitBranch - 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 569 of file FastISel.cpp.
References llvm::MachineBasicBlock::addSuccessor(), llvm::TargetInstrInfo::InsertBranch(), llvm::MachineBasicBlock::isLayoutSuccessor(), MBB, llvm::next(), and TII.
Referenced by SelectOperator().
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 148 of file FastISel.cpp.
References llvm::TargetInstrInfo::copyRegToReg(), llvm::MachineBasicBlock::end(), llvm::MachineRegisterInfo::getRegClass(), LocalValueMap, MBB, MRI, and TII.
Referenced by SelectOperator().
| unsigned FastISel::createResultReg | ( | const TargetRegisterClass * | RC | ) | [protected] |
Definition at line 831 of file FastISel.cpp.
References llvm::MachineRegisterInfo::createVirtualRegister(), and MRI.
Referenced by FastEmitInst_(), FastEmitInst_extractsubreg(), FastEmitInst_i(), FastEmitInst_r(), FastEmitInst_rf(), FastEmitInst_ri(), FastEmitInst_rr(), FastEmitInst_rri(), and getRegForValue().
| virtual unsigned llvm::FastISel::TargetMaterializeConstant | ( | Constant * | C | ) | [inline, protected, virtual] |
TargetMaterializeConstant - Emit a constant in a register using target-specific logic, such as constant pool loads.
Definition at line 283 of file FastISel.h.
Referenced by getRegForValue().
| virtual unsigned llvm::FastISel::TargetMaterializeAlloca | ( | AllocaInst * | C | ) | [inline, protected, virtual] |
TargetMaterializeAlloca - Emit an alloca address in a register using target-specific logic.
Definition at line 289 of file FastISel.h.
Referenced by getRegForValue().
MachineBasicBlock* llvm::FastISel::MBB [protected] |
Definition at line 45 of file FastISel.h.
Referenced by FastEmitBranch(), FastEmitInst_(), FastEmitInst_extractsubreg(), FastEmitInst_i(), FastEmitInst_r(), FastEmitInst_rf(), FastEmitInst_ri(), FastEmitInst_rr(), FastEmitInst_rri(), getRegForValue(), setCurrentBlock(), and UpdateValueMap().
DenseMap<const Value *, unsigned> llvm::FastISel::LocalValueMap [protected] |
Definition at line 46 of file FastISel.h.
Referenced by getRegForValue(), lookUpRegForValue(), startNewBlock(), and UpdateValueMap().
DenseMap<const Value *, unsigned>& llvm::FastISel::ValueMap [protected] |
Definition at line 47 of file FastISel.h.
DenseMap<const BasicBlock *, MachineBasicBlock *>& llvm::FastISel::MBBMap [protected] |
DenseMap<const AllocaInst *, int>& llvm::FastISel::StaticAllocaMap [protected] |
SmallSet<Instruction*, 8>& llvm::FastISel::CatchInfoLost [protected] |
Definition at line 51 of file FastISel.h.
MachineFunction& llvm::FastISel::MF [protected] |
Definition at line 53 of file FastISel.h.
MachineModuleInfo* llvm::FastISel::MMI [protected] |
Definition at line 54 of file FastISel.h.
DwarfWriter* llvm::FastISel::DW [protected] |
Definition at line 55 of file FastISel.h.
MachineRegisterInfo& llvm::FastISel::MRI [protected] |
Definition at line 56 of file FastISel.h.
Referenced by createResultReg(), FastEmitInst_extractsubreg(), and UpdateValueMap().
MachineFrameInfo& llvm::FastISel::MFI [protected] |
Definition at line 57 of file FastISel.h.
MachineConstantPool& llvm::FastISel::MCP [protected] |
Definition at line 58 of file FastISel.h.
DebugLoc llvm::FastISel::DL [protected] |
Definition at line 59 of file FastISel.h.
Referenced by FastEmitInst_(), FastEmitInst_extractsubreg(), FastEmitInst_i(), FastEmitInst_r(), FastEmitInst_rf(), FastEmitInst_ri(), FastEmitInst_rr(), FastEmitInst_rri(), getRegForValue(), and setCurDebugLoc().
const TargetMachine& llvm::FastISel::TM [protected] |
const TargetData& llvm::FastISel::TD [protected] |
const TargetInstrInfo& llvm::FastISel::TII [protected] |
Definition at line 62 of file FastISel.h.
Referenced by FastEmitBranch(), FastEmitInst_(), FastEmitInst_extractsubreg(), FastEmitInst_i(), FastEmitInst_r(), FastEmitInst_rf(), FastEmitInst_ri(), FastEmitInst_rr(), FastEmitInst_rri(), getRegForValue(), and UpdateValueMap().
const TargetLowering& llvm::FastISel::TLI [protected] |
Definition at line 63 of file FastISel.h.
Referenced by FastEmit_rf_(), FastEmitInst_extractsubreg(), getRegForGEPIndex(), getRegForValue(), and SelectOperator().