summaryrefslogtreecommitdiff
path: root/lib/Target/WebAssembly/WebAssemblyInstrFormats.td
diff options
context:
space:
mode:
authorDan Gohman <dan433584@gmail.com>2015-11-05 20:42:30 +0000
committerDan Gohman <dan433584@gmail.com>2015-11-05 20:42:30 +0000
commit651ccf4012bee3c8d33b16a0d4958cf3550e4ef3 (patch)
treedd6dab545db36cc78a43843bd3764923423bc9ad /lib/Target/WebAssembly/WebAssemblyInstrFormats.td
parentae31b98bc3240caa2093d6cb4bf195a338a7a626 (diff)
[WebAssembly] Add AsmString strings for most instructions.
Mangling type information into MachineInstr opcode names was a temporary measure, and it's starting to get hairy. At the same time, the MC instruction printer wants to use AsmString strings for printing. This patch takes the first step, starting the process of adding AsmStrings for instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252203 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/WebAssembly/WebAssemblyInstrFormats.td')
-rw-r--r--lib/Target/WebAssembly/WebAssemblyInstrFormats.td56
1 files changed, 34 insertions, 22 deletions
diff --git a/lib/Target/WebAssembly/WebAssemblyInstrFormats.td b/lib/Target/WebAssembly/WebAssemblyInstrFormats.td
index dd7a01713c1..526d61e1331 100644
--- a/lib/Target/WebAssembly/WebAssemblyInstrFormats.td
+++ b/lib/Target/WebAssembly/WebAssemblyInstrFormats.td
@@ -13,55 +13,67 @@
//===----------------------------------------------------------------------===//
// WebAssembly Instruction Format.
-class WebAssemblyInst<string cstr> : Instruction {
+class WebAssemblyInst<string asmstr> : Instruction {
field bits<0> Inst; // Instruction encoding.
let Namespace = "WebAssembly";
let Pattern = [];
- let Constraints = cstr;
+ let AsmString = asmstr;
}
// Normal instructions.
-class I<dag oops, dag iops, list<dag> pattern, string cstr = "">
- : WebAssemblyInst<cstr> {
+class I<dag oops, dag iops, list<dag> pattern, string asmstr = "">
+ : WebAssemblyInst<asmstr> {
dag OutOperandList = oops;
dag InOperandList = iops;
let Pattern = pattern;
}
// Unary and binary instructions, for the local types that WebAssembly supports.
-multiclass UnaryInt<SDNode node> {
+multiclass UnaryInt<SDNode node, string name> {
def _I32 : I<(outs I32:$dst), (ins I32:$src),
- [(set I32:$dst, (node I32:$src))]>;
+ [(set I32:$dst, (node I32:$src))],
+ !strconcat("i32.", !strconcat(name, " $dst, $src"))>;
def _I64 : I<(outs I64:$dst), (ins I64:$src),
- [(set I64:$dst, (node I64:$src))]>;
+ [(set I64:$dst, (node I64:$src))],
+ !strconcat("i64.", !strconcat(name, " $dst, $src"))>;
}
-multiclass BinaryInt<SDNode node> {
+multiclass BinaryInt<SDNode node, string name> {
def _I32 : I<(outs I32:$dst), (ins I32:$lhs, I32:$rhs),
- [(set I32:$dst, (node I32:$lhs, I32:$rhs))]>;
+ [(set I32:$dst, (node I32:$lhs, I32:$rhs))],
+ !strconcat("i32.", !strconcat(name, " $dst, $lhs, $rhs"))>;
def _I64 : I<(outs I64:$dst), (ins I64:$lhs, I64:$rhs),
- [(set I64:$dst, (node I64:$lhs, I64:$rhs))]>;
+ [(set I64:$dst, (node I64:$lhs, I64:$rhs))],
+ !strconcat("i64.", !strconcat(name, " $dst, $lhs, $rhs"))>;
}
-multiclass UnaryFP<SDNode node> {
+multiclass UnaryFP<SDNode node, string name> {
def _F32 : I<(outs F32:$dst), (ins F32:$src),
- [(set F32:$dst, (node F32:$src))]>;
+ [(set F32:$dst, (node F32:$src))],
+ !strconcat("f32.", !strconcat(name, " $dst, $src"))>;
def _F64 : I<(outs F64:$dst), (ins F64:$src),
- [(set F64:$dst, (node F64:$src))]>;
+ [(set F64:$dst, (node F64:$src))],
+ !strconcat("f64.", !strconcat(name, " $dst, $src"))>;
}
-multiclass BinaryFP<SDNode node> {
+multiclass BinaryFP<SDNode node, string name> {
def _F32 : I<(outs F32:$dst), (ins F32:$lhs, F32:$rhs),
- [(set F32:$dst, (node F32:$lhs, F32:$rhs))]>;
+ [(set F32:$dst, (node F32:$lhs, F32:$rhs))],
+ !strconcat("f32.", !strconcat(name, " $dst, $lhs, $rhs"))>;
def _F64 : I<(outs F64:$dst), (ins F64:$lhs, F64:$rhs),
- [(set F64:$dst, (node F64:$lhs, F64:$rhs))]>;
+ [(set F64:$dst, (node F64:$lhs, F64:$rhs))],
+ !strconcat("f64.", !strconcat(name, " $dst, $lhs, $rhs"))>;
}
-multiclass ComparisonInt<CondCode cond> {
+multiclass ComparisonInt<CondCode cond, string name> {
def _I32 : I<(outs I32:$dst), (ins I32:$lhs, I32:$rhs),
- [(set I32:$dst, (setcc I32:$lhs, I32:$rhs, cond))]>;
+ [(set I32:$dst, (setcc I32:$lhs, I32:$rhs, cond))],
+ !strconcat("i32.", !strconcat(name, " $dst, $lhs, $rhs"))>;
def _I64 : I<(outs I32:$dst), (ins I64:$lhs, I64:$rhs),
- [(set I32:$dst, (setcc I64:$lhs, I64:$rhs, cond))]>;
+ [(set I32:$dst, (setcc I64:$lhs, I64:$rhs, cond))],
+ !strconcat("i64.", !strconcat(name, " $dst, $lhs, $rhs"))>;
}
-multiclass ComparisonFP<CondCode cond> {
+multiclass ComparisonFP<CondCode cond, string name> {
def _F32 : I<(outs I32:$dst), (ins F32:$lhs, F32:$rhs),
- [(set I32:$dst, (setcc F32:$lhs, F32:$rhs, cond))]>;
+ [(set I32:$dst, (setcc F32:$lhs, F32:$rhs, cond))],
+ !strconcat("f32.", !strconcat(name, " $dst, $lhs, $rhs"))>;
def _F64 : I<(outs I32:$dst), (ins F64:$lhs, F64:$rhs),
- [(set I32:$dst, (setcc F64:$lhs, F64:$rhs, cond))]>;
+ [(set I32:$dst, (setcc F64:$lhs, F64:$rhs, cond))],
+ !strconcat("f64.", !strconcat(name, " $dst, $lhs, $rhs"))>;
}