1 //- WebAssemblyISelLowering.h - WebAssembly DAG Lowering Interface -*- C++ -*-//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 /// \brief This file defines the interfaces that WebAssembly uses to lower LLVM
12 /// code into a selection DAG.
14 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYISELLOWERING_H
17 #define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYISELLOWERING_H
19 #include "llvm/Target/TargetLowering.h"
23 namespace WebAssemblyISD {
26 FIRST_NUMBER = ISD::BUILTIN_OP_END,
30 // add memory opcodes starting at ISD::FIRST_TARGET_MEMORY_OPCODE here...
33 } // end namespace WebAssemblyISD
35 class WebAssemblySubtarget;
36 class WebAssemblyTargetMachine;
38 class WebAssemblyTargetLowering final : public TargetLowering {
40 WebAssemblyTargetLowering(const TargetMachine &TM,
41 const WebAssemblySubtarget &STI);
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;
48 bool CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF,
50 const SmallVectorImpl<ISD::OutputArg> &Outs,
51 LLVMContext &Context) const override;
53 SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool isVarArg,
54 const SmallVectorImpl<ISD::OutputArg> &Outs,
55 const SmallVectorImpl<SDValue> &OutVals, SDLoc dl,
56 SelectionDAG &DAG) const override;
58 SDValue LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv,
60 const SmallVectorImpl<ISD::InputArg> &Ins,
61 SDLoc DL, SelectionDAG &DAG,
62 SmallVectorImpl<SDValue> &InVals) const override;
65 } // end namespace llvm