LLVM API Documentation

FastISel.h
Go to the documentation of this file.
00001 //===-- FastISel.h - Definition of the FastISel class ---*- C++ -*---------===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 ///
00010 /// \file
00011 /// This file defines the FastISel class.
00012 ///
00013 //===----------------------------------------------------------------------===//
00014 
00015 #ifndef LLVM_CODEGEN_FASTISEL_H
00016 #define LLVM_CODEGEN_FASTISEL_H
00017 
00018 #include "llvm/ADT/DenseMap.h"
00019 #include "llvm/CodeGen/CallingConvLower.h"
00020 #include "llvm/CodeGen/MachineBasicBlock.h"
00021 #include "llvm/Target/TargetLowering.h"
00022 #include "llvm/IR/CallingConv.h"
00023 #include "llvm/IR/IntrinsicInst.h"
00024 
00025 namespace llvm {
00026 
00027 /// \brief This is a fast-path instruction selection class that generates poor
00028 /// code and doesn't support illegal types or non-trivial lowering, but runs
00029 /// quickly.
00030 class FastISel {
00031 public:
00032   struct ArgListEntry {
00033     Value *Val;
00034     Type *Ty;
00035     bool IsSExt : 1;
00036     bool IsZExt : 1;
00037     bool IsInReg : 1;
00038     bool IsSRet : 1;
00039     bool IsNest : 1;
00040     bool IsByVal : 1;
00041     bool IsInAlloca : 1;
00042     bool IsReturned : 1;
00043     uint16_t Alignment;
00044 
00045     ArgListEntry()
00046         : Val(nullptr), Ty(nullptr), IsSExt(false), IsZExt(false),
00047           IsInReg(false), IsSRet(false), IsNest(false), IsByVal(false),
00048           IsInAlloca(false), IsReturned(false), Alignment(0) {}
00049 
00050     /// \brief Set CallLoweringInfo attribute flags based on a call instruction
00051     /// and called function attributes.
00052     void setAttributes(ImmutableCallSite *CS, unsigned AttrIdx);
00053   };
00054   typedef std::vector<ArgListEntry> ArgListTy;
00055 
00056   struct CallLoweringInfo {
00057     Type *RetTy;
00058     bool RetSExt : 1;
00059     bool RetZExt : 1;
00060     bool IsVarArg : 1;
00061     bool IsInReg : 1;
00062     bool DoesNotReturn : 1;
00063     bool IsReturnValueUsed : 1;
00064 
00065     // \brief IsTailCall Should be modified by implementations of FastLowerCall
00066     // that perform tail call conversions.
00067     bool IsTailCall;
00068 
00069     unsigned NumFixedArgs;
00070     CallingConv::ID CallConv;
00071     const Value *Callee;
00072     const char *SymName;
00073     ArgListTy Args;
00074     ImmutableCallSite *CS;
00075     MachineInstr *Call;
00076     unsigned ResultReg;
00077     unsigned NumResultRegs;
00078 
00079     SmallVector<Value *, 16> OutVals;
00080     SmallVector<ISD::ArgFlagsTy, 16> OutFlags;
00081     SmallVector<unsigned, 16> OutRegs;
00082     SmallVector<ISD::InputArg, 4> Ins;
00083     SmallVector<unsigned, 4> InRegs;
00084 
00085     CallLoweringInfo()
00086         : RetTy(nullptr), RetSExt(false), RetZExt(false), IsVarArg(false),
00087           IsInReg(false), DoesNotReturn(false), IsReturnValueUsed(true),
00088           IsTailCall(false), NumFixedArgs(-1), CallConv(CallingConv::C),
00089           Callee(nullptr), SymName(nullptr), CS(nullptr), Call(nullptr),
00090           ResultReg(0), NumResultRegs(0) {}
00091 
00092     CallLoweringInfo &setCallee(Type *ResultTy, FunctionType *FuncTy,
00093                                 const Value *Target, ArgListTy &&ArgsList,
00094                                 ImmutableCallSite &Call) {
00095       RetTy = ResultTy;
00096       Callee = Target;
00097 
00098       IsInReg = Call.paramHasAttr(0, Attribute::InReg);
00099       DoesNotReturn = Call.doesNotReturn();
00100       IsVarArg = FuncTy->isVarArg();
00101       IsReturnValueUsed = !Call.getInstruction()->use_empty();
00102       RetSExt = Call.paramHasAttr(0, Attribute::SExt);
00103       RetZExt = Call.paramHasAttr(0, Attribute::ZExt);
00104 
00105       CallConv = Call.getCallingConv();
00106       Args = std::move(ArgsList);
00107       NumFixedArgs = FuncTy->getNumParams();
00108 
00109       CS = &Call;
00110 
00111       return *this;
00112     }
00113 
00114     CallLoweringInfo &setCallee(Type *ResultTy, FunctionType *FuncTy,
00115                                 const char *Target, ArgListTy &&ArgsList,
00116                                 ImmutableCallSite &Call,
00117                                 unsigned FixedArgs = ~0U) {
00118       RetTy = ResultTy;
00119       Callee = Call.getCalledValue();
00120       SymName = Target;
00121 
00122       IsInReg = Call.paramHasAttr(0, Attribute::InReg);
00123       DoesNotReturn = Call.doesNotReturn();
00124       IsVarArg = FuncTy->isVarArg();
00125       IsReturnValueUsed = !Call.getInstruction()->use_empty();
00126       RetSExt = Call.paramHasAttr(0, Attribute::SExt);
00127       RetZExt = Call.paramHasAttr(0, Attribute::ZExt);
00128 
00129       CallConv = Call.getCallingConv();
00130       Args = std::move(ArgsList);
00131       NumFixedArgs = (FixedArgs == ~0U) ? FuncTy->getNumParams() : FixedArgs;
00132 
00133       CS = &Call;
00134 
00135       return *this;
00136     }
00137 
00138     CallLoweringInfo &setCallee(CallingConv::ID CC, Type *ResultTy,
00139                                 const Value *Target, ArgListTy &&ArgsList,
00140                                 unsigned FixedArgs = ~0U) {
00141       RetTy = ResultTy;
00142       Callee = Target;
00143       CallConv = CC;
00144       Args = std::move(ArgsList);
00145       NumFixedArgs = (FixedArgs == ~0U) ? Args.size() : FixedArgs;
00146       return *this;
00147     }
00148 
00149     CallLoweringInfo &setCallee(CallingConv::ID CC, Type *ResultTy,
00150                                 const char *Target, ArgListTy &&ArgsList,
00151                                 unsigned FixedArgs = ~0U) {
00152       RetTy = ResultTy;
00153       SymName = Target;
00154       CallConv = CC;
00155       Args = std::move(ArgsList);
00156       NumFixedArgs = (FixedArgs == ~0U) ? Args.size() : FixedArgs;
00157       return *this;
00158     }
00159 
00160     CallLoweringInfo &setTailCall(bool Value = true) {
00161       IsTailCall = Value;
00162       return *this;
00163     }
00164 
00165     ArgListTy &getArgs() { return Args; }
00166 
00167     void clearOuts() {
00168       OutVals.clear();
00169       OutFlags.clear();
00170       OutRegs.clear();
00171     }
00172 
00173     void clearIns() {
00174       Ins.clear();
00175       InRegs.clear();
00176     }
00177   };
00178 
00179 protected:
00180   DenseMap<const Value *, unsigned> LocalValueMap;
00181   FunctionLoweringInfo &FuncInfo;
00182   MachineFunction *MF;
00183   MachineRegisterInfo &MRI;
00184   MachineFrameInfo &MFI;
00185   MachineConstantPool &MCP;
00186   DebugLoc DbgLoc;
00187   const TargetMachine &TM;
00188   const DataLayout &DL;
00189   const TargetInstrInfo &TII;
00190   const TargetLowering &TLI;
00191   const TargetRegisterInfo &TRI;
00192   const TargetLibraryInfo *LibInfo;
00193   bool SkipTargetIndependentISel;
00194 
00195   /// \brief The position of the last instruction for materializing constants
00196   /// for use in the current block. It resets to EmitStartPt when it makes sense
00197   /// (for example, it's usually profitable to avoid function calls between the
00198   /// definition and the use)
00199   MachineInstr *LastLocalValue;
00200 
00201   /// \brief The top most instruction in the current block that is allowed for
00202   /// emitting local variables. LastLocalValue resets to EmitStartPt when it
00203   /// makes sense (for example, on function calls)
00204   MachineInstr *EmitStartPt;
00205 
00206 public:
00207   /// \brief Return the position of the last instruction emitted for
00208   /// materializing constants for use in the current block.
00209   MachineInstr *getLastLocalValue() { return LastLocalValue; }
00210 
00211   /// \brief Update the position of the last instruction emitted for
00212   /// materializing constants for use in the current block.
00213   void setLastLocalValue(MachineInstr *I) {
00214     EmitStartPt = I;
00215     LastLocalValue = I;
00216   }
00217 
00218   /// \brief Set the current block to which generated machine instructions will
00219   /// be appended, and clear the local CSE map.
00220   void startNewBlock();
00221 
00222   /// \brief Return current debug location information.
00223   DebugLoc getCurDebugLoc() const { return DbgLoc; }
00224 
00225   /// \brief Do "fast" instruction selection for function arguments and append
00226   /// the machine instructions to the current block. Returns true when
00227   /// successful.
00228   bool lowerArguments();
00229 
00230   /// \brief Do "fast" instruction selection for the given LLVM IR instruction
00231   /// and append the generated machine instructions to the current block.
00232   /// Returns true if selection was successful.
00233   bool selectInstruction(const Instruction *I);
00234 
00235   /// \brief Do "fast" instruction selection for the given LLVM IR operator
00236   /// (Instruction or ConstantExpr), and append generated machine instructions
00237   /// to the current block. Return true if selection was successful.
00238   bool selectOperator(const User *I, unsigned Opcode);
00239 
00240   /// \brief Create a virtual register and arrange for it to be assigned the
00241   /// value for the given LLVM value.
00242   unsigned getRegForValue(const Value *V);
00243 
00244   /// \brief Look up the value to see if its value is already cached in a
00245   /// register. It may be defined by instructions across blocks or defined
00246   /// locally.
00247   unsigned lookUpRegForValue(const Value *V);
00248 
00249   /// \brief This is a wrapper around getRegForValue that also takes care of
00250   /// truncating or sign-extending the given getelementptr index value.
00251   std::pair<unsigned, bool> getRegForGEPIndex(const Value *V);
00252 
00253   /// \brief We're checking to see if we can fold \p LI into \p FoldInst. Note
00254   /// that we could have a sequence where multiple LLVM IR instructions are
00255   /// folded into the same machineinstr.  For example we could have:
00256   ///
00257   ///   A: x = load i32 *P
00258   ///   B: y = icmp A, 42
00259   ///   C: br y, ...
00260   ///
00261   /// In this scenario, \p LI is "A", and \p FoldInst is "C".  We know about "B"
00262   /// (and any other folded instructions) because it is between A and C.
00263   ///
00264   /// If we succeed folding, return true.
00265   bool tryToFoldLoad(const LoadInst *LI, const Instruction *FoldInst);
00266 
00267   /// \brief The specified machine instr operand is a vreg, and that vreg is
00268   /// being provided by the specified load instruction.  If possible, try to
00269   /// fold the load as an operand to the instruction, returning true if
00270   /// possible.
00271   ///
00272   /// This method should be implemented by targets.
00273   virtual bool tryToFoldLoadIntoMI(MachineInstr * /*MI*/, unsigned /*OpNo*/,
00274                                    const LoadInst * /*LI*/) {
00275     return false;
00276   }
00277 
00278   /// \brief Reset InsertPt to prepare for inserting instructions into the
00279   /// current block.
00280   void recomputeInsertPt();
00281 
00282   /// \brief Remove all dead instructions between the I and E.
00283   void removeDeadCode(MachineBasicBlock::iterator I,
00284                       MachineBasicBlock::iterator E);
00285 
00286   struct SavePoint {
00287     MachineBasicBlock::iterator InsertPt;
00288     DebugLoc DL;
00289   };
00290 
00291   /// \brief Prepare InsertPt to begin inserting instructions into the local
00292   /// value area and return the old insert position.
00293   SavePoint enterLocalValueArea();
00294 
00295   /// \brief Reset InsertPt to the given old insert position.
00296   void leaveLocalValueArea(SavePoint Old);
00297 
00298   virtual ~FastISel();
00299 
00300 protected:
00301   explicit FastISel(FunctionLoweringInfo &FuncInfo,
00302                     const TargetLibraryInfo *LibInfo,
00303                     bool SkipTargetIndependentISel = false);
00304 
00305   /// \brief This method is called by target-independent code when the normal
00306   /// FastISel process fails to select an instruction. This gives targets a
00307   /// chance to emit code for anything that doesn't fit into FastISel's
00308   /// framework. It returns true if it was successful.
00309   virtual bool fastSelectInstruction(const Instruction *I) = 0;
00310 
00311   /// \brief This method is called by target-independent code to do target-
00312   /// specific argument lowering. It returns true if it was successful.
00313   virtual bool fastLowerArguments();
00314 
00315   /// \brief This method is called by target-independent code to do target-
00316   /// specific call lowering. It returns true if it was successful.
00317   virtual bool fastLowerCall(CallLoweringInfo &CLI);
00318 
00319   /// \brief This method is called by target-independent code to do target-
00320   /// specific intrinsic lowering. It returns true if it was successful.
00321   virtual bool fastLowerIntrinsicCall(const IntrinsicInst *II);
00322 
00323   /// \brief This method is called by target-independent code to request that an
00324   /// instruction with the given type and opcode be emitted.
00325   virtual unsigned fastEmit_(MVT VT, MVT RetVT, unsigned Opcode);
00326 
00327   /// \brief This method is called by target-independent code to request that an
00328   /// instruction with the given type, opcode, and register operand be emitted.
00329   virtual unsigned fastEmit_r(MVT VT, MVT RetVT, unsigned Opcode, unsigned Op0,
00330                               bool Op0IsKill);
00331 
00332   /// \brief This method is called by target-independent code to request that an
00333   /// instruction with the given type, opcode, and register operands be emitted.
00334   virtual unsigned fastEmit_rr(MVT VT, MVT RetVT, unsigned Opcode, unsigned Op0,
00335                                bool Op0IsKill, unsigned Op1, bool Op1IsKill);
00336 
00337   /// \brief This method is called by target-independent code to request that an
00338   /// instruction with the given type, opcode, and register and immediate
00339   // operands be emitted.
00340   virtual unsigned fastEmit_ri(MVT VT, MVT RetVT, unsigned Opcode, unsigned Op0,
00341                                bool Op0IsKill, uint64_t Imm);
00342 
00343   /// \brief This method is called by target-independent code to request that an
00344   /// instruction with the given type, opcode, and register and floating-point
00345   /// immediate operands be emitted.
00346   virtual unsigned fastEmit_rf(MVT VT, MVT RetVT, unsigned Opcode, unsigned Op0,
00347                                bool Op0IsKill, const ConstantFP *FPImm);
00348 
00349   /// \brief This method is called by target-independent code to request that an
00350   /// instruction with the given type, opcode, and register and immediate
00351   /// operands be emitted.
00352   virtual unsigned fastEmit_rri(MVT VT, MVT RetVT, unsigned Opcode,
00353                                 unsigned Op0, bool Op0IsKill, unsigned Op1,
00354                                 bool Op1IsKill, uint64_t Imm);
00355 
00356   /// \brief This method is a wrapper of fastEmit_ri.
00357   ///
00358   /// It first tries to emit an instruction with an immediate operand using
00359   /// fastEmit_ri.  If that fails, it materializes the immediate into a register
00360   /// and try fastEmit_rr instead.
00361   unsigned fastEmit_ri_(MVT VT, unsigned Opcode, unsigned Op0, bool Op0IsKill,
00362                         uint64_t Imm, MVT ImmType);
00363 
00364   /// \brief This method is called by target-independent code to request that an
00365   /// instruction with the given type, opcode, and immediate operand be emitted.
00366   virtual unsigned fastEmit_i(MVT VT, MVT RetVT, unsigned Opcode, uint64_t Imm);
00367 
00368   /// \brief This method is called by target-independent code to request that an
00369   /// instruction with the given type, opcode, and floating-point immediate
00370   /// operand be emitted.
00371   virtual unsigned fastEmit_f(MVT VT, MVT RetVT, unsigned Opcode,
00372                               const ConstantFP *FPImm);
00373 
00374   /// \brief Emit a MachineInstr with no operands and a result register in the
00375   /// given register class.
00376   unsigned fastEmitInst_(unsigned MachineInstOpcode,
00377                          const TargetRegisterClass *RC);
00378 
00379   /// \brief Emit a MachineInstr with one register operand and a result register
00380   /// in the given register class.
00381   unsigned fastEmitInst_r(unsigned MachineInstOpcode,
00382                           const TargetRegisterClass *RC, unsigned Op0,
00383                           bool Op0IsKill);
00384 
00385   /// \brief Emit a MachineInstr with two register operands and a result
00386   /// register in the given register class.
00387   unsigned fastEmitInst_rr(unsigned MachineInstOpcode,
00388                            const TargetRegisterClass *RC, unsigned Op0,
00389                            bool Op0IsKill, unsigned Op1, bool Op1IsKill);
00390 
00391   /// \brief Emit a MachineInstr with three register operands and a result
00392   /// register in the given register class.
00393   unsigned fastEmitInst_rrr(unsigned MachineInstOpcode,
00394                             const TargetRegisterClass *RC, unsigned Op0,
00395                             bool Op0IsKill, unsigned Op1, bool Op1IsKill,
00396                             unsigned Op2, bool Op2IsKill);
00397 
00398   /// \brief Emit a MachineInstr with a register operand, an immediate, and a
00399   /// result register in the given register class.
00400   unsigned fastEmitInst_ri(unsigned MachineInstOpcode,
00401                            const TargetRegisterClass *RC, unsigned Op0,
00402                            bool Op0IsKill, uint64_t Imm);
00403 
00404   /// \brief Emit a MachineInstr with one register operand and two immediate
00405   /// operands.
00406   unsigned fastEmitInst_rii(unsigned MachineInstOpcode,
00407                             const TargetRegisterClass *RC, unsigned Op0,
00408                             bool Op0IsKill, uint64_t Imm1, uint64_t Imm2);
00409 
00410   /// \brief Emit a MachineInstr with two register operands and a result
00411   /// register in the given register class.
00412   unsigned fastEmitInst_rf(unsigned MachineInstOpcode,
00413                            const TargetRegisterClass *RC, unsigned Op0,
00414                            bool Op0IsKill, const ConstantFP *FPImm);
00415 
00416   /// \brief Emit a MachineInstr with two register operands, an immediate, and a
00417   /// result register in the given register class.
00418   unsigned fastEmitInst_rri(unsigned MachineInstOpcode,
00419                             const TargetRegisterClass *RC, unsigned Op0,
00420                             bool Op0IsKill, unsigned Op1, bool Op1IsKill,
00421                             uint64_t Imm);
00422 
00423   /// \brief Emit a MachineInstr with two register operands, two immediates
00424   /// operands, and a result register in the given register class.
00425   unsigned fastEmitInst_rrii(unsigned MachineInstOpcode,
00426                              const TargetRegisterClass *RC, unsigned Op0,
00427                              bool Op0IsKill, unsigned Op1, bool Op1IsKill,
00428                              uint64_t Imm1, uint64_t Imm2);
00429 
00430   /// \brief Emit a MachineInstr with a single immediate operand, and a result
00431   /// register in the given register class.
00432   unsigned fastEmitInst_i(unsigned MachineInstrOpcode,
00433                           const TargetRegisterClass *RC, uint64_t Imm);
00434 
00435   /// \brief Emit a MachineInstr with a two immediate operands.
00436   unsigned fastEmitInst_ii(unsigned MachineInstrOpcode,
00437                            const TargetRegisterClass *RC, uint64_t Imm1,
00438                            uint64_t Imm2);
00439 
00440   /// \brief Emit a MachineInstr for an extract_subreg from a specified index of
00441   /// a superregister to a specified type.
00442   unsigned fastEmitInst_extractsubreg(MVT RetVT, unsigned Op0, bool Op0IsKill,
00443                                       uint32_t Idx);
00444 
00445   /// \brief Emit MachineInstrs to compute the value of Op with all but the
00446   /// least significant bit set to zero.
00447   unsigned fastEmitZExtFromI1(MVT VT, unsigned Op0, bool Op0IsKill);
00448 
00449   /// \brief Emit an unconditional branch to the given block, unless it is the
00450   /// immediate (fall-through) successor, and update the CFG.
00451   void fastEmitBranch(MachineBasicBlock *MBB, DebugLoc DL);
00452 
00453   /// \brief Update the value map to include the new mapping for this
00454   /// instruction, or insert an extra copy to get the result in a previous
00455   /// determined register.
00456   ///
00457   /// NOTE: This is only necessary because we might select a block that uses a
00458   /// value before we select the block that defines the value. It might be
00459   /// possible to fix this by selecting blocks in reverse postorder.
00460   void updateValueMap(const Value *I, unsigned Reg, unsigned NumRegs = 1);
00461 
00462   unsigned createResultReg(const TargetRegisterClass *RC);
00463 
00464   /// \brief Try to constrain Op so that it is usable by argument OpNum of the
00465   /// provided MCInstrDesc. If this fails, create a new virtual register in the
00466   /// correct class and COPY the value there.
00467   unsigned constrainOperandRegClass(const MCInstrDesc &II, unsigned Op,
00468                                     unsigned OpNum);
00469 
00470   /// \brief Emit a constant in a register using target-specific logic, such as
00471   /// constant pool loads.
00472   virtual unsigned fastMaterializeConstant(const Constant *C) { return 0; }
00473 
00474   /// \brief Emit an alloca address in a register using target-specific logic.
00475   virtual unsigned fastMaterializeAlloca(const AllocaInst *C) { return 0; }
00476 
00477   /// \brief Emit the floating-point constant +0.0 in a register using target-
00478   /// specific logic.
00479   virtual unsigned fastMaterializeFloatZero(const ConstantFP *CF) {
00480     return 0;
00481   }
00482 
00483   /// \brief Check if \c Add is an add that can be safely folded into \c GEP.
00484   ///
00485   /// \c Add can be folded into \c GEP if:
00486   /// - \c Add is an add,
00487   /// - \c Add's size matches \c GEP's,
00488   /// - \c Add is in the same basic block as \c GEP, and
00489   /// - \c Add has a constant operand.
00490   bool canFoldAddIntoGEP(const User *GEP, const Value *Add);
00491 
00492   /// \brief Test whether the given value has exactly one use.
00493   bool hasTrivialKill(const Value *V);
00494 
00495   /// \brief Create a machine mem operand from the given instruction.
00496   MachineMemOperand *createMachineMemOperandFor(const Instruction *I) const;
00497 
00498   CmpInst::Predicate optimizeCmpPredicate(const CmpInst *CI) const;
00499 
00500   bool lowerCallTo(const CallInst *CI, const char *SymName, unsigned NumArgs);
00501   bool lowerCallTo(CallLoweringInfo &CLI);
00502 
00503   bool isCommutativeIntrinsic(IntrinsicInst const *II) {
00504     switch (II->getIntrinsicID()) {
00505     case Intrinsic::sadd_with_overflow:
00506     case Intrinsic::uadd_with_overflow:
00507     case Intrinsic::smul_with_overflow:
00508     case Intrinsic::umul_with_overflow:
00509       return true;
00510     default:
00511       return false;
00512     }
00513   }
00514 
00515 
00516   bool lowerCall(const CallInst *I);
00517   /// \brief Select and emit code for a binary operator instruction, which has
00518   /// an opcode which directly corresponds to the given ISD opcode.
00519   bool selectBinaryOp(const User *I, unsigned ISDOpcode);
00520   bool selectFNeg(const User *I);
00521   bool selectGetElementPtr(const User *I);
00522   bool selectStackmap(const CallInst *I);
00523   bool selectPatchpoint(const CallInst *I);
00524   bool selectCall(const User *Call);
00525   bool selectIntrinsicCall(const IntrinsicInst *II);
00526   bool selectBitCast(const User *I);
00527   bool selectCast(const User *I, unsigned Opcode);
00528   bool selectExtractValue(const User *I);
00529   bool selectInsertValue(const User *I);
00530 
00531 private:
00532   /// \brief Handle PHI nodes in successor blocks.
00533   ///
00534   /// Emit code to ensure constants are copied into registers when needed.
00535   /// Remember the virtual registers that need to be added to the Machine PHI
00536   /// nodes as input.  We cannot just directly add them, because expansion might
00537   /// result in multiple MBB's for one BB.  As such, the start of the BB might
00538   /// correspond to a different MBB than the end.
00539   bool handlePHINodesInSuccessorBlocks(const BasicBlock *LLVMBB);
00540 
00541   /// \brief Helper for materializeRegForValue to materialize a constant in a
00542   /// target-independent way.
00543   unsigned materializeConstant(const Value *V, MVT VT);
00544 
00545   /// \brief Helper for getRegForVale. This function is called when the value
00546   /// isn't already available in a register and must be materialized with new
00547   /// instructions.
00548   unsigned materializeRegForValue(const Value *V, MVT VT);
00549 
00550   /// \brief Clears LocalValueMap and moves the area for the new local variables
00551   /// to the beginning of the block. It helps to avoid spilling cached variables
00552   /// across heavy instructions like calls.
00553   void flushLocalValueMap();
00554 
00555   /// \brief Insertion point before trying to select the current instruction.
00556   MachineBasicBlock::iterator SavedInsertPt;
00557 
00558   /// \brief Add a stackmap or patchpoint intrinsic call's live variable
00559   /// operands to a stackmap or patchpoint machine instruction.
00560   bool addStackMapLiveVars(SmallVectorImpl<MachineOperand> &Ops,
00561                            const CallInst *CI, unsigned StartIdx);
00562   bool lowerCallOperands(const CallInst *CI, unsigned ArgIdx, unsigned NumArgs,
00563                          const Value *Callee, bool ForceRetVoidTy,
00564                          CallLoweringInfo &CLI);
00565 };
00566 
00567 } // end namespace llvm
00568 
00569 #endif