diff options
author | Dan Gohman <dan433584@gmail.com> | 2017-02-02 19:29:44 +0000 |
---|---|---|
committer | Dan Gohman <dan433584@gmail.com> | 2017-02-02 19:29:44 +0000 |
commit | b89f2d3d92477049c3b3d7a79752860b2ed4d59c (patch) | |
tree | a61686c1527fc2e168b58f07f9628febe1d8dc2d /llvm/lib | |
parent | 1eb4ec6a2eedec4e69b664540fa1a14d5bf899b4 (diff) | |
download | bcm5719-llvm-b89f2d3d92477049c3b3d7a79752860b2ed4d59c.tar.gz bcm5719-llvm-b89f2d3d92477049c3b3d7a79752860b2ed4d59c.zip |
[WebAssembly] Add instruction definitions for drop and get/set_global.
llvm-svn: 293922
Diffstat (limited to 'llvm/lib')
3 files changed, 18 insertions, 0 deletions
diff --git a/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp b/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp index b4763ca60ab..d5444b2a1d2 100644 --- a/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp +++ b/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp @@ -94,6 +94,7 @@ MCDisassembler::DecodeStatus WebAssemblyDisassembler::getInstruction( switch (Info.OperandType) { case MCOI::OPERAND_IMMEDIATE: case WebAssembly::OPERAND_LOCAL: + case WebAssembly::OPERAND_GLOBAL: case WebAssembly::OPERAND_P2ALIGN: case WebAssembly::OPERAND_BASIC_BLOCK: { if (Pos + sizeof(uint64_t) > Bytes.size()) diff --git a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h index 8583b772dea..64f8f7d4853 100644 --- a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h +++ b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h @@ -47,6 +47,8 @@ enum OperandType { OPERAND_BASIC_BLOCK = MCOI::OPERAND_FIRST_TARGET, /// Local index. OPERAND_LOCAL, + /// Global index. + OPERAND_GLOBAL, /// 32-bit integer immediates. OPERAND_I32IMM, /// 64-bit integer immediates. diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td b/llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td index dcfd1a42c6a..79472cd8e48 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td +++ b/llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td @@ -74,6 +74,9 @@ def bb_op : Operand<OtherVT>; let OperandType = "OPERAND_LOCAL" in def local_op : Operand<i32>; +let OperandType = "OPERAND_GLOBAL" in +def global_op : Operand<i32>; + let OperandType = "OPERAND_I32IMM" in def i32imm_op : Operand<i32>; @@ -178,6 +181,18 @@ let hasSideEffects = 0 in { def TEE_LOCAL_#vt : I<(outs vt:$res), (ins local_op:$local, vt:$src), [], "tee_local\t$res, $local, $src", 0x22>; + // Unused values must be dropped in some contexts. + def DROP_#vt : I<(outs), (ins vt:$src), [], + "drop\t$src", 0x1a>; + + let mayLoad = 1 in + def GET_GLOBAL_#vt : I<(outs vt:$res), (ins global_op:$local), [], + "get_global\t$res, $local", 0x23>; + + let mayStore = 1 in + def SET_GLOBAL_#vt : I<(outs), (ins global_op:$local, vt:$src), [], + "set_global\t$local, $src", 0x24>; + } // hasSideEffects = 0 } defm : LOCAL<I32>; |