2015-06-30 07:51:55 +08: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 {
|
|
|
|
|
2015-08-12 04:13:18 +08:00
|
|
|
enum NodeType : unsigned {
|
2015-06-30 07:51:55 +08:00
|
|
|
FIRST_NUMBER = ISD::BUILTIN_OP_END,
|
2015-08-25 06:16:48 +08:00
|
|
|
#define HANDLE_NODETYPE(NODE) NODE,
|
|
|
|
#include "WebAssemblyISD.def"
|
|
|
|
#undef HANDLE_NODETYPE
|
2015-06-30 07:51:55 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // 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-23 05:28:15 +08:00
|
|
|
|
2015-08-25 02:44:37 +08:00
|
|
|
FastISel *createFastISel(FunctionLoweringInfo &FuncInfo,
|
|
|
|
const TargetLibraryInfo *LibInfo) const override;
|
2015-08-25 06:16:48 +08:00
|
|
|
bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const override;
|
2015-08-03 08:00:11 +08:00
|
|
|
MVT getScalarShiftAmountTy(const DataLayout &DL, EVT) const override;
|
2015-08-12 04:13:18 +08:00
|
|
|
const char *getTargetNodeName(unsigned Opcode) const override;
|
|
|
|
|
2015-08-25 06:16:48 +08:00
|
|
|
SDValue LowerCall(CallLoweringInfo &CLI,
|
|
|
|
SmallVectorImpl<SDValue> &InVals) const override;
|
2015-07-23 05:28:15 +08: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-08-25 06:16:48 +08:00
|
|
|
|
|
|
|
// Custom lowering hooks.
|
|
|
|
SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;
|
|
|
|
SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const;
|
2015-09-17 00:51:30 +08:00
|
|
|
SDValue LowerBR_JT(SDValue Op, SelectionDAG &DAG) const;
|
|
|
|
SDValue LowerJumpTable(SDValue Op, SelectionDAG &DAG) const;
|
2015-06-30 07:51:55 +08:00
|
|
|
};
|
|
|
|
|
2015-08-25 02:44:37 +08:00
|
|
|
namespace WebAssembly {
|
|
|
|
FastISel *createFastISel(FunctionLoweringInfo &funcInfo,
|
|
|
|
const TargetLibraryInfo *libInfo);
|
|
|
|
} // end namespace WebAssembly
|
|
|
|
|
2015-06-30 07:51:55 +08:00
|
|
|
} // end namespace llvm
|
|
|
|
|
|
|
|
#endif
|