|
LLVM
3.7.0
|
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. More...
#include <FastISel.h>
Classes | |
| struct | ArgListEntry |
| struct | CallLoweringInfo |
| struct | SavePoint |
Public Types | |
| typedef std::vector< ArgListEntry > | ArgListTy |
Public Member Functions | |
| MachineInstr * | getLastLocalValue () |
| Return the position of the last instruction emitted for materializing constants for use in the current block. More... | |
| void | setLastLocalValue (MachineInstr *I) |
| Update the position of the last instruction emitted for materializing constants for use in the current block. More... | |
| void | startNewBlock () |
| Set the current block to which generated machine instructions will be appended, and clear the local CSE map. More... | |
| DebugLoc | getCurDebugLoc () const |
| Return current debug location information. More... | |
| bool | lowerArguments () |
| Do "fast" instruction selection for function arguments and append the machine instructions to the current block. More... | |
| bool | selectInstruction (const Instruction *I) |
| Do "fast" instruction selection for the given LLVM IR instruction and append the generated machine instructions to the current block. More... | |
| bool | selectOperator (const User *I, unsigned Opcode) |
| Do "fast" instruction selection for the given LLVM IR operator (Instruction or ConstantExpr), and append generated machine instructions to the current block. More... | |
| unsigned | getRegForValue (const Value *V) |
| Create a virtual register and arrange for it to be assigned the value for the given LLVM value. More... | |
| unsigned | lookUpRegForValue (const Value *V) |
| Look up the value to see if its value is already cached in a register. More... | |
| std::pair< unsigned, bool > | getRegForGEPIndex (const Value *V) |
| This is a wrapper around getRegForValue that also takes care of truncating or sign-extending the given getelementptr index value. More... | |
| bool | tryToFoldLoad (const LoadInst *LI, const Instruction *FoldInst) |
We're checking to see if we can fold LI into FoldInst. 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. More... | |
| void | recomputeInsertPt () |
| Reset InsertPt to prepare for inserting instructions into the current block. More... | |
| void | removeDeadCode (MachineBasicBlock::iterator I, MachineBasicBlock::iterator E) |
| Remove all dead instructions between the I and E. More... | |
| SavePoint | enterLocalValueArea () |
| Prepare InsertPt to begin inserting instructions into the local value area and return the old insert position. More... | |
| void | leaveLocalValueArea (SavePoint Old) |
| Reset InsertPt to the given old insert position. More... | |
| virtual | ~FastISel () |
Protected Member Functions | |
| FastISel (FunctionLoweringInfo &FuncInfo, const TargetLibraryInfo *LibInfo, bool SkipTargetIndependentISel=false) | |
| virtual bool | fastSelectInstruction (const Instruction *I)=0 |
| This method is called by target-independent code when the normal FastISel process fails to select an instruction. More... | |
| virtual bool | fastLowerArguments () |
| This method is called by target-independent code to do target- specific argument lowering. More... | |
| virtual bool | fastLowerCall (CallLoweringInfo &CLI) |
| This method is called by target-independent code to do target- specific call lowering. More... | |
| virtual bool | fastLowerIntrinsicCall (const IntrinsicInst *II) |
| This method is called by target-independent code to do target- specific intrinsic lowering. More... | |
| virtual unsigned | fastEmit_ (MVT VT, MVT RetVT, unsigned Opcode) |
| This method is called by target-independent code to request that an instruction with the given type and opcode be emitted. More... | |
| virtual unsigned | fastEmit_r (MVT VT, MVT RetVT, unsigned Opcode, unsigned Op0, bool Op0IsKill) |
| This method is called by target-independent code to request that an instruction with the given type, opcode, and register operand be emitted. More... | |
| virtual unsigned | fastEmit_rr (MVT VT, MVT RetVT, unsigned Opcode, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) |
| This method is called by target-independent code to request that an instruction with the given type, opcode, and register operands be emitted. More... | |
| virtual unsigned | fastEmit_ri (MVT VT, MVT RetVT, unsigned Opcode, unsigned Op0, bool Op0IsKill, uint64_t Imm) |
| This method is called by target-independent code to request that an instruction with the given type, opcode, and register and immediate. More... | |
| virtual unsigned | fastEmit_rf (MVT VT, MVT RetVT, unsigned Opcode, unsigned Op0, bool Op0IsKill, const ConstantFP *FPImm) |
| 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. More... | |
| virtual unsigned | fastEmit_rri (MVT VT, MVT RetVT, unsigned Opcode, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill, uint64_t Imm) |
| 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. More... | |
| 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) |
| This method is called by target-independent code to request that an instruction with the given type, opcode, and immediate operand be emitted. More... | |
| virtual unsigned | fastEmit_f (MVT VT, MVT RetVT, unsigned Opcode, const ConstantFP *FPImm) |
| 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. More... | |
| unsigned | fastEmitInst_ (unsigned MachineInstOpcode, const TargetRegisterClass *RC) |
| Emit a MachineInstr with no operands and a result register in the given register class. More... | |
| unsigned | fastEmitInst_r (unsigned MachineInstOpcode, const TargetRegisterClass *RC, unsigned Op0, bool Op0IsKill) |
| Emit a MachineInstr with one register operand and a result register in the given register class. More... | |
| unsigned | fastEmitInst_rr (unsigned MachineInstOpcode, const TargetRegisterClass *RC, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) |
| Emit a MachineInstr with two register operands and a result register in the given register class. More... | |
| unsigned | fastEmitInst_rrr (unsigned MachineInstOpcode, const TargetRegisterClass *RC, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill, unsigned Op2, bool Op2IsKill) |
| Emit a MachineInstr with three register operands and a result register in the given register class. More... | |
| unsigned | fastEmitInst_ri (unsigned MachineInstOpcode, const TargetRegisterClass *RC, unsigned Op0, bool Op0IsKill, uint64_t Imm) |
| Emit a MachineInstr with a register operand, an immediate, and a result register in the given register class. More... | |
| 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) |
| Emit a MachineInstr with two register operands and a result register in the given register class. More... | |
| unsigned | fastEmitInst_rri (unsigned MachineInstOpcode, const TargetRegisterClass *RC, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill, uint64_t Imm) |
| Emit a MachineInstr with two register operands, an immediate, and a result register in the given register class. More... | |
| unsigned | fastEmitInst_rrii (unsigned MachineInstOpcode, const TargetRegisterClass *RC, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill, uint64_t Imm1, uint64_t Imm2) |
| Emit a MachineInstr with two register operands, two immediates operands, and a result register in the given register class. More... | |
| unsigned | fastEmitInst_i (unsigned MachineInstrOpcode, const TargetRegisterClass *RC, uint64_t Imm) |
| Emit a MachineInstr with a single immediate operand, and a result register in the given register class. More... | |
| 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) |
| Emit a MachineInstr for an extract_subreg from a specified index of a superregister to a specified type. More... | |
| unsigned | fastEmitZExtFromI1 (MVT VT, unsigned Op0, bool Op0IsKill) |
| Emit MachineInstrs to compute the value of Op with all but the least significant bit set to zero. More... | |
| void | fastEmitBranch (MachineBasicBlock *MBB, DebugLoc DL) |
| Emit an unconditional branch to the given block, unless it is the immediate (fall-through) successor, and update the CFG. More... | |
| void | updateValueMap (const Value *I, unsigned Reg, unsigned NumRegs=1) |
| 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. More... | |
| unsigned | createResultReg (const TargetRegisterClass *RC) |
| unsigned | constrainOperandRegClass (const MCInstrDesc &II, unsigned Op, unsigned OpNum) |
| Try to constrain Op so that it is usable by argument OpNum of the provided MCInstrDesc. More... | |
| virtual unsigned | fastMaterializeConstant (const Constant *C) |
| Emit a constant in a register using target-specific logic, such as constant pool loads. More... | |
| virtual unsigned | fastMaterializeAlloca (const AllocaInst *C) |
| Emit an alloca address in a register using target-specific logic. More... | |
| virtual unsigned | fastMaterializeFloatZero (const ConstantFP *CF) |
| Emit the floating-point constant +0.0 in a register using target- specific logic. More... | |
| bool | canFoldAddIntoGEP (const User *GEP, const Value *Add) |
Check if Add is an add that can be safely folded into GEP. More... | |
| bool | hasTrivialKill (const Value *V) |
| Test whether the given value has exactly one use. More... | |
| MachineMemOperand * | createMachineMemOperandFor (const Instruction *I) const |
| Create a machine mem operand from the given instruction. More... | |
| CmpInst::Predicate | optimizeCmpPredicate (const CmpInst *CI) const |
| bool | lowerCallTo (const CallInst *CI, MCSymbol *Symbol, unsigned NumArgs) |
| bool | lowerCallTo (const CallInst *CI, const char *SymbolName, unsigned NumArgs) |
| bool | lowerCallTo (CallLoweringInfo &CLI) |
| bool | isCommutativeIntrinsic (IntrinsicInst const *II) |
| bool | lowerCall (const CallInst *I) |
| bool | selectBinaryOp (const User *I, unsigned ISDOpcode) |
| Select and emit code for a binary operator instruction, which has an opcode which directly corresponds to the given ISD opcode. More... | |
| bool | selectFNeg (const User *I) |
| Emit an FNeg operation. More... | |
| bool | selectGetElementPtr (const User *I) |
| bool | selectStackmap (const CallInst *I) |
| bool | selectPatchpoint (const CallInst *I) |
| bool | selectCall (const User *Call) |
| bool | selectIntrinsicCall (const IntrinsicInst *II) |
| bool | selectBitCast (const User *I) |
| bool | selectCast (const User *I, unsigned Opcode) |
| bool | selectExtractValue (const User *I) |
| bool | selectInsertValue (const User *I) |
Protected Attributes | |
| DenseMap< const Value *, unsigned > | LocalValueMap |
| FunctionLoweringInfo & | FuncInfo |
| MachineFunction * | MF |
| MachineRegisterInfo & | MRI |
| MachineFrameInfo & | MFI |
| MachineConstantPool & | MCP |
| DebugLoc | DbgLoc |
| const TargetMachine & | TM |
| const DataLayout & | DL |
| const TargetInstrInfo & | TII |
| const TargetLowering & | TLI |
| const TargetRegisterInfo & | TRI |
| const TargetLibraryInfo * | LibInfo |
| bool | SkipTargetIndependentISel |
| MachineInstr * | LastLocalValue |
| The position of the last instruction for materializing constants for use in the current block. More... | |
| MachineInstr * | EmitStartPt |
| The top most instruction in the current block that is allowed for emitting local variables. More... | |
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 30 of file FastISel.h.
| typedef std::vector<ArgListEntry> llvm::FastISel::ArgListTy |
Definition at line 54 of file FastISel.h.
|
virtual |
Definition at line 1621 of file FastISel.cpp.
|
explicitprotected |
Definition at line 1610 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 2126 of file FastISel.cpp.
References DL, FuncInfo, getParent(), llvm::Value::getType(), llvm::DataLayout::getTypeSizeInBits(), llvm::FunctionLoweringInfo::MBB, and llvm::FunctionLoweringInfo::MBBMap.
|
protected |
Try to constrain Op so that it is usable by argument OpNum of the provided MCInstrDesc.
If this fails, create a new virtual register in the correct class and COPY the value there.
Definition at line 1721 of file FastISel.cpp.
References llvm::BuildMI(), llvm::MachineRegisterInfo::constrainRegClass(), llvm::TargetOpcode::COPY, createResultReg(), DbgLoc, FuncInfo, llvm::MCInstrInfo::get(), llvm::TargetInstrInfo::getRegClass(), llvm::FunctionLoweringInfo::InsertPt, llvm::TargetRegisterInfo::isVirtualRegister(), llvm::FunctionLoweringInfo::MBB, llvm::FunctionLoweringInfo::MF, MRI, TII, and TRI.
Referenced by fastEmitInst_r(), fastEmitInst_rf(), fastEmitInst_ri(), fastEmitInst_rii(), fastEmitInst_rr(), fastEmitInst_rri(), fastEmitInst_rrii(), and fastEmitInst_rrr().
|
protected |
Create a machine mem operand from the given instruction.
Definition at line 2143 of file FastISel.cpp.
References DL, FuncInfo, llvm::Instruction::getAAMetadata(), llvm::DataLayout::getABITypeAlignment(), llvm::MachineFunction::getMachineMemOperand(), llvm::Instruction::getMetadata(), llvm::DataLayout::getTypeStoreSize(), llvm::LLVMContext::MD_invariant_load, llvm::LLVMContext::MD_nontemporal, llvm::LLVMContext::MD_range, llvm::FunctionLoweringInfo::MF, llvm::MachineMemOperand::MOInvariant, llvm::MachineMemOperand::MOLoad, llvm::MachineMemOperand::MONonTemporal, llvm::MachineMemOperand::MOStore, llvm::MachineMemOperand::MOVolatile, Ranges, and llvm::SI.
|
protected |
Definition at line 1717 of file FastISel.cpp.
References llvm::MachineRegisterInfo::createVirtualRegister(), and MRI.
Referenced by constrainOperandRegClass(), fastEmitInst_(), fastEmitInst_extractsubreg(), fastEmitInst_i(), fastEmitInst_ii(), fastEmitInst_r(), fastEmitInst_rf(), fastEmitInst_ri(), fastEmitInst_rii(), fastEmitInst_rr(), fastEmitInst_rri(), fastEmitInst_rrii(), fastEmitInst_rrr(), selectBitCast(), and selectPatchpoint().
| FastISel::SavePoint FastISel::enterLocalValueArea | ( | ) |
Prepare InsertPt to begin inserting instructions into the local value area and return the old insert position.
Definition at line 364 of file FastISel.cpp.
References DbgLoc, FuncInfo, llvm::FunctionLoweringInfo::InsertPt, recomputeInsertPt(), and llvm::SP.
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 1631 of file FastISel.cpp.
Referenced by selectOperator().
|
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 1648 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 1644 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 1633 of file FastISel.cpp.
Referenced by getRegForGEPIndex(), selectBitCast(), selectCast(), and selectFNeg().
|
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 1658 of file FastISel.cpp.
Referenced by selectBinaryOp().
|
protectedvirtual |
This method is called by target-independent code to request that an instruction with the given type, opcode, and register and immediate.
Definition at line 1653 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.
Definition at line 1674 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.
Referenced by selectBinaryOp(), selectFNeg(), and selectGetElementPtr().
|
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 1638 of file FastISel.cpp.
Referenced by fastEmit_ri_(), selectBinaryOp(), and selectGetElementPtr().
|
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 1664 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.
Definition at line 1390 of file FastISel.cpp.
References llvm::MachineBasicBlock::addSuccessor(), llvm::FunctionLoweringInfo::BPI, FuncInfo, llvm::MachineBasicBlock::getBasicBlock(), llvm::BranchProbabilityInfo::getEdgeWeight(), 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 1738 of file FastISel.cpp.
References llvm::BuildMI(), createResultReg(), DbgLoc, 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 1979 of file FastISel.cpp.
References llvm::BuildMI(), llvm::MachineRegisterInfo::constrainRegClass(), llvm::TargetOpcode::COPY, createResultReg(), DbgLoc, 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 1944 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::BuildMI(), llvm::TargetOpcode::COPY, createResultReg(), DbgLoc, 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 1960 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::BuildMI(), llvm::TargetOpcode::COPY, createResultReg(), DbgLoc, 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 1747 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), constrainOperandRegClass(), llvm::TargetOpcode::COPY, createResultReg(), DbgLoc, FuncInfo, llvm::MCInstrInfo::get(), llvm::getKillRegState(), llvm::MCInstrDesc::getNumDefs(), llvm::MCInstrDesc::ImplicitDefs, llvm::FunctionLoweringInfo::InsertPt, 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 1867 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addFPImm(), llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), constrainOperandRegClass(), llvm::TargetOpcode::COPY, createResultReg(), DbgLoc, FuncInfo, llvm::MCInstrInfo::get(), llvm::getKillRegState(), llvm::MCInstrDesc::getNumDefs(), llvm::MCInstrDesc::ImplicitDefs, llvm::FunctionLoweringInfo::InsertPt, 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 1820 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), constrainOperandRegClass(), llvm::TargetOpcode::COPY, createResultReg(), DbgLoc, FuncInfo, llvm::MCInstrInfo::get(), llvm::getKillRegState(), llvm::MCInstrDesc::getNumDefs(), llvm::MCInstrDesc::ImplicitDefs, llvm::FunctionLoweringInfo::InsertPt, llvm::FunctionLoweringInfo::MBB, and TII.
|
protected |
Emit a MachineInstr with one register operand and two immediate operands.
Definition at line 1842 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), constrainOperandRegClass(), llvm::TargetOpcode::COPY, createResultReg(), DbgLoc, FuncInfo, llvm::MCInstrInfo::get(), llvm::getKillRegState(), llvm::MCInstrDesc::getNumDefs(), llvm::MCInstrDesc::ImplicitDefs, llvm::FunctionLoweringInfo::InsertPt, 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 1768 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), constrainOperandRegClass(), llvm::TargetOpcode::COPY, createResultReg(), DbgLoc, FuncInfo, llvm::MCInstrInfo::get(), llvm::getKillRegState(), llvm::MCInstrDesc::getNumDefs(), llvm::MCInstrDesc::ImplicitDefs, llvm::FunctionLoweringInfo::InsertPt, 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 1889 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), constrainOperandRegClass(), llvm::TargetOpcode::COPY, createResultReg(), DbgLoc, FuncInfo, llvm::MCInstrInfo::get(), llvm::getKillRegState(), llvm::MCInstrDesc::getNumDefs(), llvm::MCInstrDesc::ImplicitDefs, llvm::FunctionLoweringInfo::InsertPt, 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 1915 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), constrainOperandRegClass(), llvm::TargetOpcode::COPY, createResultReg(), DbgLoc, FuncInfo, llvm::MCInstrInfo::get(), llvm::getKillRegState(), llvm::MCInstrDesc::getNumDefs(), llvm::MCInstrDesc::ImplicitDefs, llvm::FunctionLoweringInfo::InsertPt, 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 1792 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), constrainOperandRegClass(), llvm::TargetOpcode::COPY, createResultReg(), DbgLoc, FuncInfo, llvm::MCInstrInfo::get(), llvm::getKillRegState(), llvm::MCInstrDesc::getNumDefs(), llvm::MCInstrDesc::ImplicitDefs, llvm::FunctionLoweringInfo::InsertPt, llvm::FunctionLoweringInfo::MBB, and TII.
Emit MachineInstrs to compute the value of Op with all but the least significant bit set to zero.
Definition at line 1993 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 1623 of file FastISel.cpp.
Referenced by lowerArguments().
|
protectedvirtual |
This method is called by target-independent code to do target- specific call lowering.
It returns true if it was successful.
Definition at line 1625 of file FastISel.cpp.
Referenced by lowerCallTo().
|
protectedvirtual |
This method is called by target-independent code to do target- specific intrinsic lowering.
It returns true if it was successful.
Definition at line 1627 of file FastISel.cpp.
Referenced by selectIntrinsicCall().
|
inlineprotectedvirtual |
Emit an alloca address in a register using target-specific logic.
Definition at line 487 of file FastISel.h.
|
inlineprotectedvirtual |
Emit a constant in a register using target-specific logic, such as constant pool loads.
Definition at line 484 of file FastISel.h.
|
inlineprotectedvirtual |
Emit the floating-point constant +0.0 in a register using target- specific logic.
Definition at line 491 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().
|
inline |
Return current debug location information.
Definition at line 235 of file FastISel.h.
References DbgLoc.
|
inline |
Return the position of the last instruction emitted for materializing constants for use in the current block.
Definition at line 221 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 315 of file FastISel.cpp.
References llvm::EVT::bitsGT(), llvm::EVT::bitsLT(), DL, fastEmit_r(), llvm::EVT::getEVT(), llvm::TargetLoweringBase::getPointerTy(), getRegForValue(), llvm::EVT::getSimpleVT(), llvm::Value::getType(), hasTrivialKill(), llvm::ISD::SIGN_EXTEND, TLI, and llvm::ISD::TRUNCATE.
Referenced by selectGetElementPtr().
Create a virtual register and arrange for it to be assigned the value for the given LLVM value.
Definition at line 168 of file FastISel.cpp.
References DL, 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(), selectBinaryOp(), selectBitCast(), selectCast(), selectFNeg(), selectGetElementPtr(), selectIntrinsicCall(), selectOperator(), selectPatchpoint(), and tryToFoldLoad().
Test whether the given value has exactly one use.
Definition at line 135 of file FastISel.cpp.
References DL, llvm::dyn_cast(), GEP, llvm::DataLayout::getIntPtrType(), llvm::Instruction::getOpcode(), llvm::Instruction::getParent(), getParent(), llvm::Value::hasOneUse(), I, lookUpRegForValue(), MRI, llvm::MachineRegisterInfo::use_empty(), and llvm::Value::user_begin().
Referenced by getRegForGEPIndex(), selectBinaryOp(), selectBitCast(), selectCast(), selectFNeg(), and selectGetElementPtr().
|
inlineprotected |
Definition at line 517 of file FastISel.h.
References llvm::IntrinsicInst::getIntrinsicID().
| void FastISel::leaveLocalValueArea | ( | SavePoint | Old | ) |
Reset InsertPt to the given old insert position.
Definition at line 373 of file FastISel.cpp.
References llvm::MachineBasicBlock::begin(), DbgLoc, llvm::FastISel::SavePoint::DL, FuncInfo, llvm::FunctionLoweringInfo::InsertPt, llvm::FastISel::SavePoint::InsertPt, LastLocalValue, and llvm::FunctionLoweringInfo::MBB.
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 285 of file FastISel.cpp.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), FuncInfo, I, LocalValueMap, and llvm::FunctionLoweringInfo::ValueMap.
Referenced by getRegForValue(), hasTrivialKill(), and selectIntrinsicCall().
| bool FastISel::lowerArguments | ( | ) |
Do "fast" instruction selection for function arguments and append the machine instructions to the current block.
Returns true when successful.
Definition at line 108 of file FastISel.cpp.
References llvm::Function::arg_begin(), llvm::Function::arg_end(), llvm::FunctionLoweringInfo::CanLowerReturn, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), fastLowerArguments(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::FunctionLoweringInfo::Fn, FuncInfo, I, LocalValueMap, llvm::FunctionLoweringInfo::ValueMap, and VI.
Definition at line 1007 of file FastISel.cpp.
References llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::arg_begin(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::arg_end(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::arg_size(), llvm::CS, llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::getCalledValue(), llvm::CallInst::getCalledValue(), llvm::SequentialType::getElementType(), llvm::Value::getType(), llvm::Type::isEmptyTy(), llvm::isInTailCallPosition(), llvm::CallInst::isTailCall(), lowerCallTo(), llvm::FastISel::ArgListEntry::setAttributes(), llvm::FastISel::CallLoweringInfo::setCallee(), TM, llvm::FastISel::ArgListEntry::Ty, and llvm::FastISel::ArgListEntry::Val.
Referenced by selectCall().
Definition at line 876 of file FastISel.cpp.
References llvm::CS, llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::getCalledValue(), llvm::SequentialType::getElementType(), llvm::User::getOperand(), llvm::Value::getType(), llvm::Type::isEmptyTy(), llvm::FastISel::CallLoweringInfo::setCallee(), and llvm::FastISel::ArgListEntry::Val.
Referenced by lowerCall(), and lowerCallTo().
|
protected |
Definition at line 867 of file FastISel.cpp.
References DL, llvm::MachineFunction::getContext(), llvm::Mangler::getNameWithPrefix(), llvm::MCContext::getOrCreateSymbol(), lowerCallTo(), and MF.
|
protected |
Definition at line 907 of file FastISel.cpp.
References llvm::ISD::InputArg::ArgVT, llvm::FastISel::CallLoweringInfo::Call, llvm::FastISel::CallLoweringInfo::CallConv, llvm::TargetLowering::CanLowerReturn(), llvm::FastISel::CallLoweringInfo::clearIns(), llvm::FastISel::CallLoweringInfo::clearOuts(), llvm::ComputeValueVTs(), llvm::FastISel::CallLoweringInfo::CS, DL, fastLowerCall(), llvm::ISD::InputArg::Flags, FuncInfo, llvm::TargetLowering::functionArgumentNeedsConsecutiveRegisters(), llvm::DataLayout::getABITypeAlignment(), llvm::FastISel::CallLoweringInfo::getArgs(), llvm::TargetLoweringBase::getByValTypeAlignment(), llvm::Type::getContext(), llvm::SequentialType::getElementType(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::getInstruction(), llvm::TargetLoweringBase::getNumRegisters(), llvm::TargetLoweringBase::getRegisterType(), getReturnAttrs(), llvm::GetReturnInfo(), llvm::DataLayout::getTypeAllocSize(), I, llvm::FastISel::CallLoweringInfo::InRegs, llvm::FastISel::CallLoweringInfo::Ins, llvm::FastISel::CallLoweringInfo::IsInReg, llvm::FastISel::CallLoweringInfo::IsReturnValueUsed, llvm::FastISel::CallLoweringInfo::IsVarArg, llvm::FunctionLoweringInfo::MF, llvm::FastISel::CallLoweringInfo::NumResultRegs, llvm::FastISel::CallLoweringInfo::OutFlags, llvm::FastISel::CallLoweringInfo::OutVals, llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), llvm::FastISel::CallLoweringInfo::ResultReg, llvm::FastISel::CallLoweringInfo::RetSExt, llvm::FastISel::CallLoweringInfo::RetTy, llvm::FastISel::CallLoweringInfo::RetZExt, llvm::ISD::ArgFlagsTy::setByVal(), llvm::ISD::ArgFlagsTy::setByValAlign(), llvm::ISD::ArgFlagsTy::setByValSize(), llvm::ISD::ArgFlagsTy::setInAlloca(), llvm::ISD::ArgFlagsTy::setInConsecutiveRegs(), llvm::ISD::ArgFlagsTy::setInReg(), llvm::ISD::ArgFlagsTy::setNest(), llvm::ISD::ArgFlagsTy::setOrigAlign(), llvm::MachineInstr::setPhysRegsDeadExcept(), llvm::ISD::ArgFlagsTy::setSExt(), llvm::ISD::ArgFlagsTy::setSRet(), llvm::ISD::ArgFlagsTy::setZExt(), llvm::SmallVectorTemplateCommon< T >::size(), TLI, TRI, updateValueMap(), llvm::ISD::InputArg::Used, and llvm::ISD::InputArg::VT.
|
protected |
Definition at line 2188 of file FastISel.cpp.
References llvm::CmpInst::FCMP_FALSE, llvm::CmpInst::FCMP_OEQ, llvm::CmpInst::FCMP_OGE, llvm::CmpInst::FCMP_OGT, llvm::CmpInst::FCMP_OLE, llvm::CmpInst::FCMP_OLT, llvm::CmpInst::FCMP_ONE, llvm::CmpInst::FCMP_ORD, llvm::CmpInst::FCMP_TRUE, llvm::CmpInst::FCMP_UEQ, llvm::CmpInst::FCMP_UGE, llvm::CmpInst::FCMP_UGT, llvm::CmpInst::FCMP_ULE, llvm::CmpInst::FCMP_ULT, llvm::CmpInst::FCMP_UNE, llvm::CmpInst::FCMP_UNO, llvm::User::getOperand(), llvm::CmpInst::getPredicate(), llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_SGE, llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLE, llvm::CmpInst::ICMP_SLT, llvm::CmpInst::ICMP_UGE, llvm::CmpInst::ICMP_UGT, llvm::CmpInst::ICMP_ULE, llvm::CmpInst::ICMP_ULT, and llvm_unreachable.
| void FastISel::recomputeInsertPt | ( | ) |
Reset InsertPt to prepare for inserting instructions into the current block.
Definition at line 338 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 352 of file FastISel.cpp.
References llvm::RegState::Dead, llvm::MachineInstr::eraseFromParent(), I, and recomputeInsertPt().
Referenced by selectInstruction().
Select and emit code for a binary operator instruction, which has an opcode which directly corresponds to the given ISD opcode.
Definition at line 382 of file FastISel.cpp.
References llvm::ISD::AND, fastEmit_rf(), fastEmit_ri_(), fastEmit_rr(), llvm::Value::getContext(), llvm::EVT::getEVT(), llvm::User::getOperand(), getRegForValue(), llvm::EVT::getSimpleVT(), llvm::Value::getType(), llvm::TargetLoweringBase::getTypeToTransformTo(), hasTrivialKill(), I, llvm::MVT::i1, llvm::isPowerOf2_64(), llvm::EVT::isSimple(), llvm::TargetLoweringBase::isTypeLegal(), llvm::Log2_64(), llvm::ISD::OR, llvm::MVT::Other, llvm::ISD::SDIV, llvm::ISD::SRA, TLI, updateValueMap(), llvm::ISD::UREM, and llvm::ISD::XOR.
Referenced by selectOperator().
Definition at line 1280 of file FastISel.cpp.
References llvm::ISD::BITCAST, llvm::BuildMI(), llvm::TargetOpcode::COPY, createResultReg(), DbgLoc, DL, fastEmit_r(), FuncInfo, llvm::MCInstrInfo::get(), llvm::User::getOperand(), llvm::TargetLoweringBase::getRegClassFor(), getRegForValue(), llvm::EVT::getSimpleVT(), llvm::Value::getType(), llvm::TargetLoweringBase::getValueType(), hasTrivialKill(), llvm::FunctionLoweringInfo::InsertPt, llvm::TargetLoweringBase::isTypeLegal(), llvm::FunctionLoweringInfo::MBB, llvm::MVT::Other, TII, TLI, and updateValueMap().
Referenced by selectOperator().
Definition at line 1047 of file FastISel.cpp.
References llvm::BuildMI(), llvm::Call, llvm::ComputeUsesVAFloatArgument(), DbgLoc, llvm::InlineAsm::Extra_HasSideEffects, llvm::InlineAsm::Extra_IsAlignStack, FuncInfo, llvm::MCInstrInfo::get(), llvm::CallInst::getCalledValue(), llvm::MachineFunction::getMMI(), I, llvm::TargetOpcode::INLINEASM, llvm::FunctionLoweringInfo::InsertPt, lowerCall(), llvm::FunctionLoweringInfo::MBB, llvm::FunctionLoweringInfo::MF, selectIntrinsicCall(), and TII.
Referenced by selectOperator().
Definition at line 1247 of file FastISel.cpp.
References DL, fastEmit_r(), llvm::User::getOperand(), getRegForValue(), llvm::EVT::getSimpleVT(), llvm::Value::getType(), llvm::TargetLoweringBase::getValueType(), hasTrivialKill(), llvm::EVT::isSimple(), llvm::TargetLoweringBase::isTypeLegal(), llvm::MVT::Other, TLI, and updateValueMap().
Referenced by selectOperator().
Definition at line 1452 of file FastISel.cpp.
References llvm::ComputeLinearIndex(), llvm::ComputeValueVTs(), DL, llvm::dyn_cast(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::FunctionLoweringInfo::Fn, FuncInfo, llvm::Function::getContext(), llvm::ExtractValueInst::getIndices(), llvm::TargetLoweringBase::getNumRegisters(), llvm::User::getOperand(), llvm::EVT::getSimpleVT(), llvm::Value::getType(), llvm::TargetLoweringBase::getValueType(), I, llvm::MVT::i1, if(), llvm::FunctionLoweringInfo::InitializeRegForValue(), llvm::EVT::isSimple(), llvm::TargetLoweringBase::isTypeLegal(), TLI, updateValueMap(), and llvm::FunctionLoweringInfo::ValueMap.
Referenced by selectOperator().
Emit an FNeg operation.
Definition at line 1409 of file FastISel.cpp.
References llvm::ISD::BITCAST, DL, fastEmit_r(), fastEmit_ri_(), llvm::ISD::FNEG, llvm::Value::getContext(), llvm::BinaryOperator::getFNegArgument(), llvm::EVT::getIntegerVT(), getRegForValue(), llvm::EVT::getSimpleVT(), llvm::EVT::getSizeInBits(), llvm::Value::getType(), llvm::TargetLoweringBase::getValueType(), hasTrivialKill(), llvm::TargetLoweringBase::isTypeLegal(), TLI, updateValueMap(), and llvm::ISD::XOR.
Referenced by selectOperator().
Definition at line 484 of file FastISel.cpp.
References llvm::ISD::ADD, DL, fastEmit_ri_(), fastEmit_rr(), llvm::tgtok::Field, llvm::StructLayout::getElementOffset(), llvm::User::getOperand(), llvm::TargetLoweringBase::getPointerTy(), getRegForGEPIndex(), getRegForValue(), llvm::DataLayout::getStructLayout(), llvm::Value::getType(), llvm::DataLayout::getTypeAllocSize(), hasTrivialKill(), llvm::ISD::MUL, N, llvm::User::op_begin(), llvm::User::op_end(), TLI, and updateValueMap().
Referenced by selectOperator().
| bool FastISel::selectInstruction | ( | const Instruction * | I | ) |
Do "fast" instruction selection for the given LLVM IR instruction and append the generated machine instructions to the current block.
Returns true if selection was successful.
Definition at line 1329 of file FastISel.cpp.
References llvm::Call, DbgLoc, F(), fastSelectInstruction(), FuncInfo, llvm::Instruction::getDebugLoc(), llvm::Function::getIntrinsicID(), 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, llvm::FunctionLoweringInfo::OrigNumPHINodesToUpdate, llvm::FunctionLoweringInfo::PHINodesToUpdate, recomputeInsertPt(), removeDeadCode(), selectOperator(), and SkipTargetIndependentISel.
|
protected |
Definition at line 1093 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addCImm(), llvm::MachineInstrBuilder::addFPImm(), llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addMetadata(), llvm::MachineInstrBuilder::addReg(), llvm::dwarf::syntax::Address, llvm::BuildMI(), llvm::MachineOperand::CreateFI(), llvm::MachineOperand::CreateReg(), llvm::TargetOpcode::DBG_VALUE, DbgLoc, llvm::dbgs(), DEBUG, llvm::DI, fastLowerIntrinsicCall(), FuncInfo, llvm::MCInstrInfo::get(), llvm::ConstantInt::get(), llvm::UndefValue::get(), llvm::DbgDeclareInst::getAddress(), llvm::CallInst::getArgOperand(), llvm::FunctionLoweringInfo::getArgumentFrameIndex(), llvm::DbgDeclareInst::getExpression(), llvm::DbgValueInst::getExpression(), llvm::IntrinsicInst::getIntrinsicID(), llvm::MachineFunction::getMMI(), llvm::DbgValueInst::getOffset(), llvm::MachineOperand::getReg(), getRegForValue(), llvm::Value::getType(), llvm::DbgValueInst::getValue(), llvm::DbgDeclareInst::getVariable(), llvm::DbgValueInst::getVariable(), llvm::MachineModuleInfo::hasDebugInfo(), llvm::FunctionLoweringInfo::InitializeRegForValue(), llvm::FunctionLoweringInfo::InsertPt, llvm::MachineOperand::isReg(), llvm::DILocalVariable::isValidLocationForIntrinsic(), llvm::ConstantInt::isZero(), lookUpRegForValue(), llvm::FunctionLoweringInfo::MBB, llvm::FunctionLoweringInfo::MF, selectPatchpoint(), selectStackmap(), llvm::MachineOperand::setIsDebug(), llvm::FunctionLoweringInfo::StaticAllocaMap, TII, updateValueMap(), and llvm::Value::use_empty().
Referenced by selectCall().
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 1492 of file FastISel.cpp.
References llvm::ISD::ADD, llvm::ISD::AND, llvm::APIntOps::And(), llvm::EVT::bitsGT(), llvm::EVT::bitsLT(), llvm::Call, DL, llvm::ISD::FADD, fastEmit_(), 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::TargetMachine::Options, llvm::ISD::OR, llvm::APIntOps::Or(), llvm::MVT::Other, llvm::TargetOpcode::PHI, llvm::ISD::SDIV, selectBinaryOp(), selectBitCast(), selectCall(), selectCast(), selectExtractValue(), selectFNeg(), selectGetElementPtr(), 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, TM, llvm::ISD::TRAP, llvm::TargetOptions::TrapUnreachable, llvm::ISD::TRUNCATE, llvm::ISD::UDIV, updateValueMap(), llvm::ISD::UREM, llvm::ISD::XOR, llvm::APIntOps::Xor(), and llvm::ISD::ZERO_EXTEND.
Referenced by selectInstruction().
Definition at line 714 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addOperand(), llvm::CallingConv::AnyReg, llvm::BuildMI(), llvm::C, llvm::FastISel::CallLoweringInfo::Call, llvm::PatchPointOpers::CCPos, llvm::MachineOperand::CreateGA(), llvm::MachineOperand::CreateImm(), llvm::MachineOperand::CreateReg(), llvm::MachineOperand::CreateRegMask(), createResultReg(), DbgLoc, llvm::MachineInstr::eraseFromParent(), FuncInfo, llvm::MCInstrInfo::get(), llvm::CallInst::getArgOperand(), llvm::CallInst::getCallingConv(), llvm::TargetRegisterInfo::getCallPreservedMask(), llvm::MachineFunction::getFrameInfo(), llvm::CallInst::getNumArgOperands(), llvm::User::getOperand(), llvm::TargetLoweringBase::getRegClassFor(), getRegForValue(), llvm::TargetLowering::getScratchRegisters(), llvm::Value::getType(), llvm::MVT::i64, llvm::PatchPointOpers::IDPos, llvm::FastISel::CallLoweringInfo::InRegs, llvm::Type::isVoidTy(), llvm_unreachable, llvm::FunctionLoweringInfo::MBB, llvm::FunctionLoweringInfo::MF, llvm::PatchPointOpers::NArgPos, llvm::PatchPointOpers::NBytesPos, llvm::FastISel::CallLoweringInfo::NumResultRegs, llvm::FastISel::CallLoweringInfo::OutRegs, llvm::TargetOpcode::PATCHPOINT, llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::FastISel::CallLoweringInfo::ResultReg, llvm::MachineFrameInfo::setHasPatchPoint(), llvm::FastISel::CallLoweringInfo::setIsPatchPoint(), llvm::MachineInstr::setPhysRegsDeadExcept(), llvm::SmallVectorTemplateCommon< T, typename >::size(), llvm::Value::stripPointerCasts(), llvm::PatchPointOpers::TargetPos, TII, TLI, TRI, and updateValueMap().
Referenced by selectIntrinsicCall().
Definition at line 602 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addOperand(), llvm::BuildMI(), llvm::MachineOperand::CreateImm(), llvm::MachineOperand::CreateReg(), DbgLoc, FuncInfo, llvm::MCInstrInfo::get(), llvm::CallInst::getCalledFunction(), llvm::TargetInstrInfo::getCallFrameDestroyOpcode(), llvm::TargetInstrInfo::getCallFrameSetupOpcode(), llvm::CallInst::getCallingConv(), llvm::MachineFunction::getFrameInfo(), llvm::User::getOperand(), llvm::Function::getReturnType(), llvm::TargetLowering::getScratchRegisters(), llvm::PatchPointOpers::IDPos, llvm::FunctionLoweringInfo::InsertPt, llvm::Type::isVoidTy(), llvm::FunctionLoweringInfo::MBB, llvm::FunctionLoweringInfo::MF, llvm::PatchPointOpers::NBytesPos, llvm::MachineFrameInfo::setHasStackMap(), llvm::TargetOpcode::STACKMAP, TII, and TLI.
Referenced by selectIntrinsicCall().
|
inline |
Update the position of the last instruction emitted for materializing constants for use in the current block.
Definition at line 225 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.
Definition at line 96 of file FastISel.cpp.
References llvm::MachineBasicBlock::back(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::clear(), EmitStartPt, llvm::MachineBasicBlock::empty(), FuncInfo, LastLocalValue, LocalValueMap, and llvm::FunctionLoweringInfo::MBB.
| 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 2070 of file FastISel.cpp.
References FuncInfo, llvm::MachineRegisterInfo::defusechain_iterator< Uses, Defs, SkipDebug, ByOperand, ByInstr, ByBundle >::getOperandNo(), llvm::Instruction::getParent(), llvm::MachineInstr::getParent(), llvm::MachineOperand::getParent(), getRegForValue(), llvm::Value::hasOneUse(), llvm::MachineRegisterInfo::hasOneUse(), llvm::FunctionLoweringInfo::InsertPt, llvm::LoadInst::isVolatile(), llvm::FunctionLoweringInfo::MBB, MRI, llvm::MachineRegisterInfo::reg_begin(), tryToFoldLoadIntoMI(), and llvm::Instruction::user_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 285 of file FastISel.h.
Referenced by tryToFoldLoad().
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 296 of file FastISel.cpp.
References FuncInfo, I, LocalValueMap, llvm::FunctionLoweringInfo::RegFixups, and llvm::FunctionLoweringInfo::ValueMap.
Referenced by lowerCallTo(), selectBinaryOp(), selectBitCast(), selectCast(), selectExtractValue(), selectFNeg(), selectGetElementPtr(), selectIntrinsicCall(), selectOperator(), and selectPatchpoint().
|
protected |
Definition at line 198 of file FastISel.h.
Referenced by constrainOperandRegClass(), 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(), selectBitCast(), selectCall(), selectInstruction(), selectIntrinsicCall(), selectPatchpoint(), and selectStackmap().
|
protected |
Definition at line 200 of file FastISel.h.
Referenced by canFoldAddIntoGEP(), createMachineMemOperandFor(), getRegForGEPIndex(), getRegForValue(), hasTrivialKill(), lowerCallTo(), selectBitCast(), selectCast(), selectExtractValue(), selectFNeg(), selectGetElementPtr(), and selectOperator().
|
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 216 of file FastISel.h.
Referenced by setLastLocalValue(), and startNewBlock().
|
protected |
Definition at line 193 of file FastISel.h.
Referenced by canFoldAddIntoGEP(), constrainOperandRegClass(), createMachineMemOperandFor(), 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(), lowerCallTo(), recomputeInsertPt(), selectBitCast(), selectCall(), selectExtractValue(), selectInstruction(), selectIntrinsicCall(), selectOperator(), selectPatchpoint(), selectStackmap(), 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 211 of file FastISel.h.
Referenced by getLastLocalValue(), leaveLocalValueArea(), setLastLocalValue(), and startNewBlock().
|
protected |
Definition at line 204 of file FastISel.h.
Referenced by selectInstruction().
Definition at line 192 of file FastISel.h.
Referenced by lookUpRegForValue(), lowerArguments(), startNewBlock(), and updateValueMap().
|
protected |
Definition at line 197 of file FastISel.h.
|
protected |
Definition at line 194 of file FastISel.h.
Referenced by lowerCallTo().
|
protected |
Definition at line 196 of file FastISel.h.
|
protected |
Definition at line 195 of file FastISel.h.
Referenced by constrainOperandRegClass(), createResultReg(), fastEmitInst_extractsubreg(), hasTrivialKill(), and tryToFoldLoad().
|
protected |
Definition at line 205 of file FastISel.h.
Referenced by selectInstruction().
|
protected |
Definition at line 201 of file FastISel.h.
Referenced by constrainOperandRegClass(), fastEmitBranch(), fastEmitInst_(), fastEmitInst_extractsubreg(), fastEmitInst_i(), fastEmitInst_ii(), fastEmitInst_r(), fastEmitInst_rf(), fastEmitInst_ri(), fastEmitInst_rii(), fastEmitInst_rr(), fastEmitInst_rri(), fastEmitInst_rrii(), fastEmitInst_rrr(), selectBitCast(), selectCall(), selectIntrinsicCall(), selectPatchpoint(), and selectStackmap().
|
protected |
Definition at line 202 of file FastISel.h.
Referenced by fastEmitInst_extractsubreg(), getRegForGEPIndex(), getRegForValue(), lowerCallTo(), selectBinaryOp(), selectBitCast(), selectCast(), selectExtractValue(), selectFNeg(), selectGetElementPtr(), selectOperator(), selectPatchpoint(), and selectStackmap().
|
protected |
Definition at line 199 of file FastISel.h.
Referenced by lowerCall(), and selectOperator().
|
protected |
Definition at line 203 of file FastISel.h.
Referenced by constrainOperandRegClass(), fastEmitInst_extractsubreg(), lowerCallTo(), and selectPatchpoint().
1.8.6