ARM: use LLVM IR to represent the vshrn operation
[oota-llvm.git] / lib / Target / ARM / ARMISelLowering.h
1 //===-- ARMISelLowering.h - ARM DAG Lowering Interface ----------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines the interfaces that ARM uses to lower LLVM code into a
11 // selection DAG.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef ARMISELLOWERING_H
16 #define ARMISELLOWERING_H
17
18 #include "ARM.h"
19 #include "ARMSubtarget.h"
20 #include "llvm/CodeGen/CallingConvLower.h"
21 #include "llvm/CodeGen/FastISel.h"
22 #include "llvm/CodeGen/SelectionDAG.h"
23 #include "llvm/Target/TargetLowering.h"
24 #include "llvm/Target/TargetRegisterInfo.h"
25 #include <vector>
26
27 namespace llvm {
28   class ARMConstantPoolValue;
29
30   namespace ARMISD {
31     // ARM Specific DAG Nodes
32     enum NodeType {
33       // Start the numbering where the builtin ops and target ops leave off.
34       FIRST_NUMBER = ISD::BUILTIN_OP_END,
35
36       Wrapper,      // Wrapper - A wrapper node for TargetConstantPool,
37                     // TargetExternalSymbol, and TargetGlobalAddress.
38       WrapperPIC,   // WrapperPIC - A wrapper node for TargetGlobalAddress in
39                     // PIC mode.
40       WrapperJT,    // WrapperJT - A wrapper node for TargetJumpTable
41
42       // Add pseudo op to model memcpy for struct byval.
43       COPY_STRUCT_BYVAL,
44
45       CALL,         // Function call.
46       CALL_PRED,    // Function call that's predicable.
47       CALL_NOLINK,  // Function call with branch not branch-and-link.
48       tCALL,        // Thumb function call.
49       BRCOND,       // Conditional branch.
50       BR_JT,        // Jumptable branch.
51       BR2_JT,       // Jumptable branch (2 level - jumptable entry is a jump).
52       RET_FLAG,     // Return with a flag operand.
53       INTRET_FLAG,  // Interrupt return with an LR-offset and a flag operand.
54
55       PIC_ADD,      // Add with a PC operand and a PIC label.
56
57       CMP,          // ARM compare instructions.
58       CMN,          // ARM CMN instructions.
59       CMPZ,         // ARM compare that sets only Z flag.
60       CMPFP,        // ARM VFP compare instruction, sets FPSCR.
61       CMPFPw0,      // ARM VFP compare against zero instruction, sets FPSCR.
62       FMSTAT,       // ARM fmstat instruction.
63
64       CMOV,         // ARM conditional move instructions.
65
66       BCC_i64,
67
68       RBIT,         // ARM bitreverse instruction
69
70       FTOSI,        // FP to sint within a FP register.
71       FTOUI,        // FP to uint within a FP register.
72       SITOF,        // sint to FP within a FP register.
73       UITOF,        // uint to FP within a FP register.
74
75       SRL_FLAG,     // V,Flag = srl_flag X -> srl X, 1 + save carry out.
76       SRA_FLAG,     // V,Flag = sra_flag X -> sra X, 1 + save carry out.
77       RRX,          // V = RRX X, Flag     -> srl X, 1 + shift in carry flag.
78
79       ADDC,         // Add with carry
80       ADDE,         // Add using carry
81       SUBC,         // Sub with carry
82       SUBE,         // Sub using carry
83
84       VMOVRRD,      // double to two gprs.
85       VMOVDRR,      // Two gprs to double.
86
87       EH_SJLJ_SETJMP,         // SjLj exception handling setjmp.
88       EH_SJLJ_LONGJMP,        // SjLj exception handling longjmp.
89
90       TC_RETURN,    // Tail call return pseudo.
91
92       THREAD_POINTER,
93
94       DYN_ALLOC,    // Dynamic allocation on the stack.
95
96       MEMBARRIER_MCR, // Memory barrier (MCR)
97
98       PRELOAD,      // Preload
99
100       VCEQ,         // Vector compare equal.
101       VCEQZ,        // Vector compare equal to zero.
102       VCGE,         // Vector compare greater than or equal.
103       VCGEZ,        // Vector compare greater than or equal to zero.
104       VCLEZ,        // Vector compare less than or equal to zero.
105       VCGEU,        // Vector compare unsigned greater than or equal.
106       VCGT,         // Vector compare greater than.
107       VCGTZ,        // Vector compare greater than zero.
108       VCLTZ,        // Vector compare less than zero.
109       VCGTU,        // Vector compare unsigned greater than.
110       VTST,         // Vector test bits.
111
112       // Vector shift by immediate:
113       VSHL,         // ...left
114       VSHRs,        // ...right (signed)
115       VSHRu,        // ...right (unsigned)
116       VSHLLs,       // ...left long (signed)
117       VSHLLu,       // ...left long (unsigned)
118       VSHLLi,       // ...left long (with maximum shift count)
119
120       // Vector rounding shift by immediate:
121       VRSHRs,       // ...right (signed)
122       VRSHRu,       // ...right (unsigned)
123       VRSHRN,       // ...right narrow
124
125       // Vector saturating shift by immediate:
126       VQSHLs,       // ...left (signed)
127       VQSHLu,       // ...left (unsigned)
128       VQSHLsu,      // ...left (signed to unsigned)
129       VQSHRNs,      // ...right narrow (signed)
130       VQSHRNu,      // ...right narrow (unsigned)
131       VQSHRNsu,     // ...right narrow (signed to unsigned)
132
133       // Vector saturating rounding shift by immediate:
134       VQRSHRNs,     // ...right narrow (signed)
135       VQRSHRNu,     // ...right narrow (unsigned)
136       VQRSHRNsu,    // ...right narrow (signed to unsigned)
137
138       // Vector shift and insert:
139       VSLI,         // ...left
140       VSRI,         // ...right
141
142       // Vector get lane (VMOV scalar to ARM core register)
143       // (These are used for 8- and 16-bit element types only.)
144       VGETLANEu,    // zero-extend vector extract element
145       VGETLANEs,    // sign-extend vector extract element
146
147       // Vector move immediate and move negated immediate:
148       VMOVIMM,
149       VMVNIMM,
150
151       // Vector move f32 immediate:
152       VMOVFPIMM,
153
154       // Vector duplicate:
155       VDUP,
156       VDUPLANE,
157
158       // Vector shuffles:
159       VEXT,         // extract
160       VREV64,       // reverse elements within 64-bit doublewords
161       VREV32,       // reverse elements within 32-bit words
162       VREV16,       // reverse elements within 16-bit halfwords
163       VZIP,         // zip (interleave)
164       VUZP,         // unzip (deinterleave)
165       VTRN,         // transpose
166       VTBL1,        // 1-register shuffle with mask
167       VTBL2,        // 2-register shuffle with mask
168
169       // Vector multiply long:
170       VMULLs,       // ...signed
171       VMULLu,       // ...unsigned
172
173       UMLAL,        // 64bit Unsigned Accumulate Multiply
174       SMLAL,        // 64bit Signed Accumulate Multiply
175
176       // Operands of the standard BUILD_VECTOR node are not legalized, which
177       // is fine if BUILD_VECTORs are always lowered to shuffles or other
178       // operations, but for ARM some BUILD_VECTORs are legal as-is and their
179       // operands need to be legalized.  Define an ARM-specific version of
180       // BUILD_VECTOR for this purpose.
181       BUILD_VECTOR,
182
183       // Floating-point max and min:
184       FMAX,
185       FMIN,
186       VMAXNM,
187       VMINNM,
188
189       // Bit-field insert
190       BFI,
191
192       // Vector OR with immediate
193       VORRIMM,
194       // Vector AND with NOT of immediate
195       VBICIMM,
196
197       // Vector bitwise select
198       VBSL,
199
200       // Vector load N-element structure to all lanes:
201       VLD2DUP = ISD::FIRST_TARGET_MEMORY_OPCODE,
202       VLD3DUP,
203       VLD4DUP,
204
205       // NEON loads with post-increment base updates:
206       VLD1_UPD,
207       VLD2_UPD,
208       VLD3_UPD,
209       VLD4_UPD,
210       VLD2LN_UPD,
211       VLD3LN_UPD,
212       VLD4LN_UPD,
213       VLD2DUP_UPD,
214       VLD3DUP_UPD,
215       VLD4DUP_UPD,
216
217       // NEON stores with post-increment base updates:
218       VST1_UPD,
219       VST2_UPD,
220       VST3_UPD,
221       VST4_UPD,
222       VST2LN_UPD,
223       VST3LN_UPD,
224       VST4LN_UPD
225     };
226   }
227
228   /// Define some predicates that are used for node matching.
229   namespace ARM {
230     bool isBitFieldInvertedMask(unsigned v);
231   }
232
233   //===--------------------------------------------------------------------===//
234   //  ARMTargetLowering - ARM Implementation of the TargetLowering interface
235
236   class ARMTargetLowering : public TargetLowering {
237   public:
238     explicit ARMTargetLowering(TargetMachine &TM);
239
240     virtual unsigned getJumpTableEncoding() const;
241
242     virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const;
243
244     /// ReplaceNodeResults - Replace the results of node with an illegal result
245     /// type with new values built out of custom code.
246     ///
247     virtual void ReplaceNodeResults(SDNode *N, SmallVectorImpl<SDValue>&Results,
248                                     SelectionDAG &DAG) const;
249
250     virtual const char *getTargetNodeName(unsigned Opcode) const;
251
252     virtual bool isSelectSupported(SelectSupportKind Kind) const {
253       // ARM does not support scalar condition selects on vectors.
254       return (Kind != ScalarCondVectorVal);
255     }
256
257     /// getSetCCResultType - Return the value type to use for ISD::SETCC.
258     virtual EVT getSetCCResultType(LLVMContext &Context, EVT VT) const;
259
260     virtual MachineBasicBlock *
261       EmitInstrWithCustomInserter(MachineInstr *MI,
262                                   MachineBasicBlock *MBB) const;
263
264     virtual void
265     AdjustInstrPostInstrSelection(MachineInstr *MI, SDNode *Node) const;
266
267     SDValue PerformCMOVCombine(SDNode *N, SelectionDAG &DAG) const;
268     virtual SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const;
269
270     bool isDesirableToTransformToIntegerOp(unsigned Opc, EVT VT) const;
271
272     /// allowsUnalignedMemoryAccesses - Returns true if the target allows
273     /// unaligned memory accesses of the specified type. Returns whether it
274     /// is "fast" by reference in the second argument.
275     virtual bool allowsUnalignedMemoryAccesses(EVT VT, unsigned AddrSpace,
276                                                bool *Fast) const;
277
278     virtual EVT getOptimalMemOpType(uint64_t Size,
279                                     unsigned DstAlign, unsigned SrcAlign,
280                                     bool IsMemset, bool ZeroMemset,
281                                     bool MemcpyStrSrc,
282                                     MachineFunction &MF) const;
283
284     using TargetLowering::isZExtFree;
285     virtual bool isZExtFree(SDValue Val, EVT VT2) const;
286
287     virtual bool allowTruncateForTailCall(Type *Ty1, Type *Ty2) const;
288
289
290     /// isLegalAddressingMode - Return true if the addressing mode represented
291     /// by AM is legal for this target, for a load/store of the specified type.
292     virtual bool isLegalAddressingMode(const AddrMode &AM, Type *Ty)const;
293     bool isLegalT2ScaledAddressingMode(const AddrMode &AM, EVT VT) const;
294
295     /// isLegalICmpImmediate - Return true if the specified immediate is legal
296     /// icmp immediate, that is the target has icmp instructions which can
297     /// compare a register against the immediate without having to materialize
298     /// the immediate into a register.
299     virtual bool isLegalICmpImmediate(int64_t Imm) const;
300
301     /// isLegalAddImmediate - Return true if the specified immediate is legal
302     /// add immediate, that is the target has add instructions which can
303     /// add a register and the immediate without having to materialize
304     /// the immediate into a register.
305     virtual bool isLegalAddImmediate(int64_t Imm) const;
306
307     /// getPreIndexedAddressParts - returns true by value, base pointer and
308     /// offset pointer and addressing mode by reference if the node's address
309     /// can be legally represented as pre-indexed load / store address.
310     virtual bool getPreIndexedAddressParts(SDNode *N, SDValue &Base,
311                                            SDValue &Offset,
312                                            ISD::MemIndexedMode &AM,
313                                            SelectionDAG &DAG) const;
314
315     /// getPostIndexedAddressParts - returns true by value, base pointer and
316     /// offset pointer and addressing mode by reference if this node can be
317     /// combined with a load / store to form a post-indexed load / store.
318     virtual bool getPostIndexedAddressParts(SDNode *N, SDNode *Op,
319                                             SDValue &Base, SDValue &Offset,
320                                             ISD::MemIndexedMode &AM,
321                                             SelectionDAG &DAG) const;
322
323     virtual void computeMaskedBitsForTargetNode(const SDValue Op,
324                                                 APInt &KnownZero,
325                                                 APInt &KnownOne,
326                                                 const SelectionDAG &DAG,
327                                                 unsigned Depth) const;
328
329
330     virtual bool ExpandInlineAsm(CallInst *CI) const;
331
332     ConstraintType getConstraintType(const std::string &Constraint) const;
333
334     /// Examine constraint string and operand type and determine a weight value.
335     /// The operand object must already have been set up with the operand type.
336     ConstraintWeight getSingleConstraintMatchWeight(
337       AsmOperandInfo &info, const char *constraint) const;
338
339     std::pair<unsigned, const TargetRegisterClass*>
340       getRegForInlineAsmConstraint(const std::string &Constraint,
341                                    MVT VT) const;
342
343     /// LowerAsmOperandForConstraint - Lower the specified operand into the Ops
344     /// vector.  If it is invalid, don't add anything to Ops. If hasMemory is
345     /// true it means one of the asm constraint of the inline asm instruction
346     /// being processed is 'm'.
347     virtual void LowerAsmOperandForConstraint(SDValue Op,
348                                               std::string &Constraint,
349                                               std::vector<SDValue> &Ops,
350                                               SelectionDAG &DAG) const;
351
352     const ARMSubtarget* getSubtarget() const {
353       return Subtarget;
354     }
355
356     /// getRegClassFor - Return the register class that should be used for the
357     /// specified value type.
358     virtual const TargetRegisterClass *getRegClassFor(MVT VT) const;
359
360     /// getMaximalGlobalOffset - Returns the maximal possible offset which can
361     /// be used for loads / stores from the global.
362     virtual unsigned getMaximalGlobalOffset() const;
363
364     /// Returns true if a cast between SrcAS and DestAS is a noop.
365     virtual bool isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const {
366       // Addrspacecasts are always noops.
367       return true;
368     }
369
370     /// createFastISel - This method returns a target specific FastISel object,
371     /// or null if the target does not support "fast" ISel.
372     virtual FastISel *createFastISel(FunctionLoweringInfo &funcInfo,
373                                      const TargetLibraryInfo *libInfo) const;
374
375     Sched::Preference getSchedulingPreference(SDNode *N) const;
376
377     bool isShuffleMaskLegal(const SmallVectorImpl<int> &M, EVT VT) const;
378     bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const;
379
380     /// isFPImmLegal - Returns true if the target can instruction select the
381     /// specified FP immediate natively. If false, the legalizer will
382     /// materialize the FP immediate as a load from a constant pool.
383     virtual bool isFPImmLegal(const APFloat &Imm, EVT VT) const;
384
385     virtual bool getTgtMemIntrinsic(IntrinsicInfo &Info,
386                                     const CallInst &I,
387                                     unsigned Intrinsic) const;
388
389     /// \brief Returns true if it is beneficial to convert a load of a constant
390     /// to just the constant itself.
391     virtual bool shouldConvertConstantLoadToIntImm(const APInt &Imm,
392                                                    Type *Ty) const;
393
394   protected:
395     std::pair<const TargetRegisterClass*, uint8_t>
396     findRepresentativeClass(MVT VT) const;
397
398   private:
399     /// Subtarget - Keep a pointer to the ARMSubtarget around so that we can
400     /// make the right decision when generating code for different targets.
401     const ARMSubtarget *Subtarget;
402
403     const TargetRegisterInfo *RegInfo;
404
405     const InstrItineraryData *Itins;
406
407     /// ARMPCLabelIndex - Keep track of the number of ARM PC labels created.
408     ///
409     unsigned ARMPCLabelIndex;
410
411     void addTypeForNEON(MVT VT, MVT PromotedLdStVT, MVT PromotedBitwiseVT);
412     void addDRTypeForNEON(MVT VT);
413     void addQRTypeForNEON(MVT VT);
414
415     typedef SmallVector<std::pair<unsigned, SDValue>, 8> RegsToPassVector;
416     void PassF64ArgInRegs(SDLoc dl, SelectionDAG &DAG,
417                           SDValue Chain, SDValue &Arg,
418                           RegsToPassVector &RegsToPass,
419                           CCValAssign &VA, CCValAssign &NextVA,
420                           SDValue &StackPtr,
421                           SmallVectorImpl<SDValue> &MemOpChains,
422                           ISD::ArgFlagsTy Flags) const;
423     SDValue GetF64FormalArgument(CCValAssign &VA, CCValAssign &NextVA,
424                                  SDValue &Root, SelectionDAG &DAG,
425                                  SDLoc dl) const;
426
427     CCAssignFn *CCAssignFnForNode(CallingConv::ID CC, bool Return,
428                                   bool isVarArg) const;
429     SDValue LowerMemOpCallTo(SDValue Chain, SDValue StackPtr, SDValue Arg,
430                              SDLoc dl, SelectionDAG &DAG,
431                              const CCValAssign &VA,
432                              ISD::ArgFlagsTy Flags) const;
433     SDValue LowerEH_SJLJ_SETJMP(SDValue Op, SelectionDAG &DAG) const;
434     SDValue LowerEH_SJLJ_LONGJMP(SDValue Op, SelectionDAG &DAG) const;
435     SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG,
436                                     const ARMSubtarget *Subtarget) const;
437     SDValue LowerBlockAddress(SDValue Op, SelectionDAG &DAG) const;
438     SDValue LowerGlobalAddressDarwin(SDValue Op, SelectionDAG &DAG) const;
439     SDValue LowerGlobalAddressELF(SDValue Op, SelectionDAG &DAG) const;
440     SDValue LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const;
441     SDValue LowerToTLSGeneralDynamicModel(GlobalAddressSDNode *GA,
442                                             SelectionDAG &DAG) const;
443     SDValue LowerToTLSExecModels(GlobalAddressSDNode *GA,
444                                  SelectionDAG &DAG,
445                                  TLSModel::Model model) const;
446     SDValue LowerGLOBAL_OFFSET_TABLE(SDValue Op, SelectionDAG &DAG) const;
447     SDValue LowerBR_JT(SDValue Op, SelectionDAG &DAG) const;
448     SDValue LowerSELECT(SDValue Op, SelectionDAG &DAG) const;
449     SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const;
450     SDValue LowerBR_CC(SDValue Op, SelectionDAG &DAG) const;
451     SDValue LowerFCOPYSIGN(SDValue Op, SelectionDAG &DAG) const;
452     SDValue LowerRETURNADDR(SDValue Op, SelectionDAG &DAG) const;
453     SDValue LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const;
454     SDValue LowerShiftRightParts(SDValue Op, SelectionDAG &DAG) const;
455     SDValue LowerShiftLeftParts(SDValue Op, SelectionDAG &DAG) const;
456     SDValue LowerFLT_ROUNDS_(SDValue Op, SelectionDAG &DAG) const;
457     SDValue LowerConstantFP(SDValue Op, SelectionDAG &DAG,
458                             const ARMSubtarget *ST) const;
459     SDValue LowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG,
460                               const ARMSubtarget *ST) const;
461     SDValue LowerFSINCOS(SDValue Op, SelectionDAG &DAG) const;
462     SDValue LowerDivRem(SDValue Op, SelectionDAG &DAG) const;
463
464     /// isFMAFasterThanFMulAndFAdd - Return true if an FMA operation is faster
465     /// than a pair of fmul and fadd instructions. fmuladd intrinsics will be
466     /// expanded to FMAs when this method returns true, otherwise fmuladd is
467     /// expanded to fmul + fadd.
468     ///
469     /// ARM supports both fused and unfused multiply-add operations; we already
470     /// lower a pair of fmul and fadd to the latter so it's not clear that there
471     /// would be a gain or that the gain would be worthwhile enough to risk
472     /// correctness bugs.
473     virtual bool isFMAFasterThanFMulAndFAdd(EVT VT) const { return false; }
474
475     SDValue ReconstructShuffle(SDValue Op, SelectionDAG &DAG) const;
476
477     SDValue LowerCallResult(SDValue Chain, SDValue InFlag,
478                             CallingConv::ID CallConv, bool isVarArg,
479                             const SmallVectorImpl<ISD::InputArg> &Ins,
480                             SDLoc dl, SelectionDAG &DAG,
481                             SmallVectorImpl<SDValue> &InVals,
482                             bool isThisReturn, SDValue ThisVal) const;
483
484     virtual SDValue
485       LowerFormalArguments(SDValue Chain,
486                            CallingConv::ID CallConv, bool isVarArg,
487                            const SmallVectorImpl<ISD::InputArg> &Ins,
488                            SDLoc dl, SelectionDAG &DAG,
489                            SmallVectorImpl<SDValue> &InVals) const;
490
491     int StoreByValRegs(CCState &CCInfo, SelectionDAG &DAG,
492                        SDLoc dl, SDValue &Chain,
493                        const Value *OrigArg,
494                        unsigned InRegsParamRecordIdx,
495                        unsigned OffsetFromOrigArg,
496                        unsigned ArgOffset,
497                        unsigned ArgSize,
498                        bool ForceMutable) const;
499
500     void VarArgStyleRegisters(CCState &CCInfo, SelectionDAG &DAG,
501                               SDLoc dl, SDValue &Chain,
502                               unsigned ArgOffset,
503                               bool ForceMutable = false) const;
504
505     void computeRegArea(CCState &CCInfo, MachineFunction &MF,
506                         unsigned InRegsParamRecordIdx,
507                         unsigned ArgSize,
508                         unsigned &ArgRegsSize,
509                         unsigned &ArgRegsSaveSize) const;
510
511     virtual SDValue
512       LowerCall(TargetLowering::CallLoweringInfo &CLI,
513                 SmallVectorImpl<SDValue> &InVals) const;
514
515     /// HandleByVal - Target-specific cleanup for ByVal support.
516     virtual void HandleByVal(CCState *, unsigned &, unsigned) const;
517
518     /// IsEligibleForTailCallOptimization - Check whether the call is eligible
519     /// for tail call optimization. Targets which want to do tail call
520     /// optimization should implement this function.
521     bool IsEligibleForTailCallOptimization(SDValue Callee,
522                                            CallingConv::ID CalleeCC,
523                                            bool isVarArg,
524                                            bool isCalleeStructRet,
525                                            bool isCallerStructRet,
526                                     const SmallVectorImpl<ISD::OutputArg> &Outs,
527                                     const SmallVectorImpl<SDValue> &OutVals,
528                                     const SmallVectorImpl<ISD::InputArg> &Ins,
529                                            SelectionDAG& DAG) const;
530
531     virtual bool CanLowerReturn(CallingConv::ID CallConv,
532                                 MachineFunction &MF, bool isVarArg,
533                                 const SmallVectorImpl<ISD::OutputArg> &Outs,
534                                 LLVMContext &Context) const;
535
536     virtual SDValue
537       LowerReturn(SDValue Chain,
538                   CallingConv::ID CallConv, bool isVarArg,
539                   const SmallVectorImpl<ISD::OutputArg> &Outs,
540                   const SmallVectorImpl<SDValue> &OutVals,
541                   SDLoc dl, SelectionDAG &DAG) const;
542
543     virtual bool isUsedByReturnOnly(SDNode *N, SDValue &Chain) const;
544
545     virtual bool mayBeEmittedAsTailCall(CallInst *CI) const;
546
547     SDValue getARMCmp(SDValue LHS, SDValue RHS, ISD::CondCode CC,
548                       SDValue &ARMcc, SelectionDAG &DAG, SDLoc dl) const;
549     SDValue getVFPCmp(SDValue LHS, SDValue RHS,
550                       SelectionDAG &DAG, SDLoc dl) const;
551     SDValue duplicateCmp(SDValue Cmp, SelectionDAG &DAG) const;
552
553     SDValue OptimizeVFPBrcond(SDValue Op, SelectionDAG &DAG) const;
554
555     MachineBasicBlock *EmitAtomicCmpSwap(MachineInstr *MI,
556                                          MachineBasicBlock *BB,
557                                          unsigned Size) const;
558     MachineBasicBlock *EmitAtomicBinary(MachineInstr *MI,
559                                         MachineBasicBlock *BB,
560                                         unsigned Size,
561                                         unsigned BinOpcode) const;
562     MachineBasicBlock *EmitAtomicBinary64(MachineInstr *MI,
563                                           MachineBasicBlock *BB,
564                                           unsigned Op1,
565                                           unsigned Op2,
566                                           bool NeedsCarry = false,
567                                           bool IsCmpxchg = false,
568                                           bool IsMinMax = false,
569                                           ARMCC::CondCodes CC = ARMCC::AL) const;
570     MachineBasicBlock * EmitAtomicBinaryMinMax(MachineInstr *MI,
571                                                MachineBasicBlock *BB,
572                                                unsigned Size,
573                                                bool signExtend,
574                                                ARMCC::CondCodes Cond) const;
575     MachineBasicBlock *EmitAtomicLoad64(MachineInstr *MI,
576                                         MachineBasicBlock *BB) const;
577
578     void SetupEntryBlockForSjLj(MachineInstr *MI,
579                                 MachineBasicBlock *MBB,
580                                 MachineBasicBlock *DispatchBB, int FI) const;
581
582     MachineBasicBlock *EmitSjLjDispatchBlock(MachineInstr *MI,
583                                              MachineBasicBlock *MBB) const;
584
585     bool RemapAddSubWithFlags(MachineInstr *MI, MachineBasicBlock *BB) const;
586
587     MachineBasicBlock *EmitStructByval(MachineInstr *MI,
588                                        MachineBasicBlock *MBB) const;
589   };
590
591   enum NEONModImmType {
592     VMOVModImm,
593     VMVNModImm,
594     OtherModImm
595   };
596
597
598   namespace ARM {
599     FastISel *createFastISel(FunctionLoweringInfo &funcInfo,
600                              const TargetLibraryInfo *libInfo);
601   }
602 }
603
604 #endif  // ARMISELLOWERING_H