LLVM  7.0.0
WebAssemblyISelLowering.h
Go to the documentation of this file.
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 /// 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 
20 
21 namespace llvm {
22 
23 namespace WebAssemblyISD {
24 
25 enum NodeType : unsigned {
27 #define HANDLE_NODETYPE(NODE) NODE,
28 #include "WebAssemblyISD.def"
29 #undef HANDLE_NODETYPE
30 };
31 
32 } // end namespace WebAssemblyISD
33 
34 class WebAssemblySubtarget;
35 class WebAssemblyTargetMachine;
36 
38  public:
40  const WebAssemblySubtarget &STI);
41 
42  private:
43  /// Keep a pointer to the WebAssemblySubtarget around so that we can make the
44  /// right decision when generating code for different targets.
45  const WebAssemblySubtarget *Subtarget;
46 
48  const TargetLibraryInfo *LibInfo) const override;
49  bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const override;
50  MVT getScalarShiftAmountTy(const DataLayout &DL, EVT) const override;
52  EmitInstrWithCustomInserter(MachineInstr &MI,
53  MachineBasicBlock *MBB) const override;
54  const char *getTargetNodeName(unsigned Opcode) const override;
55  std::pair<unsigned, const TargetRegisterClass *> getRegForInlineAsmConstraint(
56  const TargetRegisterInfo *TRI, StringRef Constraint,
57  MVT VT) const override;
58  bool isCheapToSpeculateCttz() const override;
59  bool isCheapToSpeculateCtlz() const override;
60  bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM, Type *Ty,
61  unsigned AS,
62  Instruction *I = nullptr) const override;
63  bool allowsMisalignedMemoryAccesses(EVT, unsigned AddrSpace, unsigned Align,
64  bool *Fast) const override;
65  bool isIntDivCheap(EVT VT, AttributeList Attr) const override;
66 
67  EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context,
68  EVT VT) const override;
69 
70  SDValue LowerCall(CallLoweringInfo &CLI,
71  SmallVectorImpl<SDValue> &InVals) const override;
72  bool CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF,
73  bool isVarArg,
75  LLVMContext &Context) const override;
76  SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool isVarArg,
78  const SmallVectorImpl<SDValue> &OutVals, const SDLoc &dl,
79  SelectionDAG &DAG) const override;
80  SDValue LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv,
81  bool IsVarArg,
83  const SDLoc &DL, SelectionDAG &DAG,
84  SmallVectorImpl<SDValue> &InVals) const override;
85 
86  // Custom lowering hooks.
87  SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;
88  SDValue LowerFrameIndex(SDValue Op, SelectionDAG &DAG) const;
90  SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const;
91  SDValue LowerExternalSymbol(SDValue Op, SelectionDAG &DAG) const;
92  SDValue LowerBR_JT(SDValue Op, SelectionDAG &DAG) const;
93  SDValue LowerJumpTable(SDValue Op, SelectionDAG &DAG) const;
94  SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG) const;
95  SDValue LowerCopyToReg(SDValue Op, SelectionDAG &DAG) const;
96  SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) const;
97 };
98 
99 namespace WebAssembly {
101  const TargetLibraryInfo *libInfo);
102 } // end namespace WebAssembly
103 
104 } // end namespace llvm
105 
106 #endif
BUILTIN_OP_END - This must be the last enum value in this list.
Definition: ISDOpcodes.h:831
A parsed version of the target data layout string in and methods for querying it. ...
Definition: DataLayout.h:111
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
This represents an addressing mode of: BaseGV + BaseOffs + BaseReg + Scale*ScaleReg If BaseGV is null...
LLVMContext & Context
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
unsigned const TargetRegisterInfo * TRI
FastISel * createFastISel(FunctionLoweringInfo &funcInfo, const TargetLibraryInfo *libInfo)
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:42
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
This is a fast-path instruction selection class that generates poor code and doesn&#39;t support illegal ...
Definition: FastISel.h:67
Machine Value Type.
static SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG)
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:46
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:69
static SDValue LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG, const SparcSubtarget *Subtarget)
Extended Value Type.
Definition: ValueTypes.h:34
const AMDGPUAS & AS
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
This structure contains all information that is necessary for lowering calls.
Fast - This calling convention attempts to make calls as fast as possible (e.g.
Definition: CallingConv.h:43
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
Definition: SelectionDAG.h:222
Provides information about what library functions are available for the current target.
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Representation of each machine instruction.
Definition: MachineInstr.h:60
#define I(x, y, z)
Definition: MD5.cpp:58
FunctionLoweringInfo - This contains information that is global to a function that is used when lower...
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:59
IRTranslator LLVM IR MI
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation...
This file describes how to lower LLVM code to machine code.