Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
Show First 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | |||||
def SDT_WebAssemblyBrTable : SDTypeProfile<0, -1, [SDTCisPtrTy<0>]>; | def SDT_WebAssemblyBrTable : SDTypeProfile<0, -1, [SDTCisPtrTy<0>]>; | ||||
def SDT_WebAssemblyArgument : SDTypeProfile<1, 1, [SDTCisVT<1, i32>]>; | def SDT_WebAssemblyArgument : SDTypeProfile<1, 1, [SDTCisVT<1, i32>]>; | ||||
def SDT_WebAssemblyReturn : SDTypeProfile<0, -1, []>; | def SDT_WebAssemblyReturn : SDTypeProfile<0, -1, []>; | ||||
def SDT_WebAssemblyWrapper : SDTypeProfile<1, 1, [SDTCisSameAs<0, 1>, | def SDT_WebAssemblyWrapper : SDTypeProfile<1, 1, [SDTCisSameAs<0, 1>, | ||||
SDTCisPtrTy<0>]>; | SDTCisPtrTy<0>]>; | ||||
def SDT_WebAssemblyWrapperPIC : SDTypeProfile<1, 1, [SDTCisSameAs<0, 1>, | def SDT_WebAssemblyWrapperPIC : SDTypeProfile<1, 1, [SDTCisSameAs<0, 1>, | ||||
SDTCisPtrTy<0>]>; | SDTCisPtrTy<0>]>; | ||||
def SDT_WebAssemblyThrow : SDTypeProfile<0, -1, [SDTCisPtrTy<0>]>; | def SDT_WebAssemblyThrow : SDTypeProfile<0, -1, [SDTCisPtrTy<0>]>; | ||||
def SDT_WebAssemblyGlobalGet : SDTypeProfile<1, 1, [SDTCisVT<0, i32>, | |||||
SDTCisVT<1, i32>]>; | |||||
def SDT_WebAssemblyConst : SDTypeProfile<1, 1, [SDTCisVT<0, i32>, | |||||
SDTCisVT<1, i32>]>; | |||||
aheejin: Nit: indentation | |||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
// WebAssembly-specific DAG Nodes. | // WebAssembly-specific DAG Nodes. | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
def WebAssemblycallseq_start : | def WebAssemblycallseq_start : | ||||
SDNode<"ISD::CALLSEQ_START", SDT_WebAssemblyCallSeqStart, | SDNode<"ISD::CALLSEQ_START", SDT_WebAssemblyCallSeqStart, | ||||
[SDNPHasChain, SDNPOutGlue]>; | [SDNPHasChain, SDNPOutGlue]>; | ||||
Show All 17 Lines | |||||
def WebAssemblyreturn : SDNode<"WebAssemblyISD::RETURN", | def WebAssemblyreturn : SDNode<"WebAssemblyISD::RETURN", | ||||
SDT_WebAssemblyReturn, [SDNPHasChain]>; | SDT_WebAssemblyReturn, [SDNPHasChain]>; | ||||
def WebAssemblywrapper : SDNode<"WebAssemblyISD::Wrapper", | def WebAssemblywrapper : SDNode<"WebAssemblyISD::Wrapper", | ||||
SDT_WebAssemblyWrapper>; | SDT_WebAssemblyWrapper>; | ||||
def WebAssemblywrapperPIC : SDNode<"WebAssemblyISD::WrapperPIC", | def WebAssemblywrapperPIC : SDNode<"WebAssemblyISD::WrapperPIC", | ||||
SDT_WebAssemblyWrapperPIC>; | SDT_WebAssemblyWrapperPIC>; | ||||
def WebAssemblythrow : SDNode<"WebAssemblyISD::THROW", SDT_WebAssemblyThrow, | def WebAssemblythrow : SDNode<"WebAssemblyISD::THROW", SDT_WebAssemblyThrow, | ||||
[SDNPHasChain, SDNPVariadic]>; | [SDNPHasChain, SDNPVariadic]>; | ||||
def WebAssemblyglobalget : SDNode<"WebAssemblyISD::GLOBAL_GET", | |||||
SDT_WebAssemblyGlobalGet, | |||||
[SDNPMayLoad]>; | |||||
def WebAssemblyconst : SDNode<"WebAssemblyISD::CONST", | |||||
SDT_WebAssemblyConst>; | |||||
Nit: indentations look weird for both defs aheejin: Nit: indentations look weird for both defs | |||||
Not Done ReplyInline ActionsI agree with @aheejin that it would be ideal if we didn't need to add these new WebAssemblyISD items. We've come this far without needing them, so it would be good to keep that going. tlively: I agree with @aheejin that it would be ideal if we didn't need to add these new WebAssemblyISD… | |||||
I'll try out an implementation with ISelDAGtoDAG later. quantum: I'll try out an implementation with ISelDAGtoDAG later. | |||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
// WebAssembly-specific Operands. | // WebAssembly-specific Operands. | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
// Default Operand has AsmOperandClass "Imm" which is for integers (and | // Default Operand has AsmOperandClass "Imm" which is for integers (and | ||||
// symbols), so specialize one for floats: | // symbols), so specialize one for floats: | ||||
def FPImmAsmOperand : AsmOperandClass { | def FPImmAsmOperand : AsmOperandClass { | ||||
▲ Show 20 Lines • Show All 204 Lines • ▼ Show 20 Lines | def : Pat<(i32 (WebAssemblywrapper texternalsym:$addr)), | ||||
(GLOBAL_GET_I32 texternalsym:$addr)>, Requires<[IsPIC]>; | (GLOBAL_GET_I32 texternalsym:$addr)>, Requires<[IsPIC]>; | ||||
def : Pat<(i32 (WebAssemblywrapper texternalsym:$addr)), | def : Pat<(i32 (WebAssemblywrapper texternalsym:$addr)), | ||||
(CONST_I32 texternalsym:$addr)>, Requires<[IsNotPIC]>; | (CONST_I32 texternalsym:$addr)>, Requires<[IsNotPIC]>; | ||||
def : Pat<(i32 (WebAssemblywrapper mcsym:$sym)), (CONST_I32 mcsym:$sym)>; | def : Pat<(i32 (WebAssemblywrapper mcsym:$sym)), (CONST_I32 mcsym:$sym)>; | ||||
def : Pat<(i64 (WebAssemblywrapper mcsym:$sym)), (CONST_I64 mcsym:$sym)>; | def : Pat<(i64 (WebAssemblywrapper mcsym:$sym)), (CONST_I64 mcsym:$sym)>; | ||||
def : Pat<(i32 (WebAssemblyglobalget texternalsym:$idx)), | |||||
(GLOBAL_GET_I32 texternalsym:$idx)>; | |||||
def : Pat<(i32 (WebAssemblyconst tglobaltlsaddr:$idx)), | |||||
(CONST_I32 tglobaltlsaddr:$idx)>; | |||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
// Additional sets of instructions. | // Additional sets of instructions. | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
include "WebAssemblyInstrMemory.td" | include "WebAssemblyInstrMemory.td" | ||||
include "WebAssemblyInstrCall.td" | include "WebAssemblyInstrCall.td" | ||||
include "WebAssemblyInstrControl.td" | include "WebAssemblyInstrControl.td" | ||||
include "WebAssemblyInstrInteger.td" | include "WebAssemblyInstrInteger.td" | ||||
include "WebAssemblyInstrConv.td" | include "WebAssemblyInstrConv.td" | ||||
include "WebAssemblyInstrFloat.td" | include "WebAssemblyInstrFloat.td" | ||||
include "WebAssemblyInstrAtomics.td" | include "WebAssemblyInstrAtomics.td" | ||||
include "WebAssemblyInstrSIMD.td" | include "WebAssemblyInstrSIMD.td" | ||||
include "WebAssemblyInstrExceptRef.td" | include "WebAssemblyInstrExceptRef.td" | ||||
include "WebAssemblyInstrBulkMemory.td" | include "WebAssemblyInstrBulkMemory.td" |
Nit: indentation