[llvm] r290412 - [WebAssembly] Annotate call and load/store immediates.
Dan Gohman via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 22 19:23:52 PST 2016
Author: djg
Date: Thu Dec 22 21:23:52 2016
New Revision: 290412
URL: http://llvm.org/viewvc/llvm-project?rev=290412&view=rev
Log:
[WebAssembly] Annotate call and load/store immediates.
These will be used to guide the binary encoding of these immediates.
Modified:
llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h
llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrCall.td
llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrMemory.td
Modified: llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h?rev=290412&r1=290411&r2=290412&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h (original)
+++ llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h Thu Dec 22 21:23:52 2016
@@ -55,6 +55,10 @@ enum OperandType {
OPERAND_F32IMM,
/// 64-bit floating-point immediates.
OPERAND_F64IMM,
+ /// 32-bit unsigned function indices.
+ OPERAND_FUNCTION32,
+ /// 32-bit unsigned memory offsets.
+ OPERAND_OFFSET32,
/// p2align immediate for load and store address alignment.
OPERAND_P2ALIGN,
/// signature immediate for block/loop.
Modified: llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrCall.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrCall.td?rev=290412&r1=290411&r2=290412&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrCall.td (original)
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrCall.td Thu Dec 22 21:23:52 2016
@@ -26,7 +26,7 @@ def ADJCALLSTACKUP : I<(outs), (ins i32i
} // isCodeGenOnly = 1
multiclass CALL<WebAssemblyRegClass vt, string prefix> {
- def CALL_#vt : I<(outs vt:$dst), (ins i32imm:$callee, variable_ops),
+ def CALL_#vt : I<(outs vt:$dst), (ins function32_op:$callee, variable_ops),
[(set vt:$dst, (WebAssemblycall1 (i32 imm:$callee)))],
!strconcat(prefix, "call\t$dst, $callee"),
0x10>;
@@ -43,7 +43,7 @@ multiclass CALL<WebAssemblyRegClass vt,
}
multiclass SIMD_CALL<ValueType vt, string prefix> {
- def CALL_#vt : SIMD_I<(outs V128:$dst), (ins i32imm:$callee, variable_ops),
+ def CALL_#vt : SIMD_I<(outs V128:$dst), (ins function32_op:$callee, variable_ops),
[(set (vt V128:$dst),
(WebAssemblycall1 (i32 imm:$callee)))],
!strconcat(prefix, "call\t$dst, $callee"),
@@ -73,7 +73,7 @@ let Uses = [SP32, SP64], isCall = 1 in {
defm : SIMD_CALL<v4i32, "i32x4.">;
defm : SIMD_CALL<v4f32, "f32x4.">;
- def CALL_VOID : I<(outs), (ins i32imm:$callee, variable_ops),
+ def CALL_VOID : I<(outs), (ins function32_op:$callee, variable_ops),
[(WebAssemblycall0 (i32 imm:$callee))],
"call \t$callee", 0x10>;
let isCodeGenOnly = 1 in {
Modified: llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrInfo.td?rev=290412&r1=290411&r2=290412&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrInfo.td (original)
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrInfo.td Thu Dec 22 21:23:52 2016
@@ -86,6 +86,12 @@ def f32imm_op : Operand<f32>;
let OperandType = "OPERAND_F64IMM" in
def f64imm_op : Operand<f64>;
+let OperandType = "OPERAND_FUNCTION32" in
+def function32_op : Operand<i32>;
+
+let OperandType = "OPERAND_OFFSET32" in
+def offset32_op : Operand<i32>;
+
let OperandType = "OPERAND_P2ALIGN" in {
def P2Align : Operand<i32> {
let PrintMethod = "printWebAssemblyP2AlignOperand";
Modified: llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrMemory.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrMemory.td?rev=290412&r1=290411&r2=290412&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrMemory.td (original)
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrMemory.td Thu Dec 22 21:23:52 2016
@@ -59,16 +59,16 @@ let Defs = [ARGUMENTS] in {
// FIXME: When we can break syntax compatibility, reorder the fields in the
// asmstrings to match the binary encoding.
def LOAD_I32 : I<(outs I32:$dst),
- (ins P2Align:$p2align, i32imm:$off, I32:$addr),
+ (ins P2Align:$p2align, offset32_op:$off, I32:$addr),
[], "i32.load\t$dst, ${off}(${addr})${p2align}", 0x28>;
def LOAD_I64 : I<(outs I64:$dst),
- (ins P2Align:$p2align, i32imm:$off, I32:$addr),
+ (ins P2Align:$p2align, offset32_op:$off, I32:$addr),
[], "i64.load\t$dst, ${off}(${addr})${p2align}", 0x29>;
def LOAD_F32 : I<(outs F32:$dst),
- (ins P2Align:$p2align, i32imm:$off, I32:$addr),
+ (ins P2Align:$p2align, offset32_op:$off, I32:$addr),
[], "f32.load\t$dst, ${off}(${addr})${p2align}", 0x2a>;
def LOAD_F64 : I<(outs F64:$dst),
- (ins P2Align:$p2align, i32imm:$off, I32:$addr),
+ (ins P2Align:$p2align, offset32_op:$off, I32:$addr),
[], "f64.load\t$dst, ${off}(${addr})${p2align}", 0x2b>;
} // Defs = [ARGUMENTS]
@@ -143,34 +143,34 @@ let Defs = [ARGUMENTS] in {
// Extending load.
def LOAD8_S_I32 : I<(outs I32:$dst),
- (ins P2Align:$p2align, i32imm:$off, I32:$addr),
+ (ins P2Align:$p2align, offset32_op:$off, I32:$addr),
[], "i32.load8_s\t$dst, ${off}(${addr})${p2align}", 0x2c>;
def LOAD8_U_I32 : I<(outs I32:$dst),
- (ins P2Align:$p2align, i32imm:$off, I32:$addr),
+ (ins P2Align:$p2align, offset32_op:$off, I32:$addr),
[], "i32.load8_u\t$dst, ${off}(${addr})${p2align}", 0x2d>;
def LOAD16_S_I32 : I<(outs I32:$dst),
- (ins P2Align:$p2align, i32imm:$off, I32:$addr),
+ (ins P2Align:$p2align, offset32_op:$off, I32:$addr),
[], "i32.load16_s\t$dst, ${off}(${addr})${p2align}", 0x2e>;
def LOAD16_U_I32 : I<(outs I32:$dst),
- (ins P2Align:$p2align, i32imm:$off, I32:$addr),
+ (ins P2Align:$p2align, offset32_op:$off, I32:$addr),
[], "i32.load16_u\t$dst, ${off}(${addr})${p2align}", 0x2f>;
def LOAD8_S_I64 : I<(outs I64:$dst),
- (ins P2Align:$p2align, i32imm:$off, I32:$addr),
+ (ins P2Align:$p2align, offset32_op:$off, I32:$addr),
[], "i64.load8_s\t$dst, ${off}(${addr})${p2align}", 0x30>;
def LOAD8_U_I64 : I<(outs I64:$dst),
- (ins P2Align:$p2align, i32imm:$off, I32:$addr),
+ (ins P2Align:$p2align, offset32_op:$off, I32:$addr),
[], "i64.load8_u\t$dst, ${off}(${addr})${p2align}", 0x31>;
def LOAD16_S_I64 : I<(outs I64:$dst),
- (ins P2Align:$p2align, i32imm:$off, I32:$addr),
+ (ins P2Align:$p2align, offset32_op:$off, I32:$addr),
[], "i64.load16_s\t$dst, ${off}(${addr})${p2align}", 0x32>;
def LOAD16_U_I64 : I<(outs I64:$dst),
- (ins P2Align:$p2align, i32imm:$off, I32:$addr),
+ (ins P2Align:$p2align, offset32_op:$off, I32:$addr),
[], "i64.load16_u\t$dst, ${off}(${addr})${p2align}", 0x33>;
def LOAD32_S_I64 : I<(outs I64:$dst),
- (ins P2Align:$p2align, i32imm:$off, I32:$addr),
+ (ins P2Align:$p2align, offset32_op:$off, I32:$addr),
[], "i64.load32_s\t$dst, ${off}(${addr})${p2align}", 0x34>;
def LOAD32_U_I64 : I<(outs I64:$dst),
- (ins P2Align:$p2align, i32imm:$off, I32:$addr),
+ (ins P2Align:$p2align, offset32_op:$off, I32:$addr),
[], "i64.load32_u\t$dst, ${off}(${addr})${p2align}", 0x35>;
} // Defs = [ARGUMENTS]
@@ -449,16 +449,16 @@ let Defs = [ARGUMENTS] in {
// Basic store.
// Note: WebAssembly inverts SelectionDAG's usual operand order.
-def STORE_I32 : I<(outs), (ins P2Align:$p2align, i32imm:$off, I32:$addr,
+def STORE_I32 : I<(outs), (ins P2Align:$p2align, offset32_op:$off, I32:$addr,
I32:$val), [],
"i32.store\t${off}(${addr})${p2align}, $val", 0x36>;
-def STORE_I64 : I<(outs), (ins P2Align:$p2align, i32imm:$off, I32:$addr,
+def STORE_I64 : I<(outs), (ins P2Align:$p2align, offset32_op:$off, I32:$addr,
I64:$val), [],
"i64.store\t${off}(${addr})${p2align}, $val", 0x37>;
-def STORE_F32 : I<(outs), (ins P2Align:$p2align, i32imm:$off, I32:$addr,
+def STORE_F32 : I<(outs), (ins P2Align:$p2align, offset32_op:$off, I32:$addr,
F32:$val), [],
"f32.store\t${off}(${addr})${p2align}, $val", 0x38>;
-def STORE_F64 : I<(outs), (ins P2Align:$p2align, i32imm:$off, I32:$addr,
+def STORE_F64 : I<(outs), (ins P2Align:$p2align, offset32_op:$off, I32:$addr,
F64:$val), [],
"f64.store\t${off}(${addr})${p2align}, $val", 0x39>;
@@ -541,19 +541,19 @@ def : Pat<(store F64:$val, (WebAssemblyw
let Defs = [ARGUMENTS] in {
// Truncating store.
-def STORE8_I32 : I<(outs), (ins P2Align:$p2align, i32imm:$off, I32:$addr,
+def STORE8_I32 : I<(outs), (ins P2Align:$p2align, offset32_op:$off, I32:$addr,
I32:$val), [],
"i32.store8\t${off}(${addr})${p2align}, $val", 0x3a>;
-def STORE16_I32 : I<(outs), (ins P2Align:$p2align, i32imm:$off, I32:$addr,
+def STORE16_I32 : I<(outs), (ins P2Align:$p2align, offset32_op:$off, I32:$addr,
I32:$val), [],
"i32.store16\t${off}(${addr})${p2align}, $val", 0x3b>;
-def STORE8_I64 : I<(outs), (ins P2Align:$p2align, i32imm:$off, I32:$addr,
+def STORE8_I64 : I<(outs), (ins P2Align:$p2align, offset32_op:$off, I32:$addr,
I64:$val), [],
"i64.store8\t${off}(${addr})${p2align}, $val", 0x3c>;
-def STORE16_I64 : I<(outs), (ins P2Align:$p2align, i32imm:$off, I32:$addr,
+def STORE16_I64 : I<(outs), (ins P2Align:$p2align, offset32_op:$off, I32:$addr,
I64:$val), [],
"i64.store16\t${off}(${addr})${p2align}, $val", 0x3d>;
-def STORE32_I64 : I<(outs), (ins P2Align:$p2align, i32imm:$off, I32:$addr,
+def STORE32_I64 : I<(outs), (ins P2Align:$p2align, offset32_op:$off, I32:$addr,
I64:$val), [],
"i64.store32\t${off}(${addr})${p2align}, $val", 0x3e>;
More information about the llvm-commits
mailing list