[WebAssembly] Factor out a TypeToString function, since we need it in multiple places.
[oota-llvm.git] / lib / Target / WebAssembly / WebAssemblyInstrInfo.td
index 52e0bd6e97f5b588a69ed4a0cafe3f889f8cb9b1..dafe6c1ed64befe79fc27ca3d24561243e1f2cd0 100644 (file)
@@ -67,8 +67,6 @@ def WebAssemblywrapper  : SDNode<"WebAssemblyISD::Wrapper",
 //===----------------------------------------------------------------------===//
 
 def bb_op : Operand<OtherVT>;
-def tjumptable_op : Operand<iPTR>;
-def global : Operand<iPTR>;
 
 //===----------------------------------------------------------------------===//
 // WebAssembly Instruction Format Definitions.
@@ -115,6 +113,7 @@ defm : LOCAL<I64>;
 defm : LOCAL<F32>;
 defm : LOCAL<F64>;
 
+let isMoveImm = 1 in {
 def CONST_I32 : I<(outs I32:$res), (ins i32imm:$imm),
                   [(set I32:$res, imm:$imm)],
                   "i32.const\t$res, $imm">;
@@ -127,6 +126,7 @@ def CONST_F32 : I<(outs F32:$res), (ins f32imm:$imm),
 def CONST_F64 : I<(outs F64:$res), (ins f64imm:$imm),
                   [(set F64:$res, fpimm:$imm)],
                   "f64.const\t$res, $imm">;
+} // isMoveImm = 1
 
 } // Defs = [ARGUMENTS]
 
@@ -134,13 +134,11 @@ def : Pat<(i32 (WebAssemblywrapper tglobaladdr:$dst)),
           (CONST_I32 tglobaladdr:$dst)>;
 def : Pat<(i32 (WebAssemblywrapper texternalsym:$dst)),
           (CONST_I32 texternalsym:$dst)>;
+def : Pat<(i32 (WebAssemblywrapper tjumptable:$dst)),
+          (CONST_I32 tjumptable:$dst)>;
 
 let Defs = [ARGUMENTS] in {
 
-def JUMP_TABLE : I<(outs I32:$dst), (ins tjumptable_op:$addr),
-                   [(set I32:$dst, (WebAssemblywrapper tjumptable:$addr))],
-                   "jump_table\t$dst, $addr">;
-
 // Function signature and local variable declaration "instructions".
 def PARAM  : I<(outs), (ins variable_ops), [], ".param  \t">;
 def RESULT : I<(outs), (ins variable_ops), [], ".result \t">;