LLVM API Documentation
00001 //===-- llvm/CodeGen/SelectionDAG.h - InstSelection DAG ---------*- 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 // This file declares the SelectionDAG class, and transitively defines the 00011 // SDNode class and subclasses. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 #ifndef LLVM_CODEGEN_SELECTIONDAG_H 00016 #define LLVM_CODEGEN_SELECTIONDAG_H 00017 00018 #include "llvm/ADT/ilist.h" 00019 #include "llvm/ADT/DenseSet.h" 00020 #include "llvm/ADT/FoldingSet.h" 00021 #include "llvm/ADT/StringMap.h" 00022 #include "llvm/CodeGen/SelectionDAGNodes.h" 00023 00024 #include <cassert> 00025 #include <vector> 00026 #include <map> 00027 #include <string> 00028 00029 namespace llvm { 00030 00031 class AliasAnalysis; 00032 class TargetLowering; 00033 class TargetMachine; 00034 class MachineModuleInfo; 00035 class MachineFunction; 00036 class MachineConstantPoolValue; 00037 class FunctionLoweringInfo; 00038 00039 template<> struct ilist_traits<SDNode> : public ilist_default_traits<SDNode> { 00040 private: 00041 mutable SDNode Sentinel; 00042 public: 00043 ilist_traits() : Sentinel(ISD::DELETED_NODE, SDVTList()) {} 00044 00045 SDNode *createSentinel() const { 00046 return &Sentinel; 00047 } 00048 static void destroySentinel(SDNode *) {} 00049 00050 static void deleteNode(SDNode *) { 00051 assert(0 && "ilist_traits<SDNode> shouldn't see a deleteNode call!"); 00052 } 00053 private: 00054 static void createNode(const SDNode &); 00055 }; 00056 00057 enum CombineLevel { 00058 Unrestricted, // Combine may create illegal operations and illegal types. 00059 NoIllegalTypes, // Combine may create illegal operations but no illegal types. 00060 NoIllegalOperations // Combine may only create legal operations and types. 00061 }; 00062 00063 /// SelectionDAG class - This is used to represent a portion of an LLVM function 00064 /// in a low-level Data Dependence DAG representation suitable for instruction 00065 /// selection. This DAG is constructed as the first step of instruction 00066 /// selection in order to allow implementation of machine specific optimizations 00067 /// and code simplifications. 00068 /// 00069 /// The representation used by the SelectionDAG is a target-independent 00070 /// representation, which has some similarities to the GCC RTL representation, 00071 /// but is significantly more simple, powerful, and is a graph form instead of a 00072 /// linear form. 00073 /// 00074 class SelectionDAG { 00075 TargetLowering &TLI; 00076 MachineFunction *MF; 00077 FunctionLoweringInfo &FLI; 00078 MachineModuleInfo *MMI; 00079 00080 /// EntryNode - The starting token. 00081 SDNode EntryNode; 00082 00083 /// Root - The root of the entire DAG. 00084 SDValue Root; 00085 00086 /// AllNodes - A linked list of nodes in the current DAG. 00087 ilist<SDNode> AllNodes; 00088 00089 /// NodeAllocatorType - The AllocatorType for allocating SDNodes. We use 00090 /// pool allocation with recycling. 00091 typedef RecyclingAllocator<BumpPtrAllocator, SDNode, sizeof(LargestSDNode), 00092 AlignOf<MostAlignedSDNode>::Alignment> 00093 NodeAllocatorType; 00094 00095 /// NodeAllocator - Pool allocation for nodes. 00096 NodeAllocatorType NodeAllocator; 00097 00098 /// CSEMap - This structure is used to memoize nodes, automatically performing 00099 /// CSE with existing nodes with a duplicate is requested. 00100 FoldingSet<SDNode> CSEMap; 00101 00102 /// OperandAllocator - Pool allocation for machine-opcode SDNode operands. 00103 BumpPtrAllocator OperandAllocator; 00104 00105 /// Allocator - Pool allocation for misc. objects that are created once per 00106 /// SelectionDAG. 00107 BumpPtrAllocator Allocator; 00108 00109 /// VerifyNode - Sanity check the given node. Aborts if it is invalid. 00110 void VerifyNode(SDNode *N); 00111 00112 /// setGraphColorHelper - Implementation of setSubgraphColor. 00113 /// Return whether we had to truncate the search. 00114 /// 00115 bool setSubgraphColorHelper(SDNode *N, const char *Color, DenseSet<SDNode *> &visited, 00116 int level, bool &printed); 00117 00118 public: 00119 SelectionDAG(TargetLowering &tli, FunctionLoweringInfo &fli); 00120 ~SelectionDAG(); 00121 00122 /// init - Prepare this SelectionDAG to process code in the given 00123 /// MachineFunction. 00124 /// 00125 void init(MachineFunction &mf, MachineModuleInfo *mmi); 00126 00127 /// clear - Clear state and free memory necessary to make this 00128 /// SelectionDAG ready to process a new block. 00129 /// 00130 void clear(); 00131 00132 MachineFunction &getMachineFunction() const { return *MF; } 00133 const TargetMachine &getTarget() const; 00134 TargetLowering &getTargetLoweringInfo() const { return TLI; } 00135 FunctionLoweringInfo &getFunctionLoweringInfo() const { return FLI; } 00136 MachineModuleInfo *getMachineModuleInfo() const { return MMI; } 00137 00138 /// viewGraph - Pop up a GraphViz/gv window with the DAG rendered using 'dot'. 00139 /// 00140 void viewGraph(const std::string &Title); 00141 void viewGraph(); 00142 00143 #ifndef NDEBUG 00144 std::map<const SDNode *, std::string> NodeGraphAttrs; 00145 #endif 00146 00147 /// clearGraphAttrs - Clear all previously defined node graph attributes. 00148 /// Intended to be used from a debugging tool (eg. gdb). 00149 void clearGraphAttrs(); 00150 00151 /// setGraphAttrs - Set graph attributes for a node. (eg. "color=red".) 00152 /// 00153 void setGraphAttrs(const SDNode *N, const char *Attrs); 00154 00155 /// getGraphAttrs - Get graph attributes for a node. (eg. "color=red".) 00156 /// Used from getNodeAttributes. 00157 const std::string getGraphAttrs(const SDNode *N) const; 00158 00159 /// setGraphColor - Convenience for setting node color attribute. 00160 /// 00161 void setGraphColor(const SDNode *N, const char *Color); 00162 00163 /// setGraphColor - Convenience for setting subgraph color attribute. 00164 /// 00165 void setSubgraphColor(SDNode *N, const char *Color); 00166 00167 typedef ilist<SDNode>::const_iterator allnodes_const_iterator; 00168 allnodes_const_iterator allnodes_begin() const { return AllNodes.begin(); } 00169 allnodes_const_iterator allnodes_end() const { return AllNodes.end(); } 00170 typedef ilist<SDNode>::iterator allnodes_iterator; 00171 allnodes_iterator allnodes_begin() { return AllNodes.begin(); } 00172 allnodes_iterator allnodes_end() { return AllNodes.end(); } 00173 ilist<SDNode>::size_type allnodes_size() const { 00174 return AllNodes.size(); 00175 } 00176 00177 /// getRoot - Return the root tag of the SelectionDAG. 00178 /// 00179 const SDValue &getRoot() const { return Root; } 00180 00181 /// getEntryNode - Return the token chain corresponding to the entry of the 00182 /// function. 00183 SDValue getEntryNode() const { 00184 return SDValue(const_cast<SDNode *>(&EntryNode), 0); 00185 } 00186 00187 /// setRoot - Set the current root tag of the SelectionDAG. 00188 /// 00189 const SDValue &setRoot(SDValue N) { 00190 assert((!N.getNode() || N.getValueType() == MVT::Other) && 00191 "DAG root value is not a chain!"); 00192 return Root = N; 00193 } 00194 00195 /// Combine - This iterates over the nodes in the SelectionDAG, folding 00196 /// certain types of nodes together, or eliminating superfluous nodes. The 00197 /// Level argument controls whether Combine is allowed to produce nodes and 00198 /// types that are illegal on the target. 00199 void Combine(CombineLevel Level, AliasAnalysis &AA, bool Fast); 00200 00201 /// LegalizeTypes - This transforms the SelectionDAG into a SelectionDAG that 00202 /// only uses types natively supported by the target. Returns "true" if it 00203 /// made any changes. 00204 /// 00205 /// Note that this is an involved process that may invalidate pointers into 00206 /// the graph. 00207 bool LegalizeTypes(); 00208 00209 /// Legalize - This transforms the SelectionDAG into a SelectionDAG that is 00210 /// compatible with the target instruction selector, as indicated by the 00211 /// TargetLowering object. 00212 /// 00213 /// Note that this is an involved process that may invalidate pointers into 00214 /// the graph. 00215 void Legalize(bool TypesNeedLegalizing); 00216 00217 /// RemoveDeadNodes - This method deletes all unreachable nodes in the 00218 /// SelectionDAG. 00219 void RemoveDeadNodes(); 00220 00221 /// DeleteNode - Remove the specified node from the system. This node must 00222 /// have no referrers. 00223 void DeleteNode(SDNode *N); 00224 00225 /// getVTList - Return an SDVTList that represents the list of values 00226 /// specified. 00227 SDVTList getVTList(MVT VT); 00228 SDVTList getVTList(MVT VT1, MVT VT2); 00229 SDVTList getVTList(MVT VT1, MVT VT2, MVT VT3); 00230 SDVTList getVTList(MVT VT1, MVT VT2, MVT VT3, MVT VT4); 00231 SDVTList getVTList(const MVT *VTs, unsigned NumVTs); 00232 00233 /// getNodeValueTypes - These are obsolete, use getVTList instead. 00234 const MVT *getNodeValueTypes(MVT VT) { 00235 return getVTList(VT).VTs; 00236 } 00237 const MVT *getNodeValueTypes(MVT VT1, MVT VT2) { 00238 return getVTList(VT1, VT2).VTs; 00239 } 00240 const MVT *getNodeValueTypes(MVT VT1, MVT VT2, MVT VT3) { 00241 return getVTList(VT1, VT2, VT3).VTs; 00242 } 00243 const MVT *getNodeValueTypes(MVT VT1, MVT VT2, MVT VT3, MVT VT4) { 00244 return getVTList(VT1, VT2, VT3, VT4).VTs; 00245 } 00246 const MVT *getNodeValueTypes(const std::vector<MVT> &vtList) { 00247 return getVTList(&vtList[0], (unsigned)vtList.size()).VTs; 00248 } 00249 00250 00251 //===--------------------------------------------------------------------===// 00252 // Node creation methods. 00253 // 00254 SDValue getConstant(uint64_t Val, MVT VT, bool isTarget = false); 00255 SDValue getConstant(const APInt &Val, MVT VT, bool isTarget = false); 00256 SDValue getConstant(const ConstantInt &Val, MVT VT, bool isTarget = false); 00257 SDValue getIntPtrConstant(uint64_t Val, bool isTarget = false); 00258 SDValue getTargetConstant(uint64_t Val, MVT VT) { 00259 return getConstant(Val, VT, true); 00260 } 00261 SDValue getTargetConstant(const APInt &Val, MVT VT) { 00262 return getConstant(Val, VT, true); 00263 } 00264 SDValue getTargetConstant(const ConstantInt &Val, MVT VT) { 00265 return getConstant(Val, VT, true); 00266 } 00267 SDValue getConstantFP(double Val, MVT VT, bool isTarget = false); 00268 SDValue getConstantFP(const APFloat& Val, MVT VT, bool isTarget = false); 00269 SDValue getConstantFP(const ConstantFP &CF, MVT VT, bool isTarget = false); 00270 SDValue getTargetConstantFP(double Val, MVT VT) { 00271 return getConstantFP(Val, VT, true); 00272 } 00273 SDValue getTargetConstantFP(const APFloat& Val, MVT VT) { 00274 return getConstantFP(Val, VT, true); 00275 } 00276 SDValue getTargetConstantFP(const ConstantFP &Val, MVT VT) { 00277 return getConstantFP(Val, VT, true); 00278 } 00279 SDValue getGlobalAddress(const GlobalValue *GV, MVT VT, 00280 int64_t offset = 0, bool isTargetGA = false); 00281 SDValue getTargetGlobalAddress(const GlobalValue *GV, MVT VT, 00282 int64_t offset = 0) { 00283 return getGlobalAddress(GV, VT, offset, true); 00284 } 00285 SDValue getFrameIndex(int FI, MVT VT, bool isTarget = false); 00286 SDValue getTargetFrameIndex(int FI, MVT VT) { 00287 return getFrameIndex(FI, VT, true); 00288 } 00289 SDValue getJumpTable(int JTI, MVT VT, bool isTarget = false); 00290 SDValue getTargetJumpTable(int JTI, MVT VT) { 00291 return getJumpTable(JTI, VT, true); 00292 } 00293 SDValue getConstantPool(Constant *C, MVT VT, 00294 unsigned Align = 0, int Offs = 0, bool isT=false); 00295 SDValue getTargetConstantPool(Constant *C, MVT VT, 00296 unsigned Align = 0, int Offset = 0) { 00297 return getConstantPool(C, VT, Align, Offset, true); 00298 } 00299 SDValue getConstantPool(MachineConstantPoolValue *C, MVT VT, 00300 unsigned Align = 0, int Offs = 0, bool isT=false); 00301 SDValue getTargetConstantPool(MachineConstantPoolValue *C, 00302 MVT VT, unsigned Align = 0, 00303 int Offset = 0) { 00304 return getConstantPool(C, VT, Align, Offset, true); 00305 } 00306 SDValue getBasicBlock(MachineBasicBlock *MBB); 00307 SDValue getExternalSymbol(const char *Sym, MVT VT); 00308 SDValue getTargetExternalSymbol(const char *Sym, MVT VT); 00309 SDValue getArgFlags(ISD::ArgFlagsTy Flags); 00310 SDValue getValueType(MVT); 00311 SDValue getRegister(unsigned Reg, MVT VT); 00312 SDValue getDbgStopPoint(SDValue Root, unsigned Line, unsigned Col, 00313 const CompileUnitDesc *CU); 00314 SDValue getLabel(unsigned Opcode, SDValue Root, unsigned LabelID); 00315 00316 SDValue getCopyToReg(SDValue Chain, unsigned Reg, SDValue N) { 00317 return getNode(ISD::CopyToReg, MVT::Other, Chain, 00318 getRegister(Reg, N.getValueType()), N); 00319 } 00320 00321 // This version of the getCopyToReg method takes an extra operand, which 00322 // indicates that there is potentially an incoming flag value (if Flag is not 00323 // null) and that there should be a flag result. 00324 SDValue getCopyToReg(SDValue Chain, unsigned Reg, SDValue N, 00325 SDValue Flag) { 00326 const MVT *VTs = getNodeValueTypes(MVT::Other, MVT::Flag); 00327 SDValue Ops[] = { Chain, getRegister(Reg, N.getValueType()), N, Flag }; 00328 return getNode(ISD::CopyToReg, VTs, 2, Ops, Flag.getNode() ? 4 : 3); 00329 } 00330 00331 // Similar to last getCopyToReg() except parameter Reg is a SDValue 00332 SDValue getCopyToReg(SDValue Chain, SDValue Reg, SDValue N, 00333 SDValue Flag) { 00334 const MVT *VTs = getNodeValueTypes(MVT::Other, MVT::Flag); 00335 SDValue Ops[] = { Chain, Reg, N, Flag }; 00336 return getNode(ISD::CopyToReg, VTs, 2, Ops, Flag.getNode() ? 4 : 3); 00337 } 00338 00339 SDValue getCopyFromReg(SDValue Chain, unsigned Reg, MVT VT) { 00340 const MVT *VTs = getNodeValueTypes(VT, MVT::Other); 00341 SDValue Ops[] = { Chain, getRegister(Reg, VT) }; 00342 return getNode(ISD::CopyFromReg, VTs, 2, Ops, 2); 00343 } 00344 00345 // This version of the getCopyFromReg method takes an extra operand, which 00346 // indicates that there is potentially an incoming flag value (if Flag is not 00347 // null) and that there should be a flag result. 00348 SDValue getCopyFromReg(SDValue Chain, unsigned Reg, MVT VT, 00349 SDValue Flag) { 00350 const MVT *VTs = getNodeValueTypes(VT, MVT::Other, MVT::Flag); 00351 SDValue Ops[] = { Chain, getRegister(Reg, VT), Flag }; 00352 return getNode(ISD::CopyFromReg, VTs, 3, Ops, Flag.getNode() ? 3 : 2); 00353 } 00354 00355 SDValue getCondCode(ISD::CondCode Cond); 00356 00357 /// Returns the ConvertRndSat Note: Avoid using this node because it may 00358 /// disappear in the future and most targets don't support it. 00359 SDValue getConvertRndSat(MVT VT, SDValue Val, SDValue DTy, SDValue STy, 00360 SDValue Rnd, SDValue Sat, ISD::CvtCode Code); 00361 00362 /// getZeroExtendInReg - Return the expression required to zero extend the Op 00363 /// value assuming it was the smaller SrcTy value. 00364 SDValue getZeroExtendInReg(SDValue Op, MVT SrcTy); 00365 00366 /// getCALLSEQ_START - Return a new CALLSEQ_START node, which always must have 00367 /// a flag result (to ensure it's not CSE'd). 00368 SDValue getCALLSEQ_START(SDValue Chain, SDValue Op) { 00369 const MVT *VTs = getNodeValueTypes(MVT::Other, MVT::Flag); 00370 SDValue Ops[] = { Chain, Op }; 00371 return getNode(ISD::CALLSEQ_START, VTs, 2, Ops, 2); 00372 } 00373 00374 /// getCALLSEQ_END - Return a new CALLSEQ_END node, which always must have a 00375 /// flag result (to ensure it's not CSE'd). 00376 SDValue getCALLSEQ_END(SDValue Chain, SDValue Op1, SDValue Op2, 00377 SDValue InFlag) { 00378 SDVTList NodeTys = getVTList(MVT::Other, MVT::Flag); 00379 SmallVector<SDValue, 4> Ops; 00380 Ops.push_back(Chain); 00381 Ops.push_back(Op1); 00382 Ops.push_back(Op2); 00383 Ops.push_back(InFlag); 00384 return getNode(ISD::CALLSEQ_END, NodeTys, &Ops[0], 00385 (unsigned)Ops.size() - (InFlag.getNode() == 0 ? 1 : 0)); 00386 } 00387 00388 /// getNode - Gets or creates the specified node. 00389 /// 00390 SDValue getNode(unsigned Opcode, MVT VT); 00391 SDValue getNode(unsigned Opcode, MVT VT, SDValue N); 00392 SDValue getNode(unsigned Opcode, MVT VT, SDValue N1, SDValue N2); 00393 SDValue getNode(unsigned Opcode, MVT VT, 00394 SDValue N1, SDValue N2, SDValue N3); 00395 SDValue getNode(unsigned Opcode, MVT VT, 00396 SDValue N1, SDValue N2, SDValue N3, SDValue N4); 00397 SDValue getNode(unsigned Opcode, MVT VT, 00398 SDValue N1, SDValue N2, SDValue N3, SDValue N4, 00399 SDValue N5); 00400 SDValue getNode(unsigned Opcode, MVT VT, 00401 const SDValue *Ops, unsigned NumOps); 00402 SDValue getNode(unsigned Opcode, MVT VT, 00403 const SDUse *Ops, unsigned NumOps); 00404 SDValue getNode(unsigned Opcode, const std::vector<MVT> &ResultTys, 00405 const SDValue *Ops, unsigned NumOps); 00406 SDValue getNode(unsigned Opcode, const MVT *VTs, unsigned NumVTs, 00407 const SDValue *Ops, unsigned NumOps); 00408 SDValue getNode(unsigned Opcode, SDVTList VTs); 00409 SDValue getNode(unsigned Opcode, SDVTList VTs, SDValue N); 00410 SDValue getNode(unsigned Opcode, SDVTList VTs, SDValue N1, SDValue N2); 00411 SDValue getNode(unsigned Opcode, SDVTList VTs, 00412 SDValue N1, SDValue N2, SDValue N3); 00413 SDValue getNode(unsigned Opcode, SDVTList VTs, 00414 SDValue N1, SDValue N2, SDValue N3, SDValue N4); 00415 SDValue getNode(unsigned Opcode, SDVTList VTs, 00416 SDValue N1, SDValue N2, SDValue N3, SDValue N4, 00417 SDValue N5); 00418 SDValue getNode(unsigned Opcode, SDVTList VTs, 00419 const SDValue *Ops, unsigned NumOps); 00420 00421 SDValue getMemcpy(SDValue Chain, SDValue Dst, SDValue Src, 00422 SDValue Size, unsigned Align, bool AlwaysInline, 00423 const Value *DstSV, uint64_t DstSVOff, 00424 const Value *SrcSV, uint64_t SrcSVOff); 00425 00426 SDValue getMemmove(SDValue Chain, SDValue Dst, SDValue Src, 00427 SDValue Size, unsigned Align, 00428 const Value *DstSV, uint64_t DstOSVff, 00429 const Value *SrcSV, uint64_t SrcSVOff); 00430 00431 SDValue getMemset(SDValue Chain, SDValue Dst, SDValue Src, 00432 SDValue Size, unsigned Align, 00433 const Value *DstSV, uint64_t DstSVOff); 00434 00435 /// getSetCC - Helper function to make it easier to build SetCC's if you just 00436 /// have an ISD::CondCode instead of an SDValue. 00437 /// 00438 SDValue getSetCC(MVT VT, SDValue LHS, SDValue RHS, 00439 ISD::CondCode Cond) { 00440 return getNode(ISD::SETCC, VT, LHS, RHS, getCondCode(Cond)); 00441 } 00442 00443 /// getVSetCC - Helper function to make it easier to build VSetCC's nodes 00444 /// if you just have an ISD::CondCode instead of an SDValue. 00445 /// 00446 SDValue getVSetCC(MVT VT, SDValue LHS, SDValue RHS, 00447 ISD::CondCode Cond) { 00448 return getNode(ISD::VSETCC, VT, LHS, RHS, getCondCode(Cond)); 00449 } 00450 00451 /// getSelectCC - Helper function to make it easier to build SelectCC's if you 00452 /// just have an ISD::CondCode instead of an SDValue. 00453 /// 00454 SDValue getSelectCC(SDValue LHS, SDValue RHS, 00455 SDValue True, SDValue False, ISD::CondCode Cond) { 00456 return getNode(ISD::SELECT_CC, True.getValueType(), LHS, RHS, True, False, 00457 getCondCode(Cond)); 00458 } 00459 00460 /// getVAArg - VAArg produces a result and token chain, and takes a pointer 00461 /// and a source value as input. 00462 SDValue getVAArg(MVT VT, SDValue Chain, SDValue Ptr, 00463 SDValue SV); 00464 00465 /// getAtomic - Gets a node for an atomic op, produces result and chain and 00466 /// takes 3 operands 00467 SDValue getAtomic(unsigned Opcode, MVT MemVT, SDValue Chain, SDValue Ptr, 00468 SDValue Cmp, SDValue Swp, const Value* PtrVal, 00469 unsigned Alignment=0); 00470 00471 /// getAtomic - Gets a node for an atomic op, produces result and chain and 00472 /// takes 2 operands. 00473 SDValue getAtomic(unsigned Opcode, MVT MemVT, SDValue Chain, SDValue Ptr, 00474 SDValue Val, const Value* PtrVal, 00475 unsigned Alignment = 0); 00476 00477 /// getMemIntrinsicNode - Creates a MemIntrinsicNode that may produce a 00478 /// result and takes a list of operands. 00479 SDValue getMemIntrinsicNode(unsigned Opcode, 00480 const MVT *VTs, unsigned NumVTs, 00481 const SDValue *Ops, unsigned NumOps, 00482 MVT MemVT, const Value *srcValue, int SVOff, 00483 unsigned Align = 0, bool Vol = false, 00484 bool ReadMem = true, bool WriteMem = true); 00485 00486 SDValue getMemIntrinsicNode(unsigned Opcode, SDVTList VTList, 00487 const SDValue *Ops, unsigned NumOps, 00488 MVT MemVT, const Value *srcValue, int SVOff, 00489 unsigned Align = 0, bool Vol = false, 00490 bool ReadMem = true, bool WriteMem = true); 00491 00492 /// getMergeValues - Create a MERGE_VALUES node from the given operands. 00493 SDValue getMergeValues(const SDValue *Ops, unsigned NumOps); 00494 00495 /// getCall - Create a CALL node from the given information. 00496 /// 00497 SDValue getCall(unsigned CallingConv, bool IsVarArgs, bool IsTailCall, 00498 bool isInreg, SDVTList VTs, const SDValue *Operands, 00499 unsigned NumOperands); 00500 00501 /// getLoad - Loads are not normal binary operators: their result type is not 00502 /// determined by their operands, and they produce a value AND a token chain. 00503 /// 00504 SDValue getLoad(MVT VT, SDValue Chain, SDValue Ptr, 00505 const Value *SV, int SVOffset, bool isVolatile=false, 00506 unsigned Alignment=0); 00507 SDValue getExtLoad(ISD::LoadExtType ExtType, MVT VT, 00508 SDValue Chain, SDValue Ptr, const Value *SV, 00509 int SVOffset, MVT EVT, bool isVolatile=false, 00510 unsigned Alignment=0); 00511 SDValue getIndexedLoad(SDValue OrigLoad, SDValue Base, 00512 SDValue Offset, ISD::MemIndexedMode AM); 00513 SDValue getLoad(ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, 00514 MVT VT, SDValue Chain, 00515 SDValue Ptr, SDValue Offset, 00516 const Value *SV, int SVOffset, MVT EVT, 00517 bool isVolatile=false, unsigned Alignment=0); 00518 00519 /// getStore - Helper function to build ISD::STORE nodes. 00520 /// 00521 SDValue getStore(SDValue Chain, SDValue Val, SDValue Ptr, 00522 const Value *SV, int SVOffset, bool isVolatile=false, 00523 unsigned Alignment=0); 00524 SDValue getTruncStore(SDValue Chain, SDValue Val, SDValue Ptr, 00525 const Value *SV, int SVOffset, MVT TVT, 00526 bool isVolatile=false, unsigned Alignment=0); 00527 SDValue getIndexedStore(SDValue OrigStoe, SDValue Base, 00528 SDValue Offset, ISD::MemIndexedMode AM); 00529 00530 // getSrcValue - Construct a node to track a Value* through the backend. 00531 SDValue getSrcValue(const Value *v); 00532 00533 // getMemOperand - Construct a node to track a memory reference 00534 // through the backend. 00535 SDValue getMemOperand(const MachineMemOperand &MO); 00536 00537 /// UpdateNodeOperands - *Mutate* the specified node in-place to have the 00538 /// specified operands. If the resultant node already exists in the DAG, 00539 /// this does not modify the specified node, instead it returns the node that 00540 /// already exists. If the resultant node does not exist in the DAG, the 00541 /// input node is returned. As a degenerate case, if you specify the same 00542 /// input operands as the node already has, the input node is returned. 00543 SDValue UpdateNodeOperands(SDValue N, SDValue Op); 00544 SDValue UpdateNodeOperands(SDValue N, SDValue Op1, SDValue Op2); 00545 SDValue UpdateNodeOperands(SDValue N, SDValue Op1, SDValue Op2, 00546 SDValue Op3); 00547 SDValue UpdateNodeOperands(SDValue N, SDValue Op1, SDValue Op2, 00548 SDValue Op3, SDValue Op4); 00549 SDValue UpdateNodeOperands(SDValue N, SDValue Op1, SDValue Op2, 00550 SDValue Op3, SDValue Op4, SDValue Op5); 00551 SDValue UpdateNodeOperands(SDValue N, 00552 const SDValue *Ops, unsigned NumOps); 00553 00554 /// SelectNodeTo - These are used for target selectors to *mutate* the 00555 /// specified node to have the specified return type, Target opcode, and 00556 /// operands. Note that target opcodes are stored as 00557 /// ~TargetOpcode in the node opcode field. The resultant node is returned. 00558 SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT); 00559 SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT, SDValue Op1); 00560 SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT, 00561 SDValue Op1, SDValue Op2); 00562 SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT, 00563 SDValue Op1, SDValue Op2, SDValue Op3); 00564 SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT, 00565 const SDValue *Ops, unsigned NumOps); 00566 SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1, MVT VT2); 00567 SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1, 00568 MVT VT2, const SDValue *Ops, unsigned NumOps); 00569 SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1, 00570 MVT VT2, MVT VT3, const SDValue *Ops, unsigned NumOps); 00571 SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, MVT VT1, 00572 MVT VT2, MVT VT3, MVT VT4, const SDValue *Ops, 00573 unsigned NumOps); 00574 SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1, 00575 MVT VT2, SDValue Op1); 00576 SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1, 00577 MVT VT2, SDValue Op1, SDValue Op2); 00578 SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1, 00579 MVT VT2, SDValue Op1, SDValue Op2, SDValue Op3); 00580 SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1, 00581 MVT VT2, MVT VT3, SDValue Op1, SDValue Op2, SDValue Op3); 00582 SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, SDVTList VTs, 00583 const SDValue *Ops, unsigned NumOps); 00584 00585 /// MorphNodeTo - These *mutate* the specified node to have the specified 00586 /// return type, opcode, and operands. 00587 SDNode *MorphNodeTo(SDNode *N, unsigned Opc, MVT VT); 00588 SDNode *MorphNodeTo(SDNode *N, unsigned Opc, MVT VT, SDValue Op1); 00589 SDNode *MorphNodeTo(SDNode *N, unsigned Opc, MVT VT, 00590 SDValue Op1, SDValue Op2); 00591 SDNode *MorphNodeTo(SDNode *N, unsigned Opc, MVT VT, 00592 SDValue Op1, SDValue Op2, SDValue Op3); 00593 SDNode *MorphNodeTo(SDNode *N, unsigned Opc, MVT VT, 00594 const