blob: 0254544b404108d6937ebe76076a2130e91fd456 [file] [log] [blame]
Dan Gohman10e730a2015-06-29 23:51:55 +00001//- 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
21namespace llvm {
22
23namespace WebAssemblyISD {
24
25enum {
26 FIRST_NUMBER = ISD::BUILTIN_OP_END,
27
28 // add memory opcodes starting at ISD::FIRST_TARGET_MEMORY_OPCODE here...
29};
30
31} // end namespace WebAssemblyISD
32
33class WebAssemblySubtarget;
34class WebAssemblyTargetMachine;
35
36class WebAssemblyTargetLowering final : public TargetLowering {
37public:
38 WebAssemblyTargetLowering(const TargetMachine &TM,
39 const WebAssemblySubtarget &STI);
40
41private:
42 /// Keep a pointer to the WebAssemblySubtarget around so that we can make the
43 /// right decision when generating code for different targets.
44 const WebAssemblySubtarget *Subtarget;
JF Bastienb9073fb2015-07-22 21:28:15 +000045
46 bool CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF,
47 bool isVarArg,
48 const SmallVectorImpl<ISD::OutputArg> &Outs,
49 LLVMContext &Context) const override;
50
51 SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool isVarArg,
52 const SmallVectorImpl<ISD::OutputArg> &Outs,
53 const SmallVectorImpl<SDValue> &OutVals, SDLoc dl,
54 SelectionDAG &DAG) const override;
55
56 SDValue LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv,
57 bool IsVarArg,
58 const SmallVectorImpl<ISD::InputArg> &Ins,
59 SDLoc DL, SelectionDAG &DAG,
60 SmallVectorImpl<SDValue> &InVals) const override;
Dan Gohman10e730a2015-06-29 23:51:55 +000061};
62
63} // end namespace llvm
64
65#endif