[AArch64][LoadStoreOptimizer] Turn a test into an assert. NFC.
[oota-llvm.git] / lib / Target / WebAssembly / WebAssemblyISelLowering.h
1 //- WebAssemblyISelLowering.h - WebAssembly 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 /// \file
11 /// \brief This file defines the interfaces that WebAssembly uses to lower LLVM
12 /// code into a selection DAG.
13 ///
14 //===----------------------------------------------------------------------===//
15
16 #ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYISELLOWERING_H
17 #define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYISELLOWERING_H
18
19 #include "llvm/Target/TargetLowering.h"
20
21 namespace llvm {
22
23 namespace WebAssemblyISD {
24
25 enum {
26   FIRST_NUMBER = ISD::BUILTIN_OP_END,
27   RETURN,
28   ARGUMENT,
29
30   // add memory opcodes starting at ISD::FIRST_TARGET_MEMORY_OPCODE here...
31 };
32
33 } // end namespace WebAssemblyISD
34
35 class WebAssemblySubtarget;
36 class WebAssemblyTargetMachine;
37
38 class WebAssemblyTargetLowering final : public TargetLowering {
39 public:
40   WebAssemblyTargetLowering(const TargetMachine &TM,
41                             const WebAssemblySubtarget &STI);
42
43 private:
44   /// Keep a pointer to the WebAssemblySubtarget around so that we can make the
45   /// right decision when generating code for different targets.
46   const WebAssemblySubtarget *Subtarget;
47
48   MVT getScalarShiftAmountTy(const DataLayout &DL, EVT) const override;
49
50   bool CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF,
51                       bool isVarArg,
52                       const SmallVectorImpl<ISD::OutputArg> &Outs,
53                       LLVMContext &Context) const override;
54
55   SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool isVarArg,
56                       const SmallVectorImpl<ISD::OutputArg> &Outs,
57                       const SmallVectorImpl<SDValue> &OutVals, SDLoc dl,
58                       SelectionDAG &DAG) const override;
59
60   SDValue LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv,
61                                bool IsVarArg,
62                                const SmallVectorImpl<ISD::InputArg> &Ins,
63                                SDLoc DL, SelectionDAG &DAG,
64                                SmallVectorImpl<SDValue> &InVals) const override;
65 };
66
67 } // end namespace llvm
68
69 #endif