2015-06-29 23:51:55 +00:00
|
|
|
//- WebAssemblyISelLowering.h - WebAssembly DAG Lowering Interface -*- C++ -*-//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
///
|
|
|
|
/// \file
|
|
|
|
/// \brief This file defines the interfaces that WebAssembly uses to lower LLVM
|
|
|
|
/// code into a selection DAG.
|
|
|
|
///
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYISELLOWERING_H
|
|
|
|
#define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYISELLOWERING_H
|
|
|
|
|
|
|
|
#include "llvm/Target/TargetLowering.h"
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
namespace WebAssemblyISD {
|
|
|
|
|
|
|
|
enum {
|
|
|
|
FIRST_NUMBER = ISD::BUILTIN_OP_END,
|
2015-07-31 17:53:38 +00:00
|
|
|
RETURN,
|
|
|
|
ARGUMENT,
|
2015-06-29 23:51:55 +00:00
|
|
|
|
|
|
|
// add memory opcodes starting at ISD::FIRST_TARGET_MEMORY_OPCODE here...
|
|
|
|
};
|
|
|
|
|
|
|
|
} // end namespace WebAssemblyISD
|
|
|
|
|
|
|
|
class WebAssemblySubtarget;
|
|
|
|
class WebAssemblyTargetMachine;
|
|
|
|
|
|
|
|
class WebAssemblyTargetLowering final : public TargetLowering {
|
|
|
|
public:
|
|
|
|
WebAssemblyTargetLowering(const TargetMachine &TM,
|
|
|
|
const WebAssemblySubtarget &STI);
|
|
|
|
|
|
|
|
private:
|
|
|
|
/// Keep a pointer to the WebAssemblySubtarget around so that we can make the
|
|
|
|
/// right decision when generating code for different targets.
|
|
|
|
const WebAssemblySubtarget *Subtarget;
|
2015-07-22 21:28:15 +00:00
|
|
|
|
|
|
|
bool CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF,
|
|
|
|
bool isVarArg,
|
|
|
|
const SmallVectorImpl<ISD::OutputArg> &Outs,
|
|
|
|
LLVMContext &Context) const override;
|
|
|
|
|
|
|
|
SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool isVarArg,
|
|
|
|
const SmallVectorImpl<ISD::OutputArg> &Outs,
|
|
|
|
const SmallVectorImpl<SDValue> &OutVals, SDLoc dl,
|
|
|
|
SelectionDAG &DAG) const override;
|
|
|
|
|
|
|
|
SDValue LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv,
|
|
|
|
bool IsVarArg,
|
|
|
|
const SmallVectorImpl<ISD::InputArg> &Ins,
|
|
|
|
SDLoc DL, SelectionDAG &DAG,
|
|
|
|
SmallVectorImpl<SDValue> &InVals) const override;
|
2015-06-29 23:51:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // end namespace llvm
|
|
|
|
|
|
|
|
#endif
|