From 4ed47784197e3922e0aa41cc89c6fd7d82221566 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Mon, 16 Nov 2015 21:04:51 +0000 Subject: [WebAssembly] Reverse the order of operands for br_if Summary: This is to match the new version in the spec Reviewers: sunfish Subscribers: jfb, llvm-commits, dschuff Differential Revision: http://reviews.llvm.org/D14519 llvm-svn: 253249 --- llvm/lib/Target/WebAssembly/WebAssemblyInstrControl.td | 4 ++-- llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'llvm/lib') diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyInstrControl.td b/llvm/lib/Target/WebAssembly/WebAssemblyInstrControl.td index af73a93c207..dd63e98efe9 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyInstrControl.td +++ b/llvm/lib/Target/WebAssembly/WebAssemblyInstrControl.td @@ -13,9 +13,9 @@ //===----------------------------------------------------------------------===// let isBranch = 1, isTerminator = 1, hasCtrlDep = 1 in { -def BR_IF : I<(outs), (ins bb_op:$dst, I32:$a), +def BR_IF : I<(outs), (ins I32:$a, bb_op:$dst), [(brcond I32:$a, bb:$dst)], - "br_if\t$dst, $a">; + "br_if\t$a, $dst">; let isBarrier = 1 in { def BR : I<(outs), (ins bb_op:$dst), [(br bb:$dst)], diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.cpp index fe27b1ac669..ed30b535480 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.cpp @@ -54,8 +54,8 @@ bool WebAssemblyInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB, case WebAssembly::BR_IF: if (HaveCond) return true; - Cond.push_back(MI.getOperand(1)); - TBB = MI.getOperand(0).getMBB(); + Cond.push_back(MI.getOperand(0)); + TBB = MI.getOperand(1).getMBB(); HaveCond = true; break; case WebAssembly::BR: @@ -105,8 +105,8 @@ unsigned WebAssemblyInstrInfo::InsertBranch( } BuildMI(&MBB, DL, get(WebAssembly::BR_IF)) - .addMBB(TBB) - .addOperand(Cond[0]); + .addOperand(Cond[0]) + .addMBB(TBB); if (!FBB) return 1; -- cgit v1.2.3