LLVM API Documentation
00001 //===-- X86ISelLowering.h - X86 DAG Lowering Interface ----------*- 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 defines the interfaces that X86 uses to lower LLVM code into a 00011 // selection DAG. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 #ifndef X86ISELLOWERING_H 00016 #define X86ISELLOWERING_H 00017 00018 #include "X86Subtarget.h" 00019 #include "X86RegisterInfo.h" 00020 #include "X86MachineFunctionInfo.h" 00021 #include "llvm/Target/TargetLowering.h" 00022 #include "llvm/CodeGen/FastISel.h" 00023 #include "llvm/CodeGen/SelectionDAG.h" 00024 #include "llvm/CodeGen/CallingConvLower.h" 00025 00026 namespace llvm { 00027 namespace X86ISD { 00028 // X86 Specific DAG Nodes 00029 enum NodeType { 00030 // Start the numbering where the builtin ops leave off. 00031 FIRST_NUMBER = ISD::BUILTIN_OP_END, 00032 00033 /// BSF - Bit scan forward. 00034 /// BSR - Bit scan reverse. 00035 BSF, 00036 BSR, 00037 00038 /// SHLD, SHRD - Double shift instructions. These correspond to 00039 /// X86::SHLDxx and X86::SHRDxx instructions. 00040 SHLD, 00041 SHRD, 00042 00043 /// FAND - Bitwise logical AND of floating point values. This corresponds 00044 /// to X86::ANDPS or X86::ANDPD. 00045 FAND, 00046 00047 /// FOR - Bitwise logical OR of floating point values. This corresponds 00048 /// to X86::ORPS or X86::ORPD. 00049 FOR, 00050 00051 /// FXOR - Bitwise logical XOR of floating point values. This corresponds 00052 /// to X86::XORPS or X86::XORPD. 00053 FXOR, 00054 00055 /// FSRL - Bitwise logical right shift of floating point values. These 00056 /// corresponds to X86::PSRLDQ. 00057 FSRL, 00058 00059 /// FILD, FILD_FLAG - This instruction implements SINT_TO_FP with the 00060 /// integer source in memory and FP reg result. This corresponds to the 00061 /// X86::FILD*m instructions. It has three inputs (token chain, address, 00062 /// and source type) and two outputs (FP value and token chain). FILD_FLAG 00063 /// also produces a flag). 00064 FILD, 00065 FILD_FLAG, 00066 00067 /// FP_TO_INT*_IN_MEM - This instruction implements FP_TO_SINT with the 00068 /// integer destination in memory and a FP reg source. This corresponds 00069 /// to the X86::FIST*m instructions and the rounding mode change stuff. It 00070 /// has two inputs (token chain and address) and two outputs (int value 00071 /// and token chain). 00072 FP_TO_INT16_IN_MEM, 00073 FP_TO_INT32_IN_MEM, 00074 FP_TO_INT64_IN_MEM, 00075 00076 /// FLD - This instruction implements an extending load to FP stack slots. 00077 /// This corresponds to the X86::FLD32m / X86::FLD64m. It takes a chain 00078 /// operand, ptr to load from, and a ValueType node indicating the type 00079 /// to load to. 00080 FLD, 00081 00082 /// FST - This instruction implements a truncating store to FP stack 00083 /// slots. This corresponds to the X86::FST32m / X86::FST64m. It takes a 00084 /// chain operand, value to store, address, and a ValueType to store it 00085 /// as. 00086 FST, 00087 00088 /// CALL/TAILCALL - These operations represent an abstract X86 call 00089 /// instruction, which includes a bunch of information. In particular the 00090 /// operands of these node are: 00091 /// 00092 /// #0 - The incoming token chain 00093 /// #1 - The callee 00094 /// #2 - The number of arg bytes the caller pushes on the stack. 00095 /// #3 - The number of arg bytes the callee pops off the stack. 00096 /// #4 - The value to pass in AL/AX/EAX (optional) 00097 /// #5 - The value to pass in DL/DX/EDX (optional) 00098 /// 00099 /// The result values of these nodes are: 00100 /// 00101 /// #0 - The outgoing token chain 00102 /// #1 - The first register result value (optional) 00103 /// #2 - The second register result value (optional) 00104 /// 00105 /// The CALL vs TAILCALL distinction boils down to whether the callee is 00106 /// known not to modify the caller's stack frame, as is standard with 00107 /// LLVM. 00108 CALL, 00109 TAILCALL, 00110 00111 /// RDTSC_DAG - This operation implements the lowering for 00112 /// readcyclecounter 00113 RDTSC_DAG, 00114 00115 /// X86 compare and logical compare instructions. 00116 CMP, COMI, UCOMI, 00117 00118 /// X86 bit-test instructions. 00119 BT, 00120 00121 /// X86 SetCC. Operand 1 is condition code, and operand 2 is the flag 00122 /// operand produced by a CMP instruction. 00123 SETCC, 00124 00125 /// X86 conditional moves. Operand 1 and operand 2 are the two values 00126 /// to select from (operand 1 is a R/W operand). Operand 3 is the 00127 /// condition code, and operand 4 is the flag operand produced by a CMP 00128 /// or TEST instruction. It also writes a flag result. 00129 CMOV, 00130 00131 /// X86 conditional branches. Operand 1 is the chain operand, operand 2 00132 /// is the block to branch if condition is true, operand 3 is the 00133 /// condition code, and operand 4 is the flag operand produced by a CMP 00134 /// or TEST instruction. 00135 BRCOND, 00136 00137 /// Return with a flag operand. Operand 1 is the chain operand, operand 00138 /// 2 is the number of bytes of stack to pop. 00139 RET_FLAG, 00140 00141 /// REP_STOS - Repeat fill, corresponds to X86::REP_STOSx. 00142 REP_STOS, 00143 00144 /// REP_MOVS - Repeat move, corresponds to X86::REP_MOVSx. 00145 REP_MOVS, 00146 00147 /// GlobalBaseReg - On Darwin, this node represents the result of the popl 00148 /// at function entry, used for PIC code. 00149 GlobalBaseReg, 00150 00151 /// Wrapper - A wrapper node for TargetConstantPool, 00152 /// TargetExternalSymbol, and TargetGlobalAddress. 00153 Wrapper, 00154 00155 /// WrapperRIP - Special wrapper used under X86-64 PIC mode for RIP 00156 /// relative displacements. 00157 WrapperRIP, 00158 00159 /// PEXTRB - Extract an 8-bit value from a vector and zero extend it to 00160 /// i32, corresponds to X86::PEXTRB. 00161 PEXTRB, 00162 00163 /// PEXTRW - Extract a 16-bit value from a vector and zero extend it to 00164 /// i32, corresponds to X86::PEXTRW. 00165 PEXTRW, 00166 00167 /// INSERTPS - Insert any element of a 4 x float vector into any element 00168 /// of a destination 4 x floatvector. 00169 INSERTPS, 00170 00171 /// PINSRB - Insert the lower 8-bits of a 32-bit value to a vector, 00172 /// corresponds to X86::PINSRB. 00173 PINSRB, 00174 00175 /// PINSRW - Insert the lower 16-bits of a 32-bit value to a vector, 00176 /// corresponds to X86::PINSRW. 00177 PINSRW, 00178 00179 /// FMAX, FMIN - Floating point max and min. 00180 /// 00181 FMAX, FMIN, 00182 00183 /// FRSQRT, FRCP - Floating point reciprocal-sqrt and reciprocal 00184 /// approximation. Note that these typically require refinement 00185 /// in order to obtain suitable precision. 00186 FRSQRT, FRCP, 00187 00188 // TLSADDR, THREAThread - Thread Local Storage. 00189 TLSADDR, THREAD_POINTER, 00190 00191 // EH_RETURN - Exception Handling helpers. 00192 EH_RETURN, 00193 00194 /// TC_RETURN - Tail call return. 00195 /// operand #0 chain 00196 /// operand #1 callee (register or absolute) 00197 /// operand #2 stack adjustment 00198 /// operand #3 optional in flag 00199 TC_RETURN, 00200 00201 // LCMPXCHG_DAG, LCMPXCHG8_DAG - Compare and swap. 00202 LCMPXCHG_DAG, 00203 LCMPXCHG8_DAG, 00204 00205 // ATOMADD64_DAG, ATOMSUB64_DAG, ATOMOR64_DAG, ATOMAND64_DAG, 00206 // ATOMXOR64_DAG, ATOMNAND64_DAG, ATOMSWAP64_DAG - 00207 // Atomic 64-bit binary operations. 00208 ATOMADD64_DAG, 00209 ATOMSUB64_DAG, 00210 ATOMOR64_DAG, 00211 ATOMXOR64_DAG, 00212 ATOMAND64_DAG, 00213 ATOMNAND64_DAG, 00214 ATOMSWAP64_DAG, 00215 00216 // FNSTCW16m - Store FP control world into i16 memory. 00217 FNSTCW16m, 00218 00219 // VZEXT_MOVL - Vector move low and zero extend. 00220 VZEXT_MOVL, 00221 00222 // VZEXT_LOAD - Load, scalar_to_vector, and zero extend. 00223 VZEXT_LOAD, 00224 00225 // VSHL, VSRL - Vector logical left / right shift. 00226 VSHL, VSRL, 00227 00228 // CMPPD, CMPPS - Vector double/float comparison. 00229 CMPPD, CMPPS, 00230 00231 // PCMP* - Vector integer comparisons. 00232 PCMPEQB, PCMPEQW, PCMPEQD, PCMPEQQ, 00233 PCMPGTB, PCMPGTW, PCMPGTD, PCMPGTQ, 00234 00235 // ADD, SUB, SMUL, UMUL - Arithmetic operations with overflow/carry 00236 // intrinsics. 00237 ADD, SUB, SMUL, UMUL 00238 }; 00239 } 00240 00241 /// Define some predicates that are used for node matching. 00242 namespace X86 { 00243 /// isPSHUFDMask - Return true if the specified VECTOR_SHUFFLE operand 00244 /// specifies a shuffle of elements that is suitable for input to PSHUFD. 00245 bool isPSHUFDMask(SDNode *N); 00246 00247 /// isPSHUFHWMask - Return true if the specified VECTOR_SHUFFLE operand 00248 /// specifies a shuffle of elements that is suitable for input to PSHUFD. 00249 bool isPSHUFHWMask(SDNode *N); 00250 00251 /// isPSHUFLWMask - Return true if the specified VECTOR_SHUFFLE operand 00252 /// specifies a shuffle of elements that is suitable for input to PSHUFD. 00253 bool isPSHUFLWMask(SDNode *N); 00254 00255 /// isSHUFPMask - Return true if the specified VECTOR_SHUFFLE operand 00256 /// specifies a shuffle of elements that is suitable for input to SHUFP*. 00257 bool isSHUFPMask(SDNode *N); 00258 00259 /// isMOVHLPSMask - Return true if the specified VECTOR_SHUFFLE operand 00260 /// specifies a shuffle of elements that is suitable for input to MOVHLPS. 00261 bool isMOVHLPSMask(SDNode *N); 00262 00263 /// isMOVHLPS_v_undef_Mask - Special case of isMOVHLPSMask for canonical form 00264 /// of vector_shuffle v, v, <2, 3, 2, 3>, i.e. vector_shuffle v, undef, 00265 /// <2, 3, 2, 3> 00266 bool isMOVHLPS_v_undef_Mask(SDNode *N); 00267 00268 /// isMOVLPMask - Return true if the specified VECTOR_SHUFFLE operand 00269 /// specifies a shuffle of elements that is suitable for input to MOVLP{S|D}. 00270 bool isMOVLPMask(SDNode *N); 00271 00272 /// isMOVHPMask - Return true if the specified VECTOR_SHUFFLE operand 00273 /// specifies a shuffle of elements that is suitable for input to MOVHP{S|D} 00274 /// as well as MOVLHPS. 00275 bool isMOVHPMask(SDNode *N); 00276 00277 /// isUNPCKLMask - Return true if the specified VECTOR_SHUFFLE operand 00278 /// specifies a shuffle of elements that is suitable for input to UNPCKL. 00279 bool isUNPCKLMask(SDNode *N, bool V2IsSplat = false); 00280 00281 /// isUNPCKHMask - Return true if the specified VECTOR_SHUFFLE operand 00282 /// specifies a shuffle of elements that is suitable for input to UNPCKH. 00283 bool isUNPCKHMask(SDNode *N, bool V2IsSplat = false); 00284 00285 /// isUNPCKL_v_undef_Mask - Special case of isUNPCKLMask for canonical form 00286 /// of vector_shuffle v, v, <0, 4, 1, 5>, i.e. vector_shuffle v, undef, 00287 /// <0, 0, 1, 1> 00288 bool isUNPCKL_v_undef_Mask(SDNode *N); 00289 00290 /// isUNPCKH_v_undef_Mask - Special case of isUNPCKHMask for canonical form 00291 /// of vector_shuffle v, v, <2, 6, 3, 7>, i.e. vector_shuffle v, undef, 00292 /// <2, 2, 3, 3> 00293 bool isUNPCKH_v_undef_Mask(SDNode *N); 00294 00295 /// isMOVLMask - Return true if the specified VECTOR_SHUFFLE operand 00296 /// specifies a shuffle of elements that is suitable for input to MOVSS, 00297 /// MOVSD, and MOVD, i.e. setting the lowest element. 00298 bool isMOVLMask(SDNode *N); 00299 00300 /// isMOVSHDUPMask - Return true if the specified VECTOR_SHUFFLE operand 00301 /// specifies a shuffle of elements that is suitable for input to MOVSHDUP. 00302 bool isMOVSHDUPMask(SDNode *N); 00303 00304 /// isMOVSLDUPMask - Return true if the specified VECTOR_SHUFFLE operand 00305 /// specifies a shuffle of elements that is suitable for input to MOVSLDUP. 00306 bool isMOVSLDUPMask(SDNode *N); 00307 00308 /// isSplatMask - Return true if the specified VECTOR_SHUFFLE operand 00309 /// specifies a splat of a single element. 00310 bool isSplatMask(SDNode *N); 00311 00312 /// isSplatLoMask - Return true if the specified VECTOR_SHUFFLE operand 00313 /// specifies a splat of zero element. 00314 bool isSplatLoMask(SDNode *N); 00315 00316 /// isMOVDDUPMask - Return true if the specified VECTOR_SHUFFLE operand 00317 /// specifies a shuffle of elements that is suitable for input to MOVDDUP. 00318 bool isMOVDDUPMask(SDNode *N); 00319 00320 /// getShuffleSHUFImmediate - Return the appropriate immediate to shuffle 00321 /// the specified isShuffleMask VECTOR_SHUFFLE mask with PSHUF* and SHUFP* 00322 /// instructions. 00323 unsigned getShuffleSHUFImmediate(SDNode *N); 00324 00325 /// getShufflePSHUFHWImmediate - Return the appropriate immediate to shuffle 00326 /// the specified isShuffleMask VECTOR_SHUFFLE mask with PSHUFHW 00327 /// instructions. 00328 unsigned getShufflePSHUFHWImmediate(SDNode *N); 00329 00330 /// getShufflePSHUFKWImmediate - Return the appropriate immediate to shuffle 00331 /// the specified isShuffleMask VECTOR_SHUFFLE mask with PSHUFLW 00332 /// instructions. 00333 unsigned getShufflePSHUFLWImmediate(SDNode *N); 00334 } 00335 00336 //===--------------------------------------------------------------------===// 00337 // X86TargetLowering - X86 Implementation of the TargetLowering interface 00338 class X86TargetLowering : public TargetLowering { 00339 int VarArgsFrameIndex; // FrameIndex for start of varargs area. 00340 int RegSaveFrameIndex; // X86-64 vararg func register save area. 00341 unsigned VarArgsGPOffset; // X86-64 vararg func int reg offset. 00342 unsigned VarArgsFPOffset; // X86-64 vararg func fp reg offset. 00343 int BytesToPopOnReturn; // Number of arg bytes ret should pop. 00344 int BytesCallerReserves; // Number of arg bytes caller makes. 00345 00346 public: 00347 explicit X86TargetLowering(X86TargetMachine &TM); 00348 00349 /// getPICJumpTableRelocaBase - Returns relocation base for the given PIC 00350 /// jumptable. 00351 SDValue getPICJumpTableRelocBase(SDValue Table, 00352 SelectionDAG &DAG) const; 00353 00354 // Return the number of bytes that a function should pop when it returns (in 00355 // addition to the space used by the return address). 00356 // 00357 unsigned getBytesToPopOnReturn() const { return BytesToPopOnReturn; } 00358 00359 // Return the number of bytes that the caller reserves for arguments passed 00360 // to this function. 00361 unsigned getBytesCallerReserves() const { return BytesCallerReserves; } 00362 00363 /// getStackPtrReg - Return the stack pointer register we are using: either 00364 /// ESP or RSP. 00365 unsigned getStackPtrReg() const { return X86StackPtr; } 00366 00367 /// getByValTypeAlignment - Return the desired alignment for ByVal aggregate 00368 /// function arguments in the caller parameter area. For X86, aggregates 00369 /// that contains are placed at 16-byte boundaries while the rest are at 00370 /// 4-byte boundaries. 00371 virtual unsigned getByValTypeAlignment(const Type *Ty) const; 00372 00373 /// getOptimalMemOpType - Returns the target specific optimal type for load 00374 /// and store operations as a result of memset, memcpy, and memmove 00375 /// lowering. It returns MVT::iAny if SelectionDAG should be responsible for 00376 /// determining it. 00377 virtual 00378 MVT getOptimalMemOpType(uint64_t Size, unsigned Align, 00379 bool isSrcConst, bool isSrcStr) const; 00380 00381 /// LowerOperation - Provide custom lowering hooks for some operations. 00382 /// 00383 virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG); 00384 00385 /// ReplaceNodeResults - Replace the results of node with an illegal result 00386 /// type with new values built out of custom code. 00387 /// 00388 virtual void ReplaceNodeResults(SDNode *N, SmallVectorImpl<SDValue>&Results, 00389 SelectionDAG &DAG); 00390 00391 00392 virtual SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const; 00393 00394 virtual MachineBasicBlock *EmitInstrWithCustomInserter(MachineInstr *MI, 00395 MachineBasicBlock *MBB); 00396 00397 00398 /// getTargetNodeName - This method returns the name of a target specific 00399 /// DAG node. 00400 virtual const char *getTargetNodeName(unsigned Opcode) const; 00401 00402 /// getSetCCResultType - Return the ISD::SETCC ValueType 00403 virtual MVT getSetCCResultType(MVT VT) const; 00404 00405 /// computeMaskedBitsForTargetNode - Determine which of the bits specified 00406 /// in Mask are known to be either zero or one and return them in the 00407 /// KnownZero/KnownOne bitsets. 00408 virtual void computeMaskedBitsForTargetNode(const SDValue Op, 00409 const APInt &Mask, 00410 APInt &KnownZero, 00411 APInt &KnownOne, 00412 const SelectionDAG &DAG, 00413 unsigned Depth = 0) const; 00414 00415 virtual bool 00416 isGAPlusOffset(SDNode *N, GlobalValue* &GA, int64_t &Offset) const; 00417 00418 SDValue getReturnAddressFrameIndex(SelectionDAG &DAG); 00419 00420 ConstraintType getConstraintType(const std::string &Constraint) const; 00421 00422 std::vector<unsigned> 00423 getRegClassForInlineAsmConstraint(const std::string &Constraint, 00424 MVT VT) const; 00425 00426 virtual const char *LowerXConstraint(MVT ConstraintVT) const; 00427 00428 /// LowerAsmOperandForConstraint - Lower the specified operand into the Ops 00429 /// vector. If it is invalid, don't add anything to Ops. If hasMemory is 00430 /// true it means one of the asm constraint of the inline asm instruction 00431 /// being processed is 'm'. 00432 virtual void LowerAsmOperandForConstraint(SDValue Op, 00433 char ConstraintLetter, 00434 bool hasMemory, 00435 std::vector<SDValue> &Ops, 00436 SelectionDAG &DAG) const; 00437 00438 /// getRegForInlineAsmConstraint - Given a physical register constraint 00439 /// (e.g. {edx}), return the register number and the register class for the 00440 /// register. This should only be used for C_Register constraints. On 00441 /// error, this returns a register number of 0. 00442 std::pair<unsigned, const TargetRegisterClass*> 00443 getRegForInlineAsmConstraint(const std::string &Constraint, 00444 MVT VT) const; 00445 00446 /// isLegalAddressingMode - Return true if the addressing mode represented 00447 /// by AM is legal for this target, for a load/store of the specified type. 00448 virtual bool isLegalAddressingMode(const AddrMode &AM, const Type *Ty)const; 00449 00450 /// isTruncateFree - Return true if it's free to truncate a value of 00451 /// type Ty1 to type Ty2. e.g. On x86 it's free to truncate a i32 value in 00452 /// register EAX to i16 by referencing its sub-register AX. 00453 virtual bool isTruncateFree(const Type *Ty1, const Type *Ty2) const; 00454 virtual bool isTruncateFree(MVT VT1, MVT VT2) const; 00455 00456 /// isShuffleMaskLegal - Targets can use this to indicate that they only 00457 /// support *some* VECTOR_SHUFFLE operations, those with specific masks. 00458 /// By default, if a target supports the VECTOR_SHUFFLE node, all mask 00459 /// values are assumed to be legal. 00460 virtual bool isShuffleMaskLegal(SDValue Mask, MVT VT) const; 00461 00462 /// isVectorClearMaskLegal - Similar to isShuffleMaskLegal. This is 00463 /// used by Targets can use this to indicate if there is a suitable 00464 /// VECTOR_SHUFFLE that can be used to replace a VAND with a constant 00465 /// pool entry. 00466 virtual bool isVectorClearMaskLegal(const std::vector<SDValue> &BVOps, 00467 MVT EVT, SelectionDAG &DAG) const; 00468 00469 /// ShouldShrinkFPConstant - If true, then instruction selection should 00470 /// seek to shrink the FP constant of the specified type to a smaller type 00471 /// in order to save space and / or reduce runtime. 00472 virtual bool ShouldShrinkFPConstant(MVT VT) const { 00473 // Don't shrink FP constpool if SSE2 is available since cvtss2sd is more 00474 // expensive than a straight movsd. On the other hand, it's important to 00475 // shrink long double fp constant since fldt is very slow. 00476 return !X86ScalarSSEf64 || VT == MVT::f80; 00477 } 00478 00479 /// IsEligibleForTailCallOptimization - Check whether the call is eligible 00480 /// for tail call optimization. Target which want to do tail call 00481 /// optimization should implement this function. 00482 virtual bool IsEligibleForTailCallOptimization(CallSDNode *TheCall, 00483 SDValue Ret, 00484 SelectionDAG &DAG) const; 00485 00486 virtual const X86Subtarget* getSubtarget() { 00487 return Subtarget; 00488 } 00489 00490 /// isScalarFPTypeInSSEReg - Return true if the specified scalar FP type is 00491 /// computed in an SSE register, not on the X87 floating point stack. 00492 bool isScalarFPTypeInSSEReg(MVT VT) const { 00493 return (VT == MVT::f64 && X86ScalarSSEf64) || // f64 is when SSE2 00494 (VT == MVT::f32 && X86ScalarSSEf32); // f32 is when SSE1 00495 } 00496 00497 /// getWidenVectorType: given a vector type, returns the type to widen 00498 /// to (e.g., v7i8 to v8i8). If the vector type is legal, it returns itself. 00499 /// If there is no vector type that we want to widen to, returns MVT::Other 00500 /// When and were to widen is target dependent based on the cost of 00501 /// scalarizing vs using the wider vector type. 00502 virtual MVT getWidenVectorType(MVT VT); 00503 00504 /// createFastISel - This method returns a target specific FastISel object, 00505 /// or null if the target does not support "fast" ISel. 00506 virtual FastISel * 00507 createFastISel(MachineFunction &mf, 00508 MachineModuleInfo *mmi, 00509 DenseMap<const Value *, unsigned> &, 00510 DenseMap<const BasicBlock *, MachineBasicBlock *> &, 00511 DenseMap<const AllocaInst *, int> & 00512 #ifndef NDEBUG 00513 , SmallSet<Instruction*, 8> & 00514 #endif 00515 ); 00516 00517 private: 00518 /// Subtarget - Keep a pointer to the X86Subtarget around so that we can 00519 /// make the right decision when generating code for different targets. 00520 const X86Subtarget *Subtarget; 00521 const X86RegisterInfo *RegInfo; 00522 const TargetData *TD; 00523 00524 /// X86StackPtr - X86 physical register used as stack ptr. 00525 unsigned X86StackPtr; 00526 00527 /// X86ScalarSSEf32, X86ScalarSSEf64 - Select between SSE or x87 00528 /// floating point ops. 00529 /// When SSE is available, use it for f32 operations. 00530 /// When SSE2 is available, use it for f64 operations. 00531 bool X86ScalarSSEf32; 00532 bool X86ScalarSSEf64; 00533 00534 SDNode *LowerCallResult(SDValue Chain, SDValue InFlag, CallSDNode *TheCall, 00535 unsigned CallingConv, SelectionDAG &DAG); 00536 00537 SDValue LowerMemArgument(SDValue Op, SelectionDAG &DAG, 00538 const CCValAssign &VA, MachineFrameInfo *MFI, 00539 unsigned CC, SDValue Root, unsigned i); 00540 00541 SDValue LowerMemOpCallTo(CallSDNode *TheCall, SelectionDAG &DAG, 00542 const SDValue &StackPtr, 00543 const CCValAssign &VA, SDValue Chain, 00544 SDValue Arg, ISD::ArgFlagsTy Flags); 00545 00546 // Call lowering helpers. 00547 bool IsCalleePop(bool isVarArg, unsigned CallingConv); 00548 bool CallRequiresGOTPtrInReg(bool Is64Bit, bool IsTailCall); 00549 bool CallRequiresFnAddressInReg(bool Is64Bit, bool IsTailCall); 00550 SDValue EmitTailCallLoadRetAddr(SelectionDAG &DAG, SDValue &OutRetAddr, 00551 SDValue Chain, bool IsTailCall, bool Is64Bit, 00552 int FPDiff); 00553 00554 CCAssignFn *CCAssignFnForNode(unsigned CallingConv) const; 00555 NameDecorationStyle NameDecorationForFORMAL_ARGUMENTS(SDValue Op); 00556 unsigned GetAlignedArgumentStackSize(unsigned StackSize, SelectionDAG &DAG); 00557 00558 std::pair<SDValue,SDValue> FP_TO_SINTHelper(SDValue Op, 00559 SelectionDAG &DAG); 00560 00561 SDValue LowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG); 00562 SDValue LowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG); 00563 SDValue LowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG); 00564 SDValue LowerEXTRACT_VECTOR_ELT_SSE4(SDValue Op, SelectionDAG &DAG); 00565 SDValue LowerINSERT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG); 00566 SDValue LowerINSERT_VECTOR_ELT_SSE4(SDValue Op, SelectionDAG &DAG); 00567 SDValue LowerSCALAR_TO_VECTOR(SDValue Op, SelectionDAG &DAG); 00568 SDValue LowerConstantPool(SDValue Op, SelectionDAG &DAG); 00569 SDValue LowerGlobalAddress(const GlobalValue *GV, int64_t Offset, 00570 SelectionDAG &DAG) const; 00571 SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG); 00572 SDValue LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG); 00573 SDValue LowerExternalSymbol(SDValue Op, SelectionDAG &DAG); 00574 SDValue LowerShift(SDValue Op, SelectionDAG &DAG); 00575 SDValue LowerSINT_TO_FP(SDValue Op, SelectionDAG &DAG); 00576 SDValue LowerUINT_TO_FP(SDValue Op, SelectionDAG &DAG); 00577 SDValue LowerFP_TO_SINT(SDValue Op, SelectionDAG &DAG); 00578 SDValue LowerFABS(SDValue Op, SelectionDAG &DAG); 00579 SDValue LowerFNEG(SDValue Op, SelectionDAG &DAG); 00580 SDValue LowerFCOPYSIGN(SDValue Op, SelectionDAG &DAG); 00581 SDValue LowerSETCC(SDValue Op, SelectionDAG &DAG); 00582 SDValue LowerVSETCC(SDValue Op, SelectionDAG &DAG); 00583 SDValue LowerSELECT(SDValue Op, SelectionDAG &DAG); 00584 SDValue LowerBRCOND(SDValue Op, SelectionDAG &DAG); 00585 SDValue LowerMEMSET(SDValue Op, SelectionDAG &DAG); 00586 SDValue LowerJumpTable(SDValue Op, SelectionDAG &DAG); 00587 SDValue LowerCALL(SDValue Op, SelectionDAG &DAG); 00588 SDValue LowerRET(SDValue Op, SelectionDAG &DAG); 00589 SDValue LowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG); 00590 SDValue LowerFORMAL_ARGUMENTS(SDValue Op, SelectionDAG &DAG); 00591 SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG); 00592 SDValue LowerVAARG(SDValue Op, SelectionDAG &DAG); 00593 SDValue LowerVACOPY(SDValue Op, SelectionDAG &DAG); 00594 SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG); 00595 SDValue LowerRETURNADDR(SDValue Op, SelectionDAG &DAG); 00596 SDValue LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG); 00597 SDValue LowerFRAME_TO_ARGS_OFFSET(SDValue Op, SelectionDAG &DAG); 00598 SDValue LowerEH_RETURN(SDValue Op, SelectionDAG &DAG); 00599 SDValue LowerTRAMPOLINE(SDValue Op, SelectionDAG &DAG); 00600 SDValue LowerFLT_ROUNDS_(SDValue Op, SelectionDAG &DAG); 00601 SDValue LowerCTLZ(SDValue Op, SelectionDAG &DAG); 00602 SDValue LowerCTTZ(SDValue Op, SelectionDAG &DAG); 00603 SDValue LowerMUL_V2I64(SDValue Op, SelectionDAG &DAG); 00604 SDValue LowerXALUO(SDValue Op, SelectionDAG &DAG); 00605 00606 SDValue LowerCMP_SWAP(SDValue Op, SelectionDAG &DAG); 00607 SDValue LowerLOAD_SUB(SDValue Op, SelectionDAG &DAG); 00608 SDValue LowerREADCYCLECOUNTER(SDValue Op, SelectionDAG &DAG); 00609 00610 void ReplaceATOMIC_BINARY_64(SDNode *N, SmallVectorImpl<SDValue> &Results, 00611 SelectionDAG &DAG, unsigned NewOp); 00612 00613 SDValue EmitTargetCodeForMemset(SelectionDAG &DAG, 00614 SDValue Chain, 00615 SDValue Dst, SDValue Src, 00616 SDValue Size, unsigned Align, 00617 const Value *DstSV, uint64_t DstSVOff); 00618 SDValue EmitTargetCodeForMemcpy(SelectionDAG &DAG, 00619 SDValue Chain, 00620 SDValue Dst, SDValue Src, 00621 SDValue Size, unsigned Align, 00622 bool AlwaysInline, 00623 const Value *DstSV, uint64_t DstSVOff, 00624 const Value *SrcSV, uint64_t SrcSVOff); 00625 00626 /// Utility function to emit atomic bitwise operations (and, or, xor). 00627 // It takes the bitwise instruction to expand, the associated machine basic 00628 // block, and the associated X86 opcodes for reg/reg and reg/imm. 00629 MachineBasicBlock *EmitAtomicBitwiseWithCustomInserter( 00630 MachineInstr *BInstr, 00631 MachineBasicBlock *BB, 00632 unsigned regOpc, 00633 unsigned immOpc, 00634 unsigned loadOpc, 00635 unsigned cxchgOpc, 00636 unsigned copyOpc, 00637 unsigned notOpc, 00638 unsigned EAXreg, 00639 TargetRegisterClass *RC, 00640 bool invSrc = false); 00641 00642 MachineBasicBlock *EmitAtomicBit6432WithCustomInserter( 00643 MachineInstr *BInstr, 00644 MachineBasicBlock *BB, 00645 unsigned regOpcL, 00646 unsigned regOpcH, 00647 unsigned immOpcL, 00648 unsigned immOpcH, 00649 bool invSrc = false); 00650 00651 /// Utility function to emit atomic min and max. It takes the min/max 00652 // instruction to expand, the associated basic block, and the associated 00653 // cmov opcode for moving the min or max value. 00654 MachineBasicBlock *EmitAtomicMinMaxWithCustomInserter(MachineInstr *BInstr, 00655 MachineBasicBlock *BB, 00656 unsigned cmovOpc); 00657 }; 00658 00659 namespace X86 { 00660 FastISel *createFastISel(MachineFunction &mf, 00661 MachineModuleInfo *mmi, 00662 DenseMap<const Value *, unsigned> &, 00663 DenseMap<const BasicBlock *, MachineBasicBlock *> &, 00664 DenseMap<const AllocaInst *, int> & 00665 #ifndef NDEBUG 00666 , SmallSet<Instruction*, 8> & 00667 #endif 00668 ); 00669 } 00670 } 00671 00672 #endif // X86ISELLOWERING_H
This web site is hosted by the Computer Science Department at the University of Illinois at Urbana-Champaign.